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

1 visualización (últimos 30 días)
%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 comentario
Dyuman Joshi
Dyuman Joshi el 28 de Nov. de 2023
Firstly, format your code properly.
Secondly, what needs to be analyzed?
Your 2nd question is not clear to me.

Iniciar sesión para comentar.

Respuestas (1)

Alan Stevens
Alan Stevens el 28 de Nov. de 2023
Editada: Alan Stevens el 28 de Nov. de 2023
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--')

Categorías

Más información sobre Testing Frameworks en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by