Getting Naan error while integrating with multiple parameters

조회 수: 6 (최근 30일)
Aakash Munnangi
Aakash Munnangi 2023년 3월 16일
편집: VBBV 2023년 3월 16일
Hi, I am evaluating spectral radiance of a black body. It is giving me NaaN errors. The following is th
B =
h=6.63*(10^-34);
k=1.381*(10^-23);
c=3*(10^8);
T=6000;
fun = @(x) (2*h*(x.^3))./(c*c*((exp((h*x)./(k*T))-1)));
x=integral(fun,380*(10^-9),750*(10^-9));
Warning: Inf or NaN value encountered.

답변 (1개)

VBBV
VBBV 2023년 3월 16일
편집: VBBV 2023년 3월 16일
h=6.63*(10^-34);
k=1.381*(10^-23);
c=3*(10^8);
T=6000;
fun = @(x) (2*h*(c.^2)).*(x.^(-5)).*(exp((h.*c)./(k*x*T))-1).^(-1);
x=integral(fun,380*(10^-9),750*(10^-9))
  댓글 수: 2
Aakash Munnangi
Aakash Munnangi 2023년 3월 16일
I was able to correct it. here is the code. However, the energy version of Planks law definite integral giving valuee of 0. I think I am missing some precision. need help.
working version with wave lengths
h=6.63*(10^-34);
k=1.381*(10^-23);
c=3*(10^8);
T=6000;
lambda1 = 380*10^-9;
lambda2= 750*10^-9;
M_e = @(x) (2 * pi * h * c^2) ./ (x.^5 .* (exp((h * c)./(x * k * T)) - 1));
M_e_int1 = integral(M_e,lambda1,lambda2)
lambda1 = 0;
lambda2= Inf;
M_e = @(x) (2 * pi * h * c^2) ./ (x.^5 .* (exp((h * c)./(x * k * T)) - 1));
M_e_int2 = integral(M_e,lambda1,lambda2)
fraction_of_energy = M_e_int1/M_e_int2;
//Not working or giving value of 0 , for energy version of planc law integration.
h=6.63*(10^-34);
k=1.381*(10^-23);
c=3*(10^8);
T=6000;
Energy_lower_limit = 100;
Energy_upper_limit = 10000;
M_e = @(x) (x.^3.*2)./((h^3 * c^2)*((exp(x/(k * T)) - 1)));
M_e_int1 = integral(M_e, Energy_lower_limit, Energy_upper_limit)
VBBV
VBBV 2023년 3월 16일
편집: VBBV 2023년 3월 16일
The energy version of planks law you are using may be incorrect. Check the values of input limits for energy being considered. Are they in same units ? Can you open a new question ?

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

카테고리

Help CenterFile Exchange에서 Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by