Getting Naan error while integrating with multiple parameters

1 visualizzazione (ultimi 30 giorni)
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.

Risposte (1)

VBBV
VBBV il 16 Mar 2023
Modificato: VBBV il 16 Mar 2023
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 Commenti
Aakash Munnangi
Aakash Munnangi il 16 Mar 2023
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 il 16 Mar 2023
Modificato: VBBV il 16 Mar 2023
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 ?

Accedi per commentare.

Categorie

Scopri di più su Particle & Nuclear Physics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by