# convert units for spectral irradiance

How can I convert

$$W m^{-2} sr^{-1} nmm^{-1}$$

to

$$W m^{-2} nm^{-1}$$

I have the following matlab code to illustrate the spectral energy distribution of solar radiation:

h = 6.626e-34;      % Planck's Constant = 4.135 x 10^-15 eV s
c = 3e8;        % speed of light (MKS)
T= 6000;        % kelvin
k = 1.38066e-23;    % Boltzmann constant in J/K
lamda = 0:20e-9:3200e-9;
p = 2*3.14*h*c*c./(lamda.^5);
b6000 = p./(exp(h*c./(lamda*k*T)-1));

lamda = lamda.*1000000;
plot(lamda,b6000,'.');
xlabel('Wavelength [\mu{m}]')
xlim([0 3.2]);


This is my result:

How would I change my yaxis to be the same as the example shown?

but I need the yaxis to be in units of

$$W m^{-2} nm^{-1}$$

so that the curve looks like

From the plot, it seems that dividing the irradiance by 10.^14 would do the trick, is this correct? Could someone explain the unit conversion, for a non-physicist?

This function is taken from here

http://web.mit.edu/8.13/matlab/Examples/planck.m

Updated version:

From all of the advice given here, this is the updated and hopefully correct methods:

h = 6.626e-34; % Planck's Constant
c = 3e8; % speed of light
T = 6000; % absolute temperature
k = 1.38066e-23; % Boltzmann constant in J/K
lambda = 0:20e-9:3200e-9; % wavelength

p = 2*h*c*c./(lambda.^5);
b6000 = p./(exp(h*c./(lambda*k*T))-1);
b6000 = (1e-9).*b6000;

% multiply by the square of the ratio of the solar radius of earth's
b6000 = b6000.*(2.177e-5);

% apply Lambert's cosine law
b6000 = b6000.*pi;

% convert units for lambda
lambda = lambda.*1e6;

% print result
fh = figure(1);
plot(lambda,b6000)
xlabel('Wavelength [\mu{m}]');


-

The dimensional prefactor that ends up in your code is $$\frac{hc^2}{\lambda^5}=\frac{6.626\times10^{-34}\text{ J s}\times (3\times10^8\text{ m s}^{-1})^2}{(\tilde\lambda \text{ m})^5},$$ where $\tilde\lambda$ is dimensionless and goes from 0 to 3200×10-9. This will come out in terms of a number $p$, which is what your code calculates, with some units: $$\frac{hc^2}{\lambda^5} =p\frac{\text{J s}\times \text m^2\text{ s}^{-2}}{\text{m}^5} =p\frac{\text{W}}{\text{m}^3} =p\frac{\text{W}}{\text{m}^2}\frac{1}{\text m}\frac{10^{-9}\,\text m}{1\,\text{nm}} =10^{-9} p\:\text W\,\text m^{-2}\,\text{nm}^{-1}.$$

Note also that you need to distinguish carefully between radiance (which is the Planck's law quantity you're calculating), which is the power flow per unit of solid angle, and irradiance, which is integrated over solid angle, as detailed in Carl Witthoft's answer.

If you put this together, then, the spectral radiance is $$B_\lambda(T)=10^{-9}\frac{2\times6.626\times10^{-34}\times (3\times10^8)^2}{\tilde\lambda^5} \frac{ \text W\,\text m^{-2}\,\text{sr}^{-1}\,\text{nm}^{-1} }{\exp\left(\frac{6.626\times10^{-34}\times3\times10^8}{\tilde\lambda \times 6000\times 1.38066\times 10^{-23}}\right)-1}.$$ This peaks at ∼$12\:\text{kW}\,\text m^{-2}\,\text{sr}^{-1}\,\text{nm}^{-1}$, which is consistent with the graph in Wikipedia; it represents the energy flow from the Sun, per unit of solid angle, across a unit area which is right next to the Sun's surface. Note that this is not comparable to the graph you give, which plots the solar spectrum as measured on Earth. To get to the latter, you need to multiply by the square of the ratio of the solar radius to the Earth's orbital radius, $$\left(\frac{R_☉}{a_⊕}\right)^2 = \left(\frac{\phantom{000\,}696\,342\text{ km}}{152\,098\,232\text{ km}}\right)^2 \approx 2.177\times10^{-5}.$$ You then need to account for the fact that the Sun emits in all directions. As garyp points out, this is done by means of Lambert's cosine law, which essentially says that after integrating over solid angle you need to put an extra factor of $\pi$. Once you do that, you recover the graph you give:

Finally, note that $\text{nmm}$ is not an SI unit. The matlab function you are basing yourself on has a typo at a crucial place which, in my view, renders it essentially useless, or at least useless without a careful examination of what it's actually calculating. Be very careful whenever you see that sort of thing!

-

Radiance is in units of $W/sr/m^2$ ; spectral radiance is $Radiance/nm$. Irradiance is the integrated radiance over the solid angles involved.
Here are the radiance equations from the venerable RCA E-O Handbook:

coe.montana.edu

-
So to find energy per wavelength I need to use 4.2? –  KatyB Jun 3 at 12:13
Yes if your source is a black body. –  Carl Witthoft Jun 3 at 12:43

You have a factor of $\pi$ in your equation for what you call spectral irradiance. Probably better to call it spectral radiant exitance of the sun (assuming a Lambertian emitter): the power per area per wavelength interval emitted from the sun's surface. The spectral radiance is the same formula without the factor of $\pi$.

To relate this to the spectral irradiance at the earth: Irradiance is radiance per steradian. So you have to multiply the radiance by the solid angle subtended by the sun at the earth, $6.87\,\times\,10^{-5}$sr.

Next, you calculation is in terms of the wavelength interval in meters. You have to convert that to nm.

So: divide by $\pi$, multiply by the solid angle, account for unit conversion from m${}^{-1}$ to nm${}^{-1}$ and you get a factor of $2.18\,\times\,10^{-14}$ which is getting close, but not spot on. I'll have to give that some more thought. It might have to do with the fact that the sun is not a Lambertian emitter.

-