source: trunk/examples/app-fermi/wrapper/cee/fermi.m @ 3177

Last change on this file since 3177 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File size: 1.1 KB
Line 
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
9%  Copyright (c) 2004-2012  HUBzero Foundation, LLC
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
15disp('Enter the Fermi level (eV):');
16Ef = input(' Ef = ');
17
18disp('Enter the temperature (K):');
19T = input(' T = ');
20
21kT = 8.61734e-5 * T;
22Emin = Ef - 10*kT;
23Emax = Ef + 10*kT;
24
25E = linspace(Emin,Emax,200);
26f = 1.0 ./ (1.0 + exp((E - Ef)/kT));
27
28fid = fopen('out.dat','w');
29fprintf(fid,'FERMI-DIRAC FUNCTION F1/2\n\n');
30fprintf(fid,'f1/2          Energy (eV)\n');
31fprintf(fid,'------------  ------------\n');
32for j=1:200
33  fprintf(fid,'%12g  %12g\n', f(j), E(j));
34end
35fclose(fid);
Note: See TracBrowser for help on using the repository browser.