why lsqlin constraint, lsqnonneg do not answer correctly

조회 수: 2 (최근 30일)
Mohammadjavad Shokriafra
Mohammadjavad Shokriafra 2020년 6월 21일
답변: Matt J 2020년 6월 23일
I have a sparse matrix C(1500*1500) and d(1500*1) and constraint lb=zeros(1500,1), ub=ones(1500,1).
I can solve this system of linear equations by C\d very easily, but in some cases due to the negative results, I can not use that anymore. I found that I can use "lsqlin" or "lsqnonneg" to solve my problem, However, these functions do not have same (reasonable) results. I mean in cases that C\d gives reasonable results, the lsqlin and lsqnonneg have no resonable results.
For example I show some results for each function.
C\d: 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07 9.9e-07
lsqlin: 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07 5.0e-07
lsqnonneg: 7.9e-07 5.6e-07 7.8e-07 6.0e-07 0 8.0e-07 6.8e-07 2.8e-07 6.3e-07 3.7e-07 3.4e-07 9.6e-07 9.5e-07 8.7e-07 0 0 0
Does anyone know how can I use these functions and have reasonable results?
Thanks

답변 (1개)

Matt J
Matt J 2020년 6월 23일
To get reasonable results, the problem needs to have a reasonable solution.

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by