How to find non-zero solutions to underdetermined systems of equations
23 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Torsten
2024-10-25,11:31
编辑:Torsten
2024-10-25,11:48
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!