Receiving error messages when trying to numerically integrate this function
Afficher commentaires plus anciens
Hi I am trying to integrate the following funtion numerically and I keep getting the following error messages.
Error using /
Matrix dimensions must agree.
Error in EAS426>@(x)1/(exp(c*h/(x*k*T))-1)*(2*pi*h*c^2/(x^5))
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 91)
[q,errbnd] = vadapt(@minusInfToBInvTransform,interval);
Error in integral (line 88)
Q = integralCalc(fun,a,b,opstruct);
Error in EAS426 (line 9)
a = integral(s, x1, x2);
h=6.626*10^-34
c=2.99792458*10^8
T=6000
k=1.381*10^-23
s =@(x) 1/(exp(c*h/(x*k*T))-1)*(2*pi*h*c^2/(x^5));
x1 = -Inf;
x2 = 0.4e-6;
a = integral(s, x1, x2);
Réponses (2)
madhan ravi
le 21 Fév 2019
0 votes
Use dot in front of arithmetic operators in the line s.
h=6.626*10^-34 ;
c=2.99792458*10^8 ;
T=6000 ;
k=1.381*10^-23 ;
s =@(x) 1./(exp(c*h./(x*k*T))-1).*(2*pi*h*c.^2./(x.^5));
x1 = -Inf;
x2 = 0.4e-6;
a = integral(s, x1, x2);
Read about matrix element by element operations: https://in.mathworks.com/help/fixedpoint/ref/times.html
Catégories
En savoir plus sur PDE Solvers dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!