Why do I get an error when I try to use the solve function?

When I type the following command in matlab >> [x,y] = solve('x+2*y=4','2*x - y=3'),
I get the following error
Check for incorrect argument data type or missing argument in call to function 'solve'.
I was hoping someone could help me fix this. Thanks.

 채택된 답변

The quoted character array notationi may no longer be usable.
Try this isntead —
syms x y
[x,y] = solve(x+2*y == 4, 2*x - y == 3),
x = 
2
y = 
1
.

추가 답변 (1개)

solve() requires the inputs to be Symbolic Math objects
syms x y
[x,y] = solve(x + 2*y == 4, 2*x - y == 3) % note the use of == as required to define an equation
x = 
2
y = 
1

카테고리

도움말 센터File Exchange에서 Dynamic System Models에 대해 자세히 알아보기

태그

질문:

JV
2022년 3월 20일

답변:

2022년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by