BB12 Blackbody plots for background in chapter 12.

by Chuck DiMarzio
   Northeastern University
   December 2008
!! This file may be copied, used, or modified for educational and
!! research purposes provided that this header information is not
!! removed or altered, and provided that the book is cited in
!! publications, as DiMarzio, Charles A., Optics for Engineers,
!! CRC Press, Boca Raton, FL, 2011.
!! http://www.crcpress.com
!! Other distribution is prohibited without permission.
constant; % get physical constants
ell=1;  % size of cavity in meters
lambda=10.^(-1:0.01:3)*1e-6;
nu=c./lambda;
%
% Mode density
nnu=8*pi*nu.^2*ell^3/c^3;

% Rayleigh-Jeans energy per frequency
T=5000;  % Temperature, Kelvin
qrj=k*T*nnu;

% Wein energy per frequency
qw=h*nu.*exp(-h*nu/k/T).*nnu;

% Planck energy per frequency
qp=h*nu./(exp(h*nu/k/T)-1).*nnu;

fig1=figure;loglog(lambda*1e6,qrj,'-.',...
            lambda*1e6,qw,'--',...
            lambda*1e6,qp,'-');
moose=axis;axis([moose(1:2),max(qp)*[1e-5,10]]);
xlabel('\lambda, Wavelength, \mu m');
ylabel('Q, Energy Density, J/Hz');
title(['Temperature = ',num2str(T),'K']);