I'm trying to create a surface plot of the Plack radiation law over a range of temperatures and wavelengths, but when so far I've been unsuccessful. I've tried to use meshgrid to set my range of values as
EDU>> [l,T] = meshgrid(0:25:1000,0:300:12000);
where l is wavelength in nm and T is temperature in Kelvins. However, this means that when I plug it into my energy distribution function, I get a matrix filled with the same row.
distr = Planck(l,T);
where Planck is the function defined by
function [ distr ] = Planck( lam,temp )
%Applies the Planck radiation law to give the energy emitted by a black
%body for some given wavelength and temperature. Units are dimensionless,
%and given by u(lamda,T)/(8*pi*c*h/((550nm)^5).
%lam = the actual wavelength
%temp = the actual temperature
%For our reference wavelength, we will use 550 nm, meaning that our
%reference temperature will be 26180 in accordance with the relationship
%T-knot = (h*c)/(lambda-knot*k)
L = lam/(550);
T = temp/(26180);
e = exp(1);
distr = (1./(L.^5))./(e.^(1./(L*T))-1);
Having used this to create a number of 2-D plots, the 3-D version should have lower z values for lower temperatures, but because all of the rows of distr are the same, the function is being displayed as constant with respect to T. So if I have a range of x values and a range of y values, and z is a function of x and y, how do I create a matrix filled with z-values for each combination of x and y in that range?
No products are associated with this question.
Play games and win prizes!Learn more