MATLAB: Could anyone help me with this integral

integral

f1=@(x) (2*pi*(3*10^-8)^2*(6.625*10^-34)/(x^5.*(exp((3*10^-8*6.625*10^-34)/(x*1.38*10^-23*5800))-1)));
E1=integral(f1,0.1,0.4);
What's wrong with it?
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To perform
elementwise matrix powers, use '.^'.
Error in ENE527HW2>@(x)(2*pi*(3*10^-8)^2*(6.625*10^-34)/(x^5.*(exp((3*10^-8*6.625*10^-34)/(x*1.38*10^-23*5800))-1))) (line 13)
f1=@(x) (2*pi*(3*10^-8)^2*(6.625*10^-34)/(x^5.*(exp((3*10^-8*6.625*10^-34)/(x*1.38*10^-23*5800))-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 ENE527HW2 (line 15)
E1=integral(f1,0.1,0.4);

Best Answer

The error message actually told you exactly what to do:
To perform elementwise matrix powers, use '.^'.
You need to use element-wise operations:
f1=@(x) (2*pi*(3E-8)^2*(6.625E-34)./(x.^5.*(exp((3E-8*6.625E-34)./(x*1.38E-23*5800))-1)));
E1=integral(f1,0.1,0.4);
See: Array vs. Matrix Operations for details.
Unfortunately, while that solves the immediate problem, it now throws:
Warning: Infinite or Not-a-Number value encountered.
and ‘E1’ is Inf.
I tried it with the Symbollic Math Toolbox (that can handle extended-precision operations), however it cannot find an analytical expression for the integral, and so cannot integrate it:
syms x
f1(x) = (2*pi*(3E-8)^2*(6.625E-34)./(x.^5.*(exp((3E-8*6.625E-34)./(x*1.38E-23*5800))-1)));
f1 = vpa(simplify(f1, 'Steps', 250))
E1 = int(f1, x, 0.1, 0.4)