Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Correction to error in nlsqnonneg

Subject: Correction to error in nlsqnonneg

From: Bill Whiten

Date: 25 Oct, 2011 04:33:11

Message: 1 of 2

lsqnonneg does not converge if result contains very small positive values:

small positive values are rejected at line 162 but being positive are not accepted into the set of zero coefficients:

   % inner loop to remove elements from the positive set which no longer belong
   while any(z(P) < 0) % WJW test against zero instead of tol to ensure converges
% while any(z(P) <= tol) % original code

If answer contains positive values <= tol iterations continue until iteration count is exceeded.

Have run many cases with the above correction without problems.

Subject: Correction to error in lsqnonneg

From: Bill Whiten

Date: 25 Oct, 2011 04:37:28

Message: 2 of 2

"Bill Whiten" <W.Whiten@uq.edu.au> wrote in message <j85e67$mu9$1@newscl01ah.mathworks.com>...
> lsqnonneg does not converge if result contains very small positive values:
>
> small positive values are rejected at line 162 but being positive are not accepted into the set of zero coefficients:
>
> % inner loop to remove elements from the positive set which no longer belong
> while any(z(P) < 0) % WJW test against zero instead of tol to ensure converges
> % while any(z(P) <= tol) % original code
>
> If answer contains positive values <= tol iterations continue until iteration count is exceeded.
>
> Have run many cases with the above correction without problems.

Tags for this Thread

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.

Contact us