| Differences between revisions 5 and 18 (spanning 13 versions) | Back to page |
|
Size: 6632
Comment:
|
Size: 7178
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 5: | Line 5: |
| === Python === |
|
| Line 6: | Line 8: |
| {{{#!highlight python | <<lia(P2p9.png)>><<clr>> One thing that is interesting for this problem is that when scaled by an appropriate number, the two curves are seen to lay on top of each other! Would you have expected it? Why? {{{#!highlight python numbers=off |
| Line 19: | Line 26: |
| # h distribution function, hdf = gv(E)*(1-f(E)) -- for E <= Ec | # h distribution function, hdf = gv(E)*(1-f(E)) -- for E <= Ev |
| Line 69: | Line 76: |
| xlabel (r'Carrier Excitation Energy (in unit of kT)') ylabel ('Carrier Distribution (1/(eV cm$^3$))') |
xlabel ('Carrier Excitation Energy (in unit of kT)') ylabel (r'Carrier Distribution (1/(eV cm$^3$))') |
| Line 81: | Line 88: |
| {{{#!highlight matlab | === Matlab === Here is a matlab version of the same code. Matlab-produced image and Octave-produced image: <<lia(P2p9_m.png)>> <<lia(P2p9_o.jpg)>> <<clr>> {{{#!highlight matlab numbers=off |
| Line 94: | Line 109: |
| % h distribution function, hdf = gv(E)*(1-f(E)) -- for E <= Ec | % h distribution function, hdf = gv(E)*(1-f(E)) -- for E <= Ev |
| Line 144: | Line 159: |
| % matplotlib comes with its own LaTeX parser -- cool! | |
| Line 155: | Line 169: |
| {{{#!highlight python | In this problem, the broadening of the electron distribution as T increases can be noted. === Python === <<lia(P2p10.png)>> <<clr>> {{{#!highlight python numbers=off |
| Line 171: | Line 191: |
| EG = 1.170 - 4.730e-4 * T ** 2 / (T + 636) # pages 69,70 | |
| Line 191: | Line 210: |
| {{{#!highlight matlab | === Matlab === Matlab-produced image and Octave-produced image: <<lia(P2p10_m.png)>> <<lia(P2p10_o.jpg)>> <<clr>> {{{#!highlight matlab numbers=off |
| Line 209: | Line 234: |
| T = 1200 end EG = 1.170 - 4.730e-4 * T ^ 2 / (T + 636) % pages 69,70 |
T = 1200 end |
2.9
Python
Here is the source code in python that produced this image.
One thing that is interesting for this problem is that when scaled by an appropriate number, the two curves are seen to lay on top of each other! Would you have expected it? Why?
#!/usr/bin/env python
from pylab import *
T = 300 # K
kB = 0.02585 / 300 # eV/K
EG = 1.170 - 4.730e-4 * T ** 2 / (T + 636) # pages 69,70
mnr = 1.028 + 6.11e-4 * T - 3.09e-7 * T ** 2 # mnstar / m_e -- page 55
mpr = 0.610 + 7.83e-4 * T - 4.46e-7 * T ** 2 # mpstar / m_e -- page 55
# What do we need to plot?
# e distribution function, edf = gc(E)*f(E) -- for E >= Ec
# h distribution function, hdf = gv(E)*(1-f(E)) -- for E <= Ev
# Define gcp(x) = gc(x+Ec).
# Then,
# gc(E)*f(E) = gcp(x)*f(x+Ec)
# where x = E - Ec >= 0 is the electron excitation energy.
# Likewise, define gvp(x) = gv(Ev-x)
# gv(E)*(1-f(E)) = gvp(x)*(1-f(Ev-x))
# where x = Ev - E >= 0 is the hole excitation energy.
# x is in unit of eV -- it is positive and used both for e and h.
# We are taking it to go to 7 kB T.
x = linspace (0, 5, 100) * kB * T
# Check that they are reasonable.
print 'mnr =', mnr
print 'mpr =', mpr
# These are from Eqs. T2.6a,b with x = E-Ec or Ev-E.
# If x is in unit of eV, then gcp, gvp are in unit of
# eV ** 0.5 * eV ** 1.5 / eV ** 3 / Angstrom ** 3
# = 1 / eV / Angstrom ** 3
gcp = sqrt(2. * x) * (mnr * 0.511e6) ** 1.5 / pi ** 2 / 1973 ** 3
gvp = sqrt(2. * x) * (mpr * 0.511e6) ** 1.5 / pi ** 2 / 1973 ** 3
# As given in the problem.
Ev = 0.
Ec = EG
EF = 0.75 * EG
# Multiply by f(x+Ec) and 1-f(Ev-x) respectively, as shown above.
edf = gcp / (exp ((x + Ec - EF) / kB / T) + 1)
hdf = gvp / (exp ((x - Ev + EF) / kB / T) + 1)
# Finally, convert the unit to 1 / eV / cm ** 3
edf *= 1.e24
hdf *= 1.e24
# Check the orders of magnitude.
print 'max (edf) / max (hdf) = %g' % (max (edf) / max (hdf))
# However, the hole counts are very low -- blow them up.
# Based on what we learnd just now.
hdf *= 5.e9
# All hard compuations now done -- plot them!
plot (x / kB / T, edf, label = 'Electron')
plot (x / kB / T, hdf, label = r'Hole ($\times$ $5\times10^9$)')
grid ()
# matplotlib comes with its own LaTeX parser -- cool!
xlabel ('Carrier Excitation Energy (in unit of kT)')
ylabel (r'Carrier Distribution (1/(eV cm$^3$))')
title ('Carrier Distribution Functions at T = 300 K')
legend ()
# Sort of equivalent to "print" of matlab. "print" is a python keyword.
# Comment out one of these lines to get a print-out in batch mode.
#savefig ('E2p3.svg')
#savefig ('E2p3.eps')
savefig ('P2p9.png')
Matlab
Here is a matlab version of the same code.
Matlab-produced image and Octave-produced image:
% Clean slate
close
clear
T = 300 % K
kB = 0.02585 / 300 % eV/K
EG = 1.170 - 4.730e-4 * T ^ 2 / (T + 636) % pages 69,70
mnr = 1.028 + 6.11e-4 * T - 3.09e-7 * T ^ 2 % mnstar / m_e -- page 55
mpr = 0.610 + 7.83e-4 * T - 4.46e-7 * T ^ 2 % mpstar / m_e -- page 55
% What do we need to plot?
% e distribution function, edf = gc(E)*f(E) -- for E >= Ec
% h distribution function, hdf = gv(E)*(1-f(E)) -- for E <= Ev
% Define gcp(x) = gc(x+Ec).
% Then,
% gc(E)*f(E) = gcp(x)*f(x+Ec)
% where x = E - Ec >= 0 is the electron excitation energy.
% Likewise, define gvp(x) = gv(Ev-x)
% gv(E)*(1-f(E)) = gvp(x)*(1-f(Ev-x))
% where x = Ev - E >= 0 is the hole excitation energy.
% x is in unit of eV -- it is positive and used both for e and h.
% We are taking it to go to 7 kB T.
x = linspace (0, 5, 100) * kB * T
% Check that they are reasonable.
mnr
mpr
% These are from Eqs. T2.6a,b with x = E-Ec or Ev-E.
% If x is in unit of eV, then gcp, gvp are in unit of
% eV ** 0.5 * eV ** 1.5 / eV ** 3 / Angstrom ** 3
% = 1 / eV / Angstrom ** 3
gcp = sqrt(2. * x) * (mnr * 0.511e6) ^ 1.5 / pi ^ 2 / 1973 ^ 3
gvp = sqrt(2. * x) * (mpr * 0.511e6) ^ 1.5 / pi ^ 2 / 1973 ^ 3
% As given in the problem.
Ev = 0.
Ec = EG
EF = 0.75 * EG
% Multiply by f(x+Ec) and 1-f(Ev-x) respectively, as shown above.
edf = gcp ./ (exp ((x + Ec - EF) / kB / T) + 1)
hdf = gvp ./ (exp ((x - Ev + EF) / kB / T) + 1)
% Finally, convert the unit to 1 / eV / cm ** 3
edf = edf * 1.e24
hdf = hdf * 1.e24
% Check the orders of magnitude.
max (edf) / max (hdf)
% However, the hole counts are very low -- blow them up.
% Based on what we learnd just now.
hdf = hdf * 5.e9
% All hard compuations now done -- plot them!
f (1, :) = edf
f (2, :) = hdf
plot (x / kB / T, f)
grid ()
xlabel ('Carrier Excitation Energy (in unit of kT)')
ylabel ('Carrier Distribution (1/(eV cm^3))')
title ('Carrier Distribution Functions at T = 300 K')
legend ('Electron', 'Hole (x 5x10^9)')
print -dpng P2p9_m.png
2.10b
In this problem, the broadening of the electron distribution as T increases can be noted.
Python
#!/usr/bin/env python
from pylab import *
kB = 0.02585 / 300 # eV/K
# What do we need to plot?
# the normalized e distribution function
# nedf = gc f / n = ... as given in part (a) of this problem (and below).
# x is in unit of eV
# Need many points for a smooth curve at 300 K.
x = linspace (0, 0.4, 800)
for T in [300, 600, 1200]:
mnr = 1.028 + 6.11e-4 * T - 3.09e-7 * T ** 2 # mnstar / m_e -- page 55
mpr = 0.610 + 7.83e-4 * T - 4.46e-7 * T ** 2 # mpstar / m_e -- page 55
# Check that they are reasonable.
print 'mnr =', mnr, 'at T =', T
print 'mpr =', mpr, 'at T =', T
nedf = 2 * sqrt (x) / sqrt (pi) / (kB * T) ** 1.5 * exp (-x / (kB * T))
plot (nedf, x, label = 'T = %g K' % T)
grid ()
legend ()
xlim ([0, 20])
ylim ([0, 0.4])
# matplotlib comes with its own LaTeX parser -- cool!
xlabel ('Normalized Electron Distribution Function (1/eV)')
ylabel ('Excitation Energy (eV)')
savefig ('P2p10.png')
Matlab
Matlab-produced image and Octave-produced image:
% Clean slate
close
clear
kB = 0.02585 / 300 % eV/K
% What do we need to plot?
% the normalized e distribution function
% nedf = gc f / n = ... as given in part (a) of this problem (and below).
% x is in unit of eV
% Need many points for a smooth curve at 300 K.
x = linspace (0, 0.4, 800)
for ii=1:3;
T = 300 * ii
if ii == 3
T = 1200
end
mnr = 1.028 + 6.11e-4 * T - 3.09e-7 * T ^ 2 % mnstar / m_e -- page 55
mpr = 0.610 + 7.83e-4 * T - 4.46e-7 * T ^ 2 % mpstar / m_e -- page 55
nedf = 2 * sqrt (x) / sqrt (pi) / (kB * T) ^ 1.5 .* exp (-x / (kB * T))
f(:,ii) = nedf
end
plot (f, x)
grid ()
legend ('T = 300 K', 'T = 600 K', 'T = 1200 K')
axis ([0 20 0 0.4])
xlabel ('Normalized Electron Distribution Function (1/eV)')
ylabel ('Excitation Energy (eV)')
print -dpng P2p10_m.png





