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

16 Ansichten (letzte 30 Tage)
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])

Antworten (1)

David Goodmanson
David Goodmanson am 15 Mai 2020
Bearbeitet: David Goodmanson am 15 Mai 2020
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

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by