How to get conditioned solutions of Ax=B with least square?

9 views (last 30 days)
Hello everybody,
I have an underdetermined matrix equation Ax=B, for which I want to apply least square method. The solution should be nonnegative.
I used “x=lsqnonneg(A,B)” for that. But it gives me a basic solution with many zero components in matrix x that is not suitable for my application. Therefore I tried “x=pinv(A)*B” and “x=A\B”. pinv gives me a solution with negative components and by backslash I get a warning that the matrix is singular and the components of x are NaN.
Is there any trick to get other nonnegative (and nonzero) solutions for an underdetermined equation?
Thank you in advance.
Monireh
  1 Comment
Matt J
Matt J on 12 Feb 2016
Edited: Matt J on 12 Feb 2016
Is there any trick to get other nonnegative (and nonzero) solutions for an underdetermined equation?
Note that, even though your A is under-determined, it is unclear, because of the non-negativity constraints, whether "other solutions" exist to the least squares problem.

Sign in to comment.

Answers (1)

Matt J
Matt J on 11 Feb 2016
Edited: Matt J on 11 Feb 2016
The trick is to add equations or constraints so that the problem is not under-determined anymore. Since you do have further demands on properties that the solution should have, there should be a way to express those requirements in equation form.
  6 Comments
Torsten
Torsten on 12 Feb 2016
Yes.
Solve
A*x_inh=B
(e.g. using x_inh = lsqnonneg(A,B)).
Then
x_inh + null(A)
gives all solutions for your problem.
Best wishes
Torsten.
Matt J
Matt J on 12 Feb 2016
Edited: Matt J on 12 Feb 2016
Torsten's proposal with null(A) doesn't take non-negativity constraints into account. Modifying his proposal so that it does leads to solutions x(z) parametrized in z according to,
x(z) = x_inh - null(A)*z >=0
Here z is any vector lying in the polyhedral region
null(A)*z <= x_inh %ensure positivity
For small A, you can find the vertices of this polyhedron using LCON2VERT ( Download ) assuming that it is bounded. If the polyhedron is not bounded, you may need to apply upper bounds on x(z) as well. Note also that the polyhedron might contain only the single point z=0 (see also my comment to your original post) meaning that x_inh is already the unique solution to the least squares problem.
If the solution is non-unique, the best thing to do is to pose an optimization problem in z,
max. g(z) = F( x_inh - null(A)*z )
subject to
null(A)*z <= x_inh
where F(x) is some measure of merit of the different possible choices of x. You could solve this with fmincon or maybe a simpler solver, depending on what F looks like.

Sign in to comment.

Categories

Find more on Systems of Nonlinear Equations 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!