fplot画图出现错误,如何解决?

本人初学matlab,下面请教一个小问题,请大神给以帮助:
syms x
f1=sin(x)/(x^2-x+0.5)+cos(x)/(x^2+2*x-0.5);
f2=log(sin(x)^2+2*sin(x)+8)
subplot(2,2,1),fplot(x,sin(x)/(x^2-x+0.5)+cos(x)/(x^2+2*x-0.5),[0,1],':r')
错误使用 fcnchk(line 106)
如果FUN为MATLAB对象,则它必须具有feval方法。
出错 fplot(line 62)
fun=fcnchk(fun)

Réponses (1)

fcrefw dew
fcrefw dew le 15 Nov 2021

0 votes

可能跟matlab版本有关系,论坛自带的matlab 2021b可以运行,如下所示
syms x
fplot(sin(x)/(x^2-x+0.5)+cos(x)/(x^2+2*x-0.5),[0,1],':r')
matlab 2014a需要inline函数才可以运行
syms x
fplot(inline(sin(x)/(x^2-x+0.5)+cos(x)/(x^2+2*x-0.5)),[0,1],':r')

Catégories

En savoir plus sur 图形对象 dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!