Tuesday, February 17, 2015

Fermi Energy


Fermi
% =========================================================================
%To plot Fermi-Dirac distribution
% By Mahesha MG, MIT Manipal
% Date:16/02/2015
% =========================================================================
clc;
figure('color','white');
while(1)
    T=input('Enter temperature in kelvin: ');
    Ef=input('Enter Fermi level in ev: ');
    E=0:0.01:Ef+3;
    E=E';
    size=length(E);
    k=1.38e-23;
    e=1.6e-19;
    fE=zeros(size,1);
    for i=1:size
        fE(i)=1/(exp((E(i)-Ef)*e/(k*T))+1);
    end
        plot(E,fE,'-');
        xlabel('Energy in eV');
        title('By Mahesha MG E-mail: maheshamg@gmail.com');
        ylabel('f(E)');
        hold all;
        ch= input('Press 1 to continue and 0 to exit: ');
    if ch == 0
        break;
    end
end