How can I integrate this function?

1 次查看(过去 30 天)
c= 299792458; %speed of light
%h(J.s)=6.62607004*10^(-34); %Planck's constant
h_ev = 4.14*10^(-15); %eV.s %Planck's constant
l = linspace(1*10^-5,3*10^-7,5000);
E = ((h_ev*c)./l);
%k= 1.38064852 * 10^(-23); %J/K %boltzmann constant
k_ev= 8.62*10^-5; %eV/K
E_g= 0;
u=0;
q = 1.602176462*10^-19;
%planck = @(T)(heaviside(E-E_g).*(2*pi/(c^2*h_ev^3).*((E.^2)./(exp(E-u))./(k_ev*T))-1));
planck2 = @(T)(2*pi/(c^2*h_ev^3)).*((E.^2)./(exp((E-u)./(k_ev.*T))-1));
planckint = integral(planck2,0,5780)
The function evaluates correctly but I cant integrate it
Matrix dimensions must agree.
Error in Untitled2>@(T)(2*pi/(c^2*h_ev^3)).*((E.^2)./(exp((E-u)./(k_ev.*T))-1))
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 132)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 75)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in Untitled2 (line 13)
planckint = integral(planck2,0,5780)

回答(1 个)

Walter Roberson
Walter Roberson 2019-4-18
planckint = integral(plankck2, 0, 5780, 'ArrayValued', true);

类别

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