MATLAB,关于solve函数的报错

我在学习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

插入代码片`

你可能感兴趣的:(matlab符号运算)