MATLAB: Multiplying scalar by matrix

MATLABmatrixplotting

Hello,
I'm trying to plot the equations for I1 and I2 on the same graph, but nothing is showing up when I run the code. To avoid any matrix/scalar multiplication and division mistakes, I just added a period everywhere. The x-axis should be lambda, from 400 to 700 but the blank graph that shows up is from 0 to 1. I appreciate any help. I'm fairly new to Matlab, but I'm working on getting more practice. Below is my code. Please let me know if you need any more information.
lambda = 400:700;
h = 6.626e-34; %Planck's constant
c = 3e8; %speed of light
k = 1.380e-23; %Boltzmann's constant
T1 = 505.372; %preheat temperature in Kelvin
T2 = 449.817; %cooking temperature in Kelvin
I1 = (2*h*c^2 ./ lambda.^5) .* 1./(exp(h*c./lambda .* k .* T1) - 1); %spectral radiance at T1
I2 = (2*h*c^2 ./ lambda.^5) .* 1./(exp(h*c./lambda .* k .* T2) - 1); %spectral radiance at T2
plot(lambda,I1,lambda,I2)
Thank you,
Louisa

Best Answer

In the exponentials, you missed an important set of parentheses, ensuring that you divide by the whole expression
(lambda .* k .* T)
Instead, you are dividing by lambda, and then multiplying by k and T.
You need
I1 = (2*h*c^2 ./ lambda.^5) .* 1./(exp(h*c./(lambda .* k .* T1)) - 1); %spectral radiance at T1
I2 = (2*h*c^2 ./ lambda.^5) .* 1./(exp(h*c./(lambda .* k .* T2)) - 1); %spectral radiance at T2