is it possible that LSQNONNEG gives multiple answers?
Show older comments
I'm trying to calculate a position by approximating it with lsqnonneg. i'm wondering if it is possible that the solver gives all the different answers(and not just the best). Or maybe if there is another solve that does this.
Answers (3)
Torsten
on 20 Mar 2015
0 votes
At least you should get that |C*x-d|_2 is equal for all the solutions you get from lsqnonneg.
If this is not the case, something is wrong with your problem formulation.
Best wishes
Torsten.
jeroen van den Brink
on 20 Mar 2015
0 votes
John D'Errico
on 20 Mar 2015
Edited: John D'Errico
on 20 Mar 2015
0 votes
There are INFINITELY many answers to a singular problem. Which of those infinitely many answers do you want? When should it stop printing all the results? Is your machine large enough to store infinitely many solutions?
Infinity is a BIG place. Do you really want to go there?
You say that in your case, C is 4x400, and d is 4x1 for lsqnonneg. So there is a 396 dimensional subspace of answers. You would not be able to sort through the number of possible solutions. Not just 396 solutions, but a set of them that stretches out to infinity in each of 396 possible dimensions. Now, given the non-negativity constraints, that set will be limited. But even so, we are talking a big set, and still infinite.
Apparently you don't like the solution. What you need to do is to formulate what is the problem, in the form of additional constraints beyond simple non-negativity. Assuming they are linear, then you can use lsqlin to solve the problem. (In the optimization toolbox.) If they are not linear, then you would need to use fmincon. (Also optimization toolbox.)
1 Comment
jeroen van den Brink
on 20 Mar 2015
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!