begin # Begin blocking entire file for automatic inclusion # Jim Worthey, 2006 June 19 function blackbody(Tkelvin, descrip, LamLoHi, vec) begin # ****** Arguments: ****** # Tkelvin = Kelvin temperature of the blackbody # descrip = a descriptive character row vector, set below # LamLoHi = the domain of wavelength, e.g. [360, 830] # vec = the vector into which the blackbody spectrum will be put # ****** # Formula is available from Wyszecki & Stiles book, for example. # Constants are from the NIST web site: # http://physics.nist.gov/cuu/Constants/index.html descrip = [ntoa(Tkelvin), "K blackbody"] NumData = LamLoHi(2) - LamLoHi(1) + 1 c1 = 3.74177107d-16 # watts/m^2 c2 = 1.4387752d7 # (m K) * (10^9 nm/m), SI value has 10^-2 vec = zeros(NumData) # serves to make vec the right size. Index = 0 for lambda = LamLoHi(1) to LamLoHi(2) begin Index = Index+1 LamWork = lambda*1.0d-9 vec(Index) = c1*(LamWork^-5)/(exp(c2/(Tkelvin*lambda))-1) end # End for lambda = etc. # Normalization = max( vec ) Normalization = vec( 555 - LamLoHi(1) + 1 ) vec = vec/Normalization end # End function blackbody() end # End blocking entire file for automatic inclusion