Need some much needed help!

조회 수: 35 (최근 30일)
JC
JC 2019년 4월 27일
답변: Image Analyst 2019년 4월 27일
-------------------------------------------------------------------------------------------------------------------------------------
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