How to find non-zero solutions to underdetermined systems of equations
조회 수: 9 (최근 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일
편집: Torsten
2024년 10월 25일
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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!