whenever i use individual value of time (Tv) the output function (F) giving right value but using time in the form of loop ,output function gives wrong result for all.How to fix this ?

1 visualización (últimos 30 días)
clc
clear all
c1 = 3.742*10.^8;
c2 = 1.43878*10.^4;
sigma = 5.67*10.^-8;
lamda_1 = 8;
lamda_2 = 13;
Tv = -10:5:30;
F = zeros(size(Tv));
count = 1;
for T=Tv
fun = @(lambda) c1./(lambda.^5.*(exp(c2./(lambda * T+273)))-1);
F(count) = integral(fun,lamda_1,lamda_2)./(sigma.*(T+273)^4)
plot(T, F(count), '+', 'MarkerSize', 10, 'LineWidth', 2)
hold on
grid
count = count + 1;
end
xlabel('Temperature')
ylabel('Fraction in atmospheric window)')
title('Fraction of the radiation emitted in the atmospheric window as a function of temperature')
legend('T=-10','T=-5','T=0','T=5','T=10','T=15','T=20','T=25','T=30')
hold off

Respuesta aceptada

Alan Stevens
Alan Stevens el 29 de Sept. de 2020
You missed a set of brackets connecting TV to 273.
c1 = 3.742*10.^8;
c2 = 1.43878*10.^4;
sigma = 5.67*10.^-8;
lamda_1 = 8;
lamda_2 = 13;
Tv = -10:5:30;
F = zeros(size(Tv));
count = 1;
for T=Tv
fun = @(lambda) c1./(lambda.^5.*(exp(c2./(lambda *(T+273))))-1); %%%%%%%
F(count) = integral(fun,lamda_1,lamda_2)./(sigma.*(T+273)^4);
plot(T, F(count), '+', 'MarkerSize', 10, 'LineWidth', 2)
hold on
count = count + 1;
end
grid
xlabel('Temperature')
ylabel('Fraction in atmospheric window)')
title('Fraction of the radiation emitted in the atmospheric window as a function of temperature')
legend('T=-10','T=-5','T=0','T=5','T=10','T=15','T=20','T=25','T=30')
hold off
  6 comentarios
Alan Stevens
Alan Stevens el 30 de Sept. de 2020
Or, if you don't want the crosses at all:
c1 = 3.742*10.^8;
c2 = 1.43878*10.^4;
sigma = 5.67*10.^-8;
lamda_1 = 8;
lamda_2 = 13;
Tv = -10:30;
F = zeros(size(Tv));
count = 1;
for T=Tv
fun = @(lambda) c1./(lambda.^5.*(exp(c2./(lambda *(T+273))))-1);
F(count) = integral(fun,lamda_1,lamda_2)./(sigma.*(T+273)^4);
count = count + 1;
end
plot(Tv,F)
grid
xlabel('Temperature')
ylabel('Fraction in atmospheric window)')
title('Fraction of the radiation emitted in the atmospheric window as a function of temperature')

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by