Getting Naan error while integrating with multiple parameters

1 次查看(过去 30 天)
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 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by