Azzera filtri
Azzera filtri

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 ?

2 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Alan Stevens
Alan Stevens il 29 Set 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 Commenti
Alan Stevens
Alan Stevens il 30 Set 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')

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by