Solve a matrix containing unknowns

17 views (last 30 days)
I have a homework problem with a system of 9 equations with 9 unknowns. The unknowns are m_1 through m_7 and x_3 and x_5, so I set up a 9x7 matrix containing two unknowns, and a 9x1 solution vector. This should be solvable but I don't know how to do it in matlab.
To attempt the concept I set up my own small set of equations: a 3x2 with a 3x1 solution vector:
syms c
A = [2 c;0 2;1 1]
B = [8;-4;1]
X = linsolve(A,B)
The problem is easily solvable: x_1 = 3, x_2 = -2, and c = -1
I was hoping linsolve would get me the answer but instead it says the system is inconsistent and solves X as
X =
Inf
Inf
Anyone have any ideas of how I could solve this in matlab? Thanks

Accepted Answer

KSSV
KSSV on 16 Apr 2020
syms c x y
eqn{1} = 2*x+c*y == 8 ;
eqn{2} = 2*y == -4 ;
eqn{3} = x+y == 1 ;
s = solve(eqn{1},eqn{2},eqn{3},x,y,c)
s.c
s.x
s.y

More Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!