You are on page 1of 2

//Bhupesh

//1930103
clc;
clf;
clear;
h=6.626e-34;c=3e8;k=1.38e-23;
T=300:100:1000;
Th=1000;
Tl=300;
lm=0.1:0.005:30;
L=lm.*10^-6;
for i=1:length(T)
for j=1:length(L)
pe(i,j)=(8*%pi*h*c/L(j)^5)*(1/(exp(h*c/(L(j)*k*T(i)))-1))
re(i,j)=(8*%pi*k*T(i)/L(j)^4)
we(i,j)=(8*%pi*h*c/L(j)^5)*(exp(-(h*c)/(L(j)*k*T(i))))
end
if T(i)==Th then
x=i;
end
[a,b]=max(pe(i,:));
Lmax(i)=lm(b);
U(i)=(0.005*10^-6)*sum(pe(i,:));
end

//(1)Planck radiation laws


subplot(221)
plot(lm,pe,'linewidth',4);
legend('T = '+string(T)+' K')
xlabel('$\lambda(\mu m)$','fontsize',5)
ylabel('$u(\lambda)$','fontsize',5)
title('Planck Radiation Law','fontsize',5)

//(2)comparison between planck law with rayleigh Jeans law and wein dist.
law at a given temperature (let's say T=1000k)
subplot(222)
plot((lm,pe(x,:),'bo'),(lm,re(x,:),'g'),(lm,we(x,:),'r'),'linewidth',4)
legend('Planck law','Rayleigh Jeans law','wein Distribution law')
xlabel('$\lambda(\mu m)$','fontsize',5)
ylabel('$u(\lambda)$','fontsize',5)
title('Temperature:'+string(T(x))+'K','fontsize',5)
//(3)wein's law
subplot(223)
TT=1./T
LL=Lmax
plot(TT,LL,'linewidth',4)
xlabel('$\frac{1}{T}(K^{-1})$','fontsize',5)
ylabel('$\lambda_{max}(\mu m)$','fontsize',5)
title('Wien law','fontsize',5)
[p,q]=reglin(TT,LL')
disp("the value of the wein constant is",p)

//(4)stefen's law
subplot(224)
T4=T.^4
UU=U.*(c/4)
plot(T4,UU,'linewidth',4)
xlabel('$\ T^2 (K^2)$','fontsize',5)
ylabel('$\lambda_{max}(\mu m)$','fontsize',5)
title('Stefan law','fontsize',5)
[sigma,z]=reglin(T4,UU')
disp("the value of the stefan constant is",sigma)

You might also like