Clear Filters
Clear Filters

How to solve Simultaneous equations

50 views (last 30 days)
Mira
Mira on 25 Jun 2024 at 19:22
Answered: Walter Roberson on 25 Jun 2024 at 19:55
3x+2y=0
x+y=4

Answers (2)

Torsten
Torsten on 25 Jun 2024 at 19:45
Moved: Torsten on 25 Jun 2024 at 19:45
Write your equations as
A*z = b
for a 2x2-matrix A and a 2x1-vector b with z being the vector of unknowns [x;y].
To solve for z, you can then use "mldivide":

Walter Roberson
Walter Roberson on 25 Jun 2024 at 19:55
sympref('FloatingPointOutput',0);
syms x y
eqn1 = 4*x - 3*y == 0
eqn1 = 
eqn2 = 3*x + 2*y == 4
eqn2 = 
sol = solve([eqn1, eqn2])
sol = struct with fields:
x: 12/17 y: 16/17

Categories

Find more on Programming in Help Center and File Exchange

Tags

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!