Effacer les filtres
Effacer les filtres

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

9 vues (au cours des 30 derniers jours)
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])

Réponses (1)

David Goodmanson
David Goodmanson le 15 Mai 2020
Modifié(e) : David Goodmanson le 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

Catégories

En savoir plus sur Linear Algebra dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by