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

23 Ansichten (letzte 30 Tage)
water luo
water luo am 23 Jan. 2019
Beantwortet: fcrefw dew am 15 Nov. 2021
本人初学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)

Antworten (1)

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

Kategorien

Mehr zu 函数基础知识 finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!