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

Thursday, February 12, 2015

Blackbody Radiation


blackbody
% =========================================================================
%To plot intensity graph for blackbody
% By Mahesha MG, MIT Manipal
% Date:13/02/2015
% =========================================================================
clc;
figure('color','white');
while(1)
    T=input('Enter blackbody temperature in kelvin: ');
    lm=2.898e-3/T;
    l=1e-9:1e-9:5000e-9;
    l=l';
    h=6.626e-34;
    c=3e8;
    k=1.38e-23;
    I=zeros(5000,1);
    for i=1:5000
        I(i)=2*pi*h*c^2/(l(i)^5*(exp((h*c)/(l(i)*k*T))-1));
    end
        display(lm);
        plot(l,I,'-');
        xlabel('Wavelength');
        title('By Mahesha MG E-mail: maheshamg@gmail.com');
        ylabel('Intensity');
        hold all;
        ch= input('Press 1 to continue and 0 to exit: ');
    if ch == 0
        break;
    end
end