octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lsqnonlin and nonlin_residmin


From: Asma Afzal
Subject: Re: lsqnonlin and nonlin_residmin
Date: Sun, 31 May 2015 14:51:40 +0100

Hi Olaf,

> Done, you can check it out from the repository. 'outp' returned by
> __nonlin_residmin__.m and nonlin_residmin.m/nonlin_curvefit.m now
> contains a field lambda which should be identical to what Matlabs
> functions return, so you can just copy this field.

Thank you for this. My only confusion is that the values of lambda for
Matlab and Octave and are generally different. For eg.

t = [0 .3 .8 1.1 1.6 2.3]';
y = [.82 .72 .63 .60 .55 .50]';
yhat = @(c,t) c(1) + c(2)*exp(-t);
x0=[1;1];
lb=[0.2;0.6];

lsqnonlin(@(c)yhat(c,t)-y,[1 1],lb) returns c=[0.3541 0.6000], flag=1
and lambda.lower =  [0;0.1506] for default settings.
In octave, we get same value of c but cvg= 3 and lambda.lower= [0;
7.61] for default settings. Decreasing TolFun still does not change
cvg but reduces lambda.lower to [0;0.81] for TolFun= 1e-10 and then
increases it to [0;0.186] for TolFun=1e-20 onward.

Is it because of a different backend? I tried some other examples too
but I'm not getting lambda consistent with Matlab.
I tried to study the complementary pivot function which returns lambda
in __lm_svd__ but I realized it's not easy to dig into it :).

About mapping cvg to exitflag:

The exitflag values (in Matlab) coincide with cvg except a few additional ones:

-2: Problem is infeasible: the bounds lb and ub are inconsistent.

Providing ub less than lb for instance, gives an error in octave but
returns empty vectors in Matlab with exitflag -2.

 4: Magnitude of search direction was smaller than the specified tolerance.
-4: Line search could not sufficiently decrease the residual along the
current search direction.

These flag values are specific to line search and are not applicable
to the __lm_svd__ backend in octave.

I will reply about optimoptions separately.

Kind Regards,
Asma.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]