Set "not equal to" constraint for a linear system of equations solver:

조회 수: 2 (최근 30일)
Hi, I'm looking to set a constraint for the solution to my linear system of equations
Cx=D
such that
x~=0
or
|x|>eps
I'm currently looking at lsqlin() but it seems that I am not able to do this. Would you please let me know how can I do this with lsqlin() or another function, if it is possible?
Thank you.
  댓글 수: 3
Ash Ash
Ash Ash 2018년 7월 12일
I'm looking to have all my components to be different from 0
Walter Roberson
Walter Roberson 2018년 7월 17일
What is your situation such that it would not be permitted for any component to be 0, but it would be acceptable for the component to be 4.94065645841247e-324 ?

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2018년 7월 10일
There is no direct way to do that.
You need to run your solver multiple 2^N times where N is the length of your x vector. Each position in the vector needs to be considered with a lower bound of -inf and an upper bound of -eps(realmin), and then again with a lower bound of +eps(realmin) and an upper bound of +inf . Then out of all of those 2^N solutions, you have to somehow figure out which one is "best".

추가 답변 (1개)

Matt J
Matt J 2018년 7월 14일
편집: Matt J 2018년 7월 14일
You may as well just find the solution x without this constraint and then add random noise.
x=x + eps.*(x==0).*rand(size(x));
You are not going to get a better solution by attempting rigorous numerical optimization, subject to |x(i)|>=eps.
Remember that these solvers are iterative approximators - you would have to iterate for ages to get within eps of the actual solution you are looking for, even assuming that floating point arithmetic errors would allow such precise convergence at all. And since you can't get within eps of the ideal solution, you may as well accept any solution that is eps or more away from the ideal solution, e.g., the solution without the |x(i)|>=eps constraint or some random perturbation of it.

카테고리

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