MATLAB递归方程中的语法错误

时间:2013-08-30 12:05:51

标签: matlab mupad

我已查询here如何声明递归方程式。

我在该页面尝试了以下示例:

>> solve(rec(y(n + 1) = 3*(n + 1)*y(n), y(n), {y(0) = 1}))
                      |
Error: The expression to the left of the equals sign is not a valid target for an assignment.

然后我注意到我没有安装Symbolic Math Toolbox。安装后

>> ver

返回(在其他一些人中):

MATLAB                                                Version 8.1        (R2013a)
Symbolic Math Toolbox                                 Version 5.10       (R2013a)

但我仍然遇到上述错误。

我可以将命令缩小到以下内容,给出相同的上述错误:

>> rec(y(n + 1) = y(n), y(n), {y(0) = 1})
                |
Error: The expression to the left of the equals sign is not a valid target for an assignment.

在wiki和其他Google搜索结果中,只有在===混淆时才会出现错误。

1 个答案:

答案 0 :(得分:5)

rec不是本机符号工具箱功能。它属于MuPAD,它是Mathworks acquired and added to Symbolic Toolbox的独立包。要使用它,您需要先在命令窗口中输入mupad命令,然后在弹出的MuPAD窗口中输入使用rec的命令。