您的位置:首页 > 编程语言 > MATLAB

MATLAB,关于solve函数的报错

2019-03-15 15:11 1656 查看

我在学习matlab符号运算这一章时尝试把书本的例子输入,发现是有误的,以下是从发现到修改的过程。
`

**在这里>> a = sym('a');
>> b = sym('b');
>> x = sym('x');
>> y = sym('y');
>> [x,y] = solve('a*x-b*y=1','a*x+b*y=3','x','y')**

Error using solve>getEqns (line 418)
List of equations must not be empty.

Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});

**>> [x,y] = solve('a*x-b*y=1''a*x+b*y=3','x','y')%第二次尝试修改*
*

Error using solve>getEqns (line 418)
List of equations must not be empty.
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});

**

>> [x,y] = solve(a*x-b*y=1,a*x+b*y=3,x,y) %第三次尝试修改
[x,y] = solve(a*x-b*y=1,a*x+b*y=3,x,y)

**

Error: Incorrect use of ‘=’ operator. To assign a value to a variable, use ‘=’. To compare values for equality, use ‘==’.

>> [x,y] = solve(a*x-b*y== 1,a*x+b*y==3,x,y)%最终成功

x =

2/a

y =

1/b

插入代码片`

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: