Rev | Line | |
---|
[798] | 1 | % ---------------------------------------------------------------------- |
---|
| 2 | % EXAMPLE: Fermi-Dirac function in Matlab. |
---|
| 3 | % |
---|
| 4 | % This script represents a legacy application that will be left |
---|
| 5 | % intact, but wrapped with a Rappture interface. |
---|
| 6 | % |
---|
| 7 | % ====================================================================== |
---|
| 8 | % AUTHOR: Michael McLennan, Purdue University |
---|
[3957] | 9 | % Copyright (c) 2004-2012 HUBzero Foundation, LLC |
---|
[798] | 10 | % |
---|
| 11 | % See the file "license.terms" for information on usage and |
---|
| 12 | % redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 13 | % ====================================================================== |
---|
| 14 | |
---|
| 15 | disp('Enter the Fermi level (eV):'); |
---|
| 16 | Ef = input(' Ef = '); |
---|
| 17 | |
---|
| 18 | disp('Enter the temperature (K):'); |
---|
| 19 | T = input(' T = '); |
---|
| 20 | |
---|
| 21 | kT = 8.61734e-5 * T; |
---|
| 22 | Emin = Ef - 10*kT; |
---|
| 23 | Emax = Ef + 10*kT; |
---|
| 24 | |
---|
| 25 | E = linspace(Emin,Emax,200); |
---|
| 26 | f = 1.0 ./ (1.0 + exp((E - Ef)/kT)); |
---|
| 27 | |
---|
| 28 | fid = fopen('out.dat','w'); |
---|
| 29 | fprintf(fid,'FERMI-DIRAC FUNCTION F1/2\n\n'); |
---|
| 30 | fprintf(fid,'f1/2 Energy (eV)\n'); |
---|
| 31 | fprintf(fid,'------------ ------------\n'); |
---|
| 32 | for j=1:200 |
---|
| 33 | fprintf(fid,'%12g %12g\n', f(j), E(j)); |
---|
| 34 | end |
---|
| 35 | fclose(fid); |
---|
Note: See
TracBrowser
for help on using the repository browser.