octave-maintainers
[Top][All Lists]
Advanced

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

Re: nlinfit in octave


From: Olaf Till
Subject: Re: nlinfit in octave
Date: Sun, 16 Aug 2015 22:16:22 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Sun, Aug 16, 2015 at 11:51:11AM +0100, Asma Afzal wrote:
> I have made the changes in [1-4]

I've not completed the review, but AFAICS there is a fundamental
misunderstanding in your nlinfit code: It's not considered that
nonlin_residmin applies the specified weights as factors to the
residuals, while Matlabs nlinfit seems to apply the specified weights
to the squared residuals (i.e., applies the squareroot of the
specified weights to the residuals).

If you make a new revision, please also make this changes:

- Don't state in the documentation 'using Iteratively Reweighted Least
  Squares (IRLS) Method' because it's not true for our backend.

-  if (nargs==6 || nargs > 7)
+  if (nargs < 4 || nargs==6 || nargs > 7)
     print_usage ();
   endif

- Check and correct code indentation.

> updated my repository with the
> current versions of lsqnonlin and lsqcurvefit.

Comparing them still shows differences:

diff ../optim/inst/lsqnonlin.m octave_workspace/lsqnonlin.m 
125,126d124
< ##
< ## @seealso {lsqcurvefit, nonlin_residmin, nonlin_curvefit}
314c312
< %!      lsqnonlin(@(p) myfun(p, x, y), p0, lb,  ub, opts)
---
> %!      lsqnonlin(@(p) myfun(p, x, y), p0, lb,  ub, opts)
\ No newline at end of file

diff ../optim/inst/lsqcurvefit.m octave_workspace/lsqcurvefit.m 
124,125d123
< ##
< ## @seealso {lsqnonlin, nonlin_residmin, nonlin_curvefit}
299c297
< %!      J = [exp(- p(2) * x), - p(1) * x .* exp(- p(2) * x)];
---
> %!      J = [exp (- p(2) * x), - p(1) * x .* exp (- p(2) * x)];
316c314
< %!      lsqcurvefit (@ (varargin) myfun(varargin{:}), p0, x, y, lb,  ub, opts)
---
> %!      lsqcurvefit (@ (varargin) myfun(varargin{:}), p0, x, y, lb,  ub, opts)
\ No newline at end of file


Within brackets, there must not be spaces between 'function name' and
'argument list in parantheses' (i.e. [exp (...)] does not work). This
is what I meant when I criticized that you should run and check the
code of your test blocks.

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]