我已查询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搜索结果中,只有在=
与==
混淆时才会出现错误。
答案 0 :(得分:5)
rec
不是本机符号工具箱功能。它属于MuPAD,它是Mathworks acquired and added to Symbolic Toolbox的独立包。要使用它,您需要先在命令窗口中输入mupad
命令,然后在弹出的MuPAD窗口中输入使用rec
的命令。