필터 지우기
필터 지우기

Integrate planck function between two intervals

조회 수: 9 (최근 30일)
Sarvjeet Singh
Sarvjeet Singh 2020년 9월 26일
댓글: Ameer Hamza 2020년 9월 27일
function Planck_law
c1=27.742*10.^8;
c2=1.43878*10.^4
sigma=5.67*10.^-8
T=5780
lamda_1= 8
lamda_2= 13
fun= @(lambda,sigma,c1,c2,T) c1./lamda.^5.*(exp(c2./(lamda * T))-1);
F = integral(fun,lamda_1,lamda_2,0.001)./(sigma.*T^4)
This code shows error "Expected a string scalar or character vector for the parameter name, instead the input type was 'double'.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 9월 26일
편집: Ameer Hamza 2020년 9월 26일
Check this code and compare it with your code to see the mistakes.
c1 = 27.742*10.^8;
c2 = 1.43878*10.^4;
sigma = 5.67*10.^-8;
T = 5780;
lamda_1 = 8;
lamda_2 = 13;
fun = @(lambda) c1./lambda.^5.*(exp(c2./(lambda * T))-1);
F = integral(fun,lamda_1,lamda_2)./(sigma.*T^4)
  댓글 수: 4
Sarvjeet Singh
Sarvjeet Singh 2020년 9월 27일
Why F vs T graph are not ploted , is shows blank figure and how i can get all the values of F and T in the workspace as it shows only last value.
c1 = 27.742*10.^8;
c2 = 1.43878*10.^4;
sigma = 5.67*10.^-8;
T = 5780;
lamda_1 = 8;
lamda_2 = 13;
for T=-10:5:30
fun = @(lambda) c1./lambda.^5.*(exp(c2./(lambda * T+273))-1);
F = integral(fun,lamda_1,lamda_2)./(sigma.*(T+273)^4)
plot(T,F)
hold on
grid
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
Ameer Hamza
Ameer Hamza 2020년 9월 27일
You are not specifying the marker type in plot() and also you are not saving vaues of F at each iteration
c1 = 27.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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by