在matlab报错:Difference order N must be a positive integer scalar

来源:百度知道 编辑:UC知道 时间:2024/05/13 07:21:30
在matlab中计算微分,本来df=('sin(x)','x')的结果应该是cos(x),可是却报错:??? Error using ==> diff
Difference order N must be a positive integer scalar,这是为什么,是我的软件的原因么,我的版本是7.0.0

N必须是整数。你的自变量不要定义范围,syms t,定义符号自变量t,点乘换成乘,plot换成ezplot

也可能你在前面的程序定义了一个diff

>> diff('sin(x)', 'x')

ans =

cos(x)

上面是我在matlab 7.6.0里运算的结果。
看来是你的matlab有问题,重装matlab吧