Need some much needed help!

35 次查看(过去 30 天)
-------------------------------------------------------------------------------------------------------------------------------------
My code so far. I'm trying to make it look like the plot above. I very much appreciate the assistance. Let me know of any mistakes!
%% Problem 1) Blackbody Radiation
% constants
%
c = 2.99e8; % speed of light [m/s]
h = 6.63e-34; % Planck's constant [J s]
k = 1.38e-23; % Boltzmann's constant [J/K]
A = 2.898e-3; % Wein's Law constant [K m]
T = 300; % Earth's Temperature [K]
T1= 1000; % Temperature [K] at 1000K
T2= 6000; % Sun's temperature [K]
lam = logspace(-8,5,100); % wavelength [m]
%
% Plank's Law
%
% below are three Planck's function for T,T1,T2.
L=((2*h*c*c)./(lam.^(5))).*(exp(h*c./(lam.*k*T)-1)).^(-1); % Blackbody curve for the Earth
Y=((2*h*c*c)./(lam.^(5))).*(exp(h*c./(lam.*k*T1)-1)).^(-1); % Blackbody curve for T1
W=((2*h*c*c)./(lam.^(5))).*(exp(h*c./(lam.*k*T2)-1)).^(-1); % Blackbody curve for the Sun
figure
semilogy(L,'red')
hold on
loglog(Y,'blue')
hold on
loglog(W,'yellow')
xlabel("x") % I don't know how to change the increments of the x-axis to reflect the above plot.
ylabel("Spectral Radiance")
title("Blackbody Curves Plot")

采纳的回答

Image Analyst
Image Analyst 2019-4-27
Try this:
%% Problem 1) Blackbody Radiation
% constants
%
c = 2.99e8; % speed of light [m/s]
h = 6.63e-34; % Planck's constant [J s]
k = 1.38e-23; % Boltzmann's constant [J/K]
A = 2.898e-3; % Wein's Law constant [K m]
T = 300; % Earth's Temperature [K]
T1= 1000; % Temperature [K] at 1000K
T2= 6000; % Sun's temperature [K]
lam = logspace(-7, -1,100); % wavelength [m]
%
% Plank's Law
%
% below are three Planck's function for T,T1,T2.
L=((2*h*c*c)./(lam.^(5))).*(exp(h*c./(lam.*k*T)-1)).^(-1); % Blackbody curve for the Earth
Y=((2*h*c*c)./(lam.^(5))).*(exp(h*c./(lam.*k*T1)-1)).^(-1); % Blackbody curve for T1
W=((2*h*c*c)./(lam.^(5))).*(exp(h*c./(lam.*k*T2)-1)).^(-1); % Blackbody curve for the Sun
figure
semilogy(L,'red', 'LineWidth', 2)
hold on
loglog(Y,'blue', 'LineWidth', 2)
hold on
loglog(W,'yellow', 'LineWidth', 3)
xlabel("Log10(wavelength/m)", 'FontSize', 20) % I don't know how to change the increments of the x-axis to reflect the above plot.
ylabel("Spectral Radiance", 'FontSize', 20)
title("Blackbody Curves Plot", 'FontSize', 20)
grid on;
ylim([1e-10, 1e20]);
0001 Screenshot.png
You can use text() and annotation() if you want to add the color temperature labels/text and the arrows pointing to the curves.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Physics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by