I am having trouble doing integration for the following code.
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Md. Golam Zakaria
 el 1 de Feb. de 2022
  
    
    
    
    
    Respondida: Walter Roberson
      
      
 el 1 de Feb. de 2022
            I am having the following warning.
Warning: Infinite or Not-a-Number value encountered. 
> In integralCalc/iterateScalarValued (line 349)
  In integralCalc/vadapt (line 132)
  In integralCalc (line 83)
  In integral (line 88)
  In Q2 (line 17)
clc
clear all
Fs= 2.16*10^-5*pi;         % Geometrical Factor
h= 6.626*10^-34;           % Plancks Constant
c= 3*10^8;                 % Speed of light
K = 1.38*10^-23;           % Boltzmanns Constant
Ts=5760;                   % Temparature of the sun
E=0:0.5:4;
bs=((2*Fs)/((h^3)*(c^2))).*(E.^2./(exp(E./((K*Ts)-1))));
fun= @(E)(E.*((2*Fs)/((h^3)*(c^2))).*(E.^2./(exp(E./((K*Ts)-1)))));
Ps = integral (fun,0,Inf) ;
figure(2)
plot(E,Ps)
0 comentarios
Respuesta aceptada
  Star Strider
      
      
 el 1 de Feb. de 2022
        The warning is likely the result of the second term, that becomes Inf at higher values.  
Fs= 2.16*10^-5*pi;         % Geometrical Factor
h= 6.626*10^-34;           % Plancks Constant
c= 3*10^8;                 % Speed of light
K = 1.38*10^-23;           % Boltzmanns Constant
Ts=5760;                   % Temparature of the sun
fun= @(E)(E.*((2*Fs)/((h^3)*(c^2))).*(E.^2./(exp(E./((K*Ts)-1)))));
Result1 = fun(0)
Result2 = fun(realmax)
Check = @(E) E.^2/exp(E./((K*Ts)-1))
Check(realmax)
I am not certain that there is any solution for that, other than restricting the upper integration limit to something smaller.  
.
0 comentarios
Más respuestas (1)
  Walter Roberson
      
      
 el 1 de Feb. de 2022
        Q = @(v) sym(v);
Fs = Q(2.16)*Q(10^-5)*Q(pi)         % Geometrical Factor
h = Q(6.626)*Q(10^-34)           % Plancks Constant
c = Q(3)*Q(10^8)                 % Speed of light
K = Q(1.38)*Q(10^-23)           % Boltzmanns Constant
Ts = Q(5760)                   % Temparature of the sun
E = Q(0):Q(0.5):Q(4);
bs = ((2*Fs)/((h^3)*(c^2))).*(E.^2./(exp(E./((K*Ts)-1))));
fun = @(E)(E.*((2*Fs)/((h^3)*(c^2))).*(E.^2./(exp(E./((K*Ts)-1)))));
syms x b real
assume(b >= 0)
Ps = int(fun(x), x, 0, b)
limit(Ps, b, inf)
0 comentarios
Ver también
Categorías
				Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
