How to find non-zero solutions to underdetermined systems of equations
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am solving an underdetermined system of equations and Matlab gives me a zero vector. Zero vector is indeed a solution to the underdetermined system of equations, but it is not helpful. I would like to get a non-zero solution. It would be best if I could specify the positive or negative values of the components of the solution vector. For example, x1>0
A=[0.719600000000000,0.069400000000000,0.526400000000000,0.110700000000000;1.833200000000000,0.377900000000000,1.469000000000000,0.454700000000000];
b=[0;0];
x = A\b
0 Kommentare
Akzeptierte Antwort
Torsten
am 25 Okt. 2024
Bearbeitet: Torsten
am 25 Okt. 2024
The null() function gives you a basis for ker(A):
A=[0.719600000000000,0.069400000000000,0.526400000000000,0.110700000000000;1.833200000000000,0.377900000000000,1.469000000000000,0.454700000000000];
N = null(A)
A*N
So every linear combination of these two vectors will give a vector n with A*n = 0.
"lsqlin" could be used instead if you want to set lower and upper bounds in the coordinates of n. But note that it might happen that no solution exists.
The following code solves for a vector with positive first component n1:
C=[0.719600000000000,0.069400000000000,0.526400000000000,0.110700000000000;1.833200000000000,0.377900000000000,1.469000000000000,0.454700000000000];
d=[0;0];
Aeq = [1 0 0 0];
beq = 1;
n = lsqlin(C,d,[],[],Aeq,beq)
C*n
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!