使用fcnchk时出错

时间:2013-10-31 17:08:49

标签: matlab

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)

我得到了这个错误:

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);

1 个答案:

答案 0 :(得分:1)

FUNquad的参数必须是一个函数,但是你提供了一个符号表达式。

尝试使用FUN = matlabFunction(x*F(x))将表达式转换为函数。

另见this post