How to find all the non unique solutions in rank deficient system of linear equations in matlab

조회 수: 14 (최근 30일)
Dears,
I have a sytem of linear equations and it is rank deficient and therfore the solutions are not unique,how to find all the solutions in matlab?
syms x1 x2 x3 x4 x5;
eqn1 = 2 * x1 -x2 + 2*x3-x4+3*x5 == 14;
eqn2 = x1 + 2*x2+3*x3+x4+0*x5 == 15;
eqn3 = x1 + 0*x2 * -2*x3 +0*x3+ -5 * x5 == -10;
[A, B] = equationsToMatrix ([eqn1, eqn2, eqn3], [x1, x2, x3,x4,x5])

답변 (1개)

David Goodmanson
David Goodmanson 2020년 5월 15일
편집: David Goodmanson 2020년 5월 15일
Hello Zeab,
One solution is
v0 = A\b.
Since A is rank defiicient it has a nonempty null space
nullA = null(A)
which is dimension 5x2. Two column vectors span the null space of A, and by definition A*nullA = 0 . The entire solution is v0 plus an arbitrary linear combination of the column vectors in nullA:
syms x1 x2 x3 x4 x5 c1 c2;
eqn1 = 2 * x1 -x2 + 2*x3-x4+3*x5 == 14;
eqn2 = x1 + 2*x2+3*x3+x4+0*x5 == 15;
eqn3 = x1 + 0*x2 * -2*x3 +0*x3+ -5 * x5 == -10;
[A, B] = equationsToMatrix ([eqn1, eqn2, eqn3], [x1, x2, x3,x4,x5])
nullA = null(A)
v0 = A\B
v0 =
-10
-52/7
93/7
0
0
vextra = v0 + nullA*[c1;c2] % c1,c2 are arbitrary
vextra =
5*c2 - 10
(29*c2)/7 - (5*c1)/7 - 52/7
c1/7 - (31*c2)/7 + 93/7
c1
c2
A*vextra -B % check
ans =
0
0
0

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by