can someone help me to analyze this program? How does the flowchart look like?

1 次查看(过去 30 天)
%radiasi benda hitam h=6.626e-34; c=3e8; k=1.38066e-23; lambda = 0:0.1:12; ind=1; for T=1250:150:2000 c1=8*pi*h*c; c2=h*c/k*T; I (ind, :) = (c1./lambda.^5).*(1./(exp(c2./lambda)-1)); ind=ind+1; end h=plot(lambda,I) hold on; grid on; xlabel('wavelength in micrometre') ylabel('power radiated at each wavelength') title ('radiasi benda hitam') [Imax,Iind]= max(I'); h1= plot (lambda(Iind),Imax,'d--')

回答(1 个)

Alan Stevens
Alan Stevens 2023-11-28
编辑:Alan Stevens 2023-11-28
Perhaps this will help:
%radiasi benda hitam
% constants
h=6.626e-34; c=3e8; k=1.38066e-23;
% range of values
lambda = 0:0.1:12;
% Initialise a counter
ind=1;
% loop through values of T from 1250 to 2000 in steps of size 150
for T=1250:150:2000
c1=8*pi*h*c; c2=h*c/k*T; % constants for use in next line
% Construct row number ind of a matrix that has the same number of
% columns as there are elements in lambda
I (ind, :) = (c1./lambda.^5).*(1./(exp(c2./lambda)-1));
ind=ind+1; % increment ind by 1
end
% plot results
plot(lambda,I)
hold on; grid on;
xlabel('wavelength in micrometre')
ylabel('power radiated at each wavelength')
title ('radiasi benda hitam')
[Imax,Iind]= max(I');
plot (lambda(Iind),Imax,'d--')

类别

Help CenterFile Exchange 中查找有关 Testing Frameworks 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by