changed indents

This commit is contained in:
pkirwin 2021-02-08 17:35:48 -07:00
parent 1970f3f428
commit 15b3adfb1d
2 changed files with 0 additions and 128 deletions

BIN
PS1/doc.pdf Normal file

Binary file not shown.

View File

@ -1,128 +0,0 @@
clear all;
% Physical constants in MKS units
hbar = 1.054e-34;
6 q = 1.602e-19;
% Energy parameters in eV; included are the single-electron charging
% energy U0; the kBT product; the equilibrium Fermi level mu; and the
% energy level cal_E, which is short-form for "calligraphic E"
% Please especially note that ALL ENERGY VARIABLES IN THIS CODE
% ARE IN eV (NOT joules); the equations from class must be adjusted
% accordingly, multiplying or dividing appropriate terms by a factor of q
U0 = 0.25;
kBT = 0.025;
mu = 0;
cal_E = 0.2;
% Capacitance parameters
alpha_G = 0.5;
alpha_D = 0.5;
alpha_S = 1 - alpha_G - alpha_D;
% Energy grid in eV, from -1 eV to 1 eV
NE = 501;
E = linspace(-1,1,NE);
dE = E(2) - E(1);
% Gamma parameters, in eV
gamma_1 = 0.005;
gamma_2 = 0.005;
gamma = gamma_1 + gamma_2;
% Lorentzian density of states, normalized so that its integral is unity
D = (gamma/(2*pi))./((E-cal_E).ˆ2+(gamma/2)ˆ2);
D = D./(dE*sum(D));
% Reference number of electrons in the channel, assumed to be zero in
% this code
N0 = 0;
% Voltage values to consider for the final plots
NV = 101;
VV = linspace(0,1,NV);
dV = VV(2) - VV(1);
% Loop over voltage values and compute number of electrons and current
% for each voltage value in a self-consistent manner
for count = 1:NV
% Set terminal voltages
VG = 0;
VD = VV(count);
VS = 0;
% Values of mu1 and mu2; notice that the usual factor of q multiplying
% the voltages is omitted, because in this code, energy is in eV
mu1 = mu - VS;
mu2 = mu - VD;
% Value of Laplace potential in eV
UL = - (alpha_G*VG) - (alpha_D*VD) - (alpha_S*VS);
% Initial value of Poisson part in eV
UP = 0;
% Iterate until self-consistent potential is achieved by monitoring
% the Poisson part (the Laplace part does not change)
dUP = 1;
while dUP > 1e-6
% Compute source and drain Fermi functions
f1 = 1./(1+exp((E + UL + UP - mu1)./kBT));
f2 = 1./(1+exp((E + UL + UP - mu2)./kBT));
% Compute number of channel electrons
N(count) = dE*sum( ((gamma_1/gamma).*f1 + (gamma_2/gamma).*f2).*D );
% Newly calculated Poisson part of self-consistent potential
UPnew = U0*( N(count) - N0 );
% Change in Poisson part between iterations
dUP = abs(UP - UPnew);
% New guess for next iteration, found by adding a fraction of the
% difference between iterations to the old guess
105
106 UP = UP + 0.1*(UPnew - UP);
107
108 end
109
110 % Compute the current in A after the self-consistent potential
111 % has been achieved; notice the extra factor of q preceding the
112 % equation, which is needed since the gammas are in eV
113
114 I(count) = q*(q/hbar)*(gamma_1*gamma_2)/(gamma) ...
115 *dE*sum((f1-f2).*D);
116
117 end
118
119 % Plotting commands, including lines to modify the linewidth
120 % and Fontsize, just to make the plots look nicer; you dont
% need to worry about how these work
figure(1); h = plot(VV,N,k); grid on;
set(h,linewidth,[2.0]); set(gca,Fontsize,[18]);
xlabel(DRAIN VOLTAGE [V]); ylabel(NUMBER OF ELECTRONS);
figure(2); h = plot(VV,I,k); grid on;
set(h,linewidth,[2.0]); set(gca,Fontsize,[18]);
xlabel(DRAIN VOLTAGE [V]); ylabel(CURRENT [A]);