Solve a matrix containing unknowns

18 次查看(过去 30 天)
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

采纳的回答

KSSV
KSSV 2020-4-16
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Mathematics 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by