Thread Subject: Linear equations, Ax=b

Subject: Linear equations, Ax=b

From: Andy

Date: 8 Feb, 2010 04:47:03

Message: 1 of 6

Hi everyone,

I'm about to close a particular chapter of the work I've been doing using Matlab to solve an A*x=b system of equations. Before doing so I wanted to get some other peoples opinions regarding a way to solve for x before I just leave my results where they are.
I only have one constraint and that is that x must be positive. This obviously rules out x=A\b (which gives negative and positive values) and the great LSQR function which also gives me negative values. With help from forum users I attempted to use quadprog (using Euclidean norm) but to no avail. My staple function has been LSQLIN and I set my lower bound to zero. The best fit I get is between 7-15% NRMSE (where as LSQR would give ~1% if allowed). Whilst the result won't be exact for this overdetermined system, why can't I get a closer result?

My A matrix is 500 x 216 and b is 500 x 1. I have tried reading the available resources, including text books and have done my best to understand how to implement more complex constraints but they always seem to worsen the solution.

I feel I must be doing something incorrectly as most people here are trying what seem to be much more advanced problems and still having success. Can anyone point me towards additional resources or suggest a different method to approach this problem?

Subject: Linear equations, Ax=b

From: Steven Lord

Date: 8 Feb, 2010 05:08:34

Message: 2 of 6


"Andy " <litchfield.a@gmail.com> wrote in message
news:hko507$cca$1@fred.mathworks.com...
> Hi everyone,
>
> I'm about to close a particular chapter of the work I've been doing using
> Matlab to solve an A*x=b system of equations. Before doing so I wanted to
> get some other peoples opinions regarding a way to solve for x before I
> just leave my results where they are.
> I only have one constraint and that is that x must be positive.

Positive or nonnegative? If the latter, use LSQNONNEG.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Linear equations, Ax=b

From: Andy

Date: 8 Feb, 2010 05:19:02

Message: 3 of 6

Hi Steven, your right, nonnegative is more correct.
I have tried LSQNONNEG (~9%) as well and it gives virtually the same result as LSQLIN. I usually get no messages that convergence has been achieved with either, though I may have in the past with lsqnonneg. Do you think it likely that I can't achieve a better solution?

Subject: Linear equations, Ax=b

From: Steven Lord

Date: 8 Feb, 2010 15:33:00

Message: 4 of 6


"Andy " <litchfield.a@gmail.com> wrote in message
news:hko6s6$63u$1@fred.mathworks.com...
> Hi Steven, your right, nonnegative is more correct.
> I have tried LSQNONNEG (~9%) as well and it gives virtually the same
> result as LSQLIN. I usually get no messages that convergence has been
> achieved with either, though I may have in the past with lsqnonneg. Do you
> think it likely that I can't achieve a better solution?

One of the first questions I'd ask is: are you certain that there is a
solution with all components nonnegative?

A = [1 0; 1 1];
b = [2; 1];

This system of equations has a unique solution; x = [2; -1].

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: Linear equations, Ax=b

From: Andy

Date: 9 Feb, 2010 01:07:04

Message: 5 of 6

Well it may not - the condition of x>=0 is due to the actual physical nature of the problem the x variables represent. Whilst an exact solution with nonnegative numbers may not exist, I would like to get as close as possible i.e. reduce min|Ax-b|
>
> One of the first questions I'd ask is: are you certain that there is a
> solution with all components nonnegative?
>
> A = [1 0; 1 1];
> b = [2; 1];
>
> This system of equations has a unique solution; x = [2; -1].
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
>

Subject: Linear equations, Ax=b

From: John D'Errico

Date: 9 Feb, 2010 04:43:05

Message: 6 of 6

"Andy " <litchfield.a@gmail.com> wrote in message <hko507$cca$1@fred.mathworks.com>...
> Hi everyone,
>
> I'm about to close a particular chapter of the work I've been doing using Matlab to solve an A*x=b system of equations. Before doing so I wanted to get some other peoples opinions regarding a way to solve for x before I just leave my results where they are.
> I only have one constraint and that is that x must be positive. This obviously rules out x=A\b (which gives negative and positive values) and the great LSQR function which also gives me negative values. With help from forum users I attempted to use quadprog (using Euclidean norm) but to no avail. My staple function has been LSQLIN and I set my lower bound to zero. The best fit I get is between 7-15% NRMSE (where as LSQR would give ~1% if allowed). Whilst the result won't be exact for this overdetermined system, why can't I get a closer result?
>
> My A matrix is 500 x 216 and b is 500 x 1. I have tried reading the available resources, including text books and have done my best to understand how to implement more complex constraints but they always seem to worsen the solution.
>
> I feel I must be doing something incorrectly as most people here are trying what seem to be much more advanced problems and still having success. Can anyone point me towards additional resources or suggest a different method to approach this problem?

Just wanting a better result does not assure that you
will get it.

This is the best you can achieve with that system of
equations.

John

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
lsqlin Andy 7 Feb, 2010 23:49:05
quadprog Andy 7 Feb, 2010 23:49:05
linprog Andy 7 Feb, 2010 23:49:05
simultaneous eq... Andy 7 Feb, 2010 23:49:05
rssFeed for this Thread

Contact us at files@mathworks.com