% ele533 text problem 2.15

% Solution is based on the equation

%       ni = sqrt(NvNc)exp(-Eg/2KT)

% At high temp thermal generation swamps out doping and n = ni.


t=[50 100 150 200];   % Temp degrees C
T = t+273;
x= 1./T;
r = [700 1000 230 33];  % resistivity
sigma = 1./r;           % conductivity
slog = log(sigma);
% semilogy(x,sigma)
plot(x,slog)
xlabel('1/T')
ylabel('log(sigma)')
title('Temperature dependance of carrier concentration')
grid
slope=(slog(4)-slog(2))./(x(4)-x(2))    % Use high temp values
k=8.62e-5;           % Boltzmann's constant  eV/K
Eg = -2*k*slope      % True since  ni = sqrt(NvNc)exp(-Eg/2KT)

% Room temperature resistivity is about 850 Ohm-cm  (700+1000)/2

% resistivity = 1/(quN)
resistivity = 850;
q=1.6e-19;      % electronic charge
u=1500;         % Assume the sample is lightly doped

N =1/(q*u*resistivity)

% Running this code gives;

%   Eg = 1.0376         Close to the bandgap of Si (1.12eV)
%   N = 4.9020e+12      Lightly doped, therefore the assumption
%                       that mobility (u) = 1500 is good.
