a=2;
b=9; %the variance
syms x
i0=besseli(0,a*x/b);
fx=(x/b)*exp(-(x^2+a^2)/(2*b))*i0;
fun=matlabFunction(x*fx);
mean=quad(fun,0,282);
如何绘制fx
和fx
的积分?
答案 0 :(得分:2)
要绘图,你可以
xx = 0:.1:10;
fxx = matlabFunction(fx);
plot(xx, fxx(xx))
或
fxx = matlabFunction(fx);
fplot(fxx, [0 10])
对于积分,一个解决方案是:
fxx = matlabFunction(fx);
ifxx = @(x) integral(fxx,0,x);
fplot(ifxx, [0 10])
这是为了让你前进。 我希望有更好的答案。
答案 1 :(得分:0)
尝试使用功能" subs"。听起来像这样:
for i = Xstart:Xend
y(i) = subs(f,x,i);
end
plot(Xstart:Xend,y)
我希望我能帮忙。
答案 2 :(得分:0)
有一套“ez”(“简单”)绘图功能来处理这个问题。 ezplot
,ezsurf
,ezmesh
等等......
有关符号数学工具箱随附的绘图功能的更多信息,请参阅http://www.mathworks.com/help/symbolic/plot-functions-and-data.html。