Differences between revisions 3 and 4 Back to page
Revision 3 as of 3:43AM, Apr 25, 2011
Size: 90
Editor: Gweon
Comment:
Revision 4 as of 3:45AM, Apr 25, 2011
Size: 857
Editor: Gweon
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

Now, for this homework, you basically need to calculate some functions and plot up the results. Example 2.3 of the textbook is a pretty good "template" for this task, and so I will discuss that example.

First, the Matlab code.

{{{
%E2.3: Fermi Function Calculation, f(E-EF,T)

%Initialization
clear
close

%Constant
%25.85 meV for 300 K is an equivalent way to remember it.
k=8.617e-5;

%Google for "Matlab linspace", to find out what linspace does!
dE=linspace(-0.2,0.2);
for ii=1:4;
    T=100*ii;
    kT=k*T;
    f(ii,:)=1./(1+exp(dE./kT));
    end

%Plotting result
close
plot(dE,f); grid;
xlabel('E - E_F (eV)'); ylabel('f (E)');
text(.05,.22,'T=400K'); text(-.03,.12,'T=100K');

%Octave-specific
print -djpg E2.3.oct.jpg
}}}

First, here is some base-line discussion for Matlab and Python.

Now, for this homework, you basically need to calculate some functions and plot up the results. Example 2.3 of the textbook is a pretty good "template" for this task, and so I will discuss that example.

First, the Matlab code.

%E2.3: Fermi Function Calculation, f(E-EF,T)

%Initialization
clear
close

%Constant
%25.85 meV for 300 K is an equivalent way to remember it.
k=8.617e-5;

%Google for "Matlab linspace", to find out what linspace does!
dE=linspace(-0.2,0.2);
for ii=1:4;
    T=100*ii;
    kT=k*T;
    f(ii,:)=1./(1+exp(dE./kT));
    end

%Plotting result
close
plot(dE,f); grid;
xlabel('E - E_F (eV)'); ylabel('f (E)');
text(.05,.22,'T=400K'); text(-.03,.12,'T=100K');

%Octave-specific
print -djpg E2.3.oct.jpg