Solve a matrix containing unknowns
조회 수: 19 (최근 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
댓글 수: 0
채택된 답변
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개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!