The solve function in matlab isn't working.

I've inserted the following codes:
clear,clc
syms x y
A=solve('x+y=1','x-y=0');
just with the same shown order, however, when i run it gives me nothing except some errors.
How can I solve the problem?
PS: the errors:
Error using solve>getEqns (line 418)
List of equations must not be empty.
Error in solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
Error in code2 (line 3)
A=solve('x+y=1','x-y=0');

 採用された回答

Steven Lord
Steven Lord 2020 年 4 月 17 日

1 投票

Rather than specifying the inputs to solve as char vectors, you should specify them as symbolic equations.
syms x y
A = solve(x+y == 1, x-y == 0)

1 件のコメント

Mariam Atef
Mariam Atef 2020 年 4 月 17 日
thank you, it has worked

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

製品

リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by