Need some much needed help!

32 Ansichten (letzte 30 Tage)
JC
JC am 27 Apr. 2019
Beantwortet: Image Analyst am 27 Apr. 2019
-------------------------------------------------------------------------------------------------------------------------------------
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")

Akzeptierte Antwort

Image Analyst
Image Analyst am 27 Apr. 2019
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.

Weitere Antworten (0)

Kategorien

Mehr zu General Physics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by