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

No comments:

Post a Comment