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

26 次查看(过去 30 天)
water luo
water luo 2019-1-23
回答: fcrefw dew 2021-11-15
本人初学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)

回答(1 个)

fcrefw dew
fcrefw dew 2021-11-15
可能跟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')

类别

Help CenterFile Exchange 中查找有关 函数基础知识 的更多信息

Community Treasure Hunt

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

Start Hunting!