octave-maintainers
[Top][All Lists]
Advanced

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

Re: lsqnonlin and nonlin_residmin


From: Olaf Till
Subject: Re: lsqnonlin and nonlin_residmin
Date: Sun, 31 May 2015 20:00:23 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, May 31, 2015 at 02:51:40PM +0100, Asma Afzal wrote:
> 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.

Lambda depends among others on the way the Hessian is approximated (or
an equivalent calculation is done) by the solver. So lambda can be
different even for the same parameters in the same algorithm (in
particular __lm_svd__) if the previous course of optimization was
different. It's no use trying to get the same lambda as Matlab with a
different algorithm.

Olaf

-- 
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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