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
的積分?如何在Matlab中繪製符號函數
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
的積分?如何在Matlab中繪製符號函數
嘗試使用函數「subs」。這聽起來是這樣的:
for i = Xstart:Xend
y(i) = subs(f,x,i);
end
plot(Xstart:Xend,y)
我希望我能幫上忙。
要繪製,你可以做
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])
這是爲了讓你去。 我希望會有更好的答案。
有一套「ez」(「簡單」)陰謀功能來處理這個問題。 ezplot
,ezsurf
,ezmesh
,等等...
對信息的符號數學工具箱提供的繪圖功能的詳細信息,請參閱http://www.mathworks.com/help/symbolic/plot-functions-and-data.html。
非常感謝幫助我 – user2942448
@horchler是的。我改變了它。 – Simon