Reputation: 35
a=2;
b=9;
syms x
I0=besseli(0,a*x/b);
F(x)=(x/b)*exp(-(x^2+a^2)/(2*b));
FUN=x*F(x);
mean=quad(FUN,0,100)
And i get this error:
Error using fcnchk (line 107)
If `FUN` is a MATLAB object, it must have an feval method.
Error in quad (line 57)
f = fcnchk(funfcn);
Upvotes: 2
Views: 2718
Reputation: 9652
The argument FUN
to quad
has to be a function, however you are providing a symbolic expression instead.
Try using FUN = matlabFunction(x*F(x))
to convert your expression to a function.
See also this post.
Upvotes: 1