Home

Introduction

Contents

Scripts

FeedBack

Date 08/09/2010
Script S6_2_1A.m
Download Script S6_2_1A.m
%=============================================
%planck 1A
%Attention! The functions
%fplanck and fplancka must be used
%=============================================
%
%Boltzmann and Planck constants in MKS system
k=1.381e-023;
h=6.626e-034;
%temperatures considered in °K
T1=300;
T2=1000;
T3=2400;
T4=4500;
T5=6000;
%
%frequencies interval (numin, numax) divided into N parts
N=100000;
numin=1.0e001;
numax=1.0e016;
%
%Distribution of the spectral intensities
%
%function arguments are the previous defined values
%funtion fplanck gives back an array 2xN:
%the first row contains the frequencies
%the second one the spectral intensities
%
f1=fplanck(T1,N,numin,numax);
f2=fplanck(T2,N,numin,numax);
f3=fplanck(T3,N,numin,numax);
f4=fplanck(T4,N,numin,numax);
f5=fplanck(T5,N,numin,numax);
%
%corresponding plots
plot(f1(1,:),f1(2,:),'ro-'),title('Spectral intensities versus frequencies for T=300 °K')
axis([0 0.90e+014 0 1.7e-011]),figure
plot(f2(1,:),f2(2,:),'bd-'),title('Spectral intensities versus frequencies for T=1000°K')
axis([0 3.0e+014 0 6.0e-010]),figure
plot(f3(1,:),f3(2,:),'g*-'),title('Spectral intensities versus frequencies for T=2400°K')
axis([0 6.50e+014 0 8.5e-009]),figure
plot(f4(1,:),f4(2,:),'ro-'),title('Spectral intensities versus frequencies for T=4500°K')
axis([0 1.2e+015 0 5.5e-008]),figure
plot(f5(1,:),f5(2,:),'bd-'),title('Spectral intensities versus frequencies for T=6000°K')
axis([0 1.60e+015 0 1.3e-007])
%
%============================================================
%Calculus for each temperature
% 1.of the maxima of the spectral frequencies contained in each
% of second rows of f1, f2, f3, f4 and f5
% 2.of corresponding frequencies contained in the same positions
% in each of the first rows of f1, f2, f3, f4 and f5
%Using the function fplancka, for each temperature, a frequency is searched
%to the right of position of the maximum of spectral intensity (fmax)
%for which the corresponding the spectral intensity is less than fmax/1000
%The corresponding values of the ratio (h*nu.max)/(k*T) (Wien's law) are
%determined
%
%for T=300°K
[f1max,col1]=max(f1(2,:));
nu1max=f1(1,col1)
nu1min=fplancka(N,col1,f1max,f1)
Wien1=(h*nu1max)/(k*T1)
%
%for T=1000°K
[f2max,col2]=max(f2(2,:));
nu2max=f2(1,col2)
nu2min=fplancka(N,col2,f2max,f2)
Wien2=(h*nu2max)/(k*T2)
%
%for T=2400°K
[f3max,col3]=max(f3(2,:));
nu3max=f3(1,col3)
nu3min=fplancka(N,col3,f3max,f3)
Wien3=(h*nu3max)/(k*T3)
%
%for T=4500°K
[f4max,col4]=max(f4(2,:));
nu4max=f4(1,col4)
nu4min=fplancka(N,col4,f4max,f4)
Wien4=(h*nu4max)/(k*T4)
%
%for T=6000°K
[f5max,col5]=max(f5(2,:));
nu5max=f5(1,col5)
nu5min=fplancka(N,col5,f5max,f5)
Wien5=(h*nu5max)/(k*T5)
%
%the mean value for Wien's law
aWien=[Wien1 Wien2 Wien3 Wien4 Wien5]
Wien=mean(aWien)
%=============================================
%
Top
Script S6_2_1B.m
Download Script S6_2_1B.m
%=============================================
%planck 1B
%Attention! The function fplanck must be used
%=============================================
%
%temperatures in °K
T1=300;
T2=1000;
T3=2400;
T4=4500;
T5=6000;
%
%interval of the frequencies, between numin and numax, divided in N parts
N=10000;
numin=1.0e001;
numax=1.0e016;
%
%spectral intensities
%
f1=fplanck(T1,N,numin,numax);
f2=fplanck(T2,N,numin,numax);
f3=fplanck(T3,N,numin,numax);
f4=fplanck(T4,N,numin,numax);
f5=fplanck(T5,N,numin,numax);
%
%corresponding intensities over all frequencies
%
I1=trapz(f1(1,:),f1(2,:));
I2=trapz(f2(1,:),f2(2,:));
I3=trapz(f3(1,:),f3(2,:));
I4=trapz(f4(1,:),f4(2,:));
I5=trapz(f5(1,:),f5(2,:));
%
%spectral intensities in the visible range
%
%limit frequencies in the visible range
nuluxmin=4.3e+014;
nuluxmax=7.4e+014;
%
f11=fplanck(T1,N,nuluxmin,nuluxmax);
f22=fplanck(T2,N,nuluxmin,nuluxmax);
f33=fplanck(T3,N,nuluxmin,nuluxmax);
f44=fplanck(T4,N,nuluxmin,nuluxmax);
f55=fplanck(T5,N,nuluxmin,nuluxmax);
%
%corresponding intensities over all frequencies in the visible range
I11=trapz(f11(1,:),f11(2,:));
I22=trapz(f22(1,:),f22(2,:));
I33=trapz(f33(1,:),f33(2,:));
I44=trapz(f44(1,:),f44(2,:));
I55=trapz(f55(1,:),f55(2,:));
%
%corresponding percent values
I1perc=(I11*100)/I1
I2perc=(I22*100)/I2
I3perc=(I33*100)/I3
I4perc=(I44*100)/I4
I5perc=(I55*100)/I5
%
T=[T1 T2 T3 T4 T5];
%their plot
Iperc=[I1perc I2perc I3perc I4perc I5perc];
plot(T,Iperc,'ro-')
title('Percent intensity in the visible range for T=300, 1000, 2400, 4500 and 6000°K')
%=============================================
%
Top
Function fplanck.m
Download Funzione fplanck.m
%==============================================
%function fplanck
%This function is necessary to run scripts
%planck 1A, planck 1B and planck 3A
%==============================================
%
%
%function fplanck(T,N,inf,sup)
%spectral intensities for the assigned T are evaluated
%inf e sup defines interval of the N frequancies
%fplanck returns a 2xN array contains
%frequencies in the first row
%spectral intensities in the second row
%
function fplanck=f(T,N,inf,sup)
%universal constants of Boltzmann,light speed in vacuum and Planck
k=1.381e-023;
c=2.998e008;
h=6.626e-034;
%a constant
a=(h/k)/T;
%another constant
b=(2*pi*h)/c^2;
%interval of frequencies
nu=linspace(inf,sup,N);
%
nu3=nu.^3;
%spectral intensities
esp=a.*nu;
den=exp(esp)-1;
I=b*(nu3./den);
%fplanck returns frequencies and the corresponding spectral intensities
fplanck=[nu;I];
%==============================================
%
Top
Function fplancka.m
Download Funzione fplancka.m
%==================================================
%function fplancka
%This function is necessary to run script Planck 1A
%==================================================
%
%
%arguments of function fplancka(N,ind,fmax,f)
%N is the number of columns of the array f (2xN)
%resulting from the function planck
%the first row contains the frequencies
%the second one the spectral intensities
%ind is the position in the first row of f of the frequency
%corresponding to the maximum of spectral intensity fmax
%contained in the same position of the second row of f
%
%fplancka gives back the value of the frequency "numin"
%corresponding to a spectral frequency less than fmax/1000
%and the position j of the column where "numin" in contained
%
function fplancka=g(N,ind,fmax,f)
%in fa the first row of f
fa=f(1,:);
%in fb the second row of f
fb=f(2,:);
%position j is searched
j=0;
for i=ind:1:N
par=fmax/1000;
if fb(i)>par
j=j+1;
end
end
%numin and j are the elements returned by fplancka
numin=fa(j);
fplancka=[numin j];
%==================================================
%
Top