MATLAB示例失败 [英] MATLAB examples are failing
问题描述
我丝毫不知道这里发生了什么,Google也没有提供任何有趣的帮助.我从 http://www.mathworks.com/help中获取了以下示例/toolbox/symbolic/solve.html#inputarg_eqn
I don't have the slightest idea what's going on here, and Google provides no interesting help. I took the following example from http://www.mathworks.com/help/toolbox/symbolic/solve.html#inputarg_eqn
>> syms x
>> solve(x^2 + 4*x + 1 == 0)
??? Error using ==> char
Conversion to char from logical is not possible.
Error in ==> solve>getEqns at 169
vc = char(v);
Error in ==> solve at 67
[eqns,vars] = getEqns(varargin{:});
这是怎么回事?
推荐答案
您正在阅读的文档不适用于您的MatLab版本.例如,我可以在2008b中重现您的错误.
The documentation you're reading doesn't apply to your version of MatLab. I can reproduce your error in 2008b, for example.
较早的文档说:
请注意,这些示例均采用
f(x) = 0
形式的方程式.如果需要求解形式为f(x) = q(x)
的方程式,则必须使用带引号的字符串.特别是命令
Note that these examples assume equations of the form
f(x) = 0
. If you need to solve equations of the formf(x) = q(x)
, you must use quoted strings. In particular, the command
s = solve('cos(2*x)+sin(x)=1')
将来,请注意每个MatLab在线文档页面顶部的行,其中指出了文档适用的版本.
In the future, pay attention to the line at the top of every MatLab online documentation page where it says what version the documentation applies to.
这篇关于MATLAB示例失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!