[Top][All Lists]

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


From: Christian T. Steigies
Subject: leasqr
Date: Tue, 22 Jan 2002 17:35:29 -0600
User-agent: Mutt/1.2.5i

I am trying to use "leasqr" which I found in the octave-forge (debian)
package. The demo works really nice, but I am trying to fit to a sin
function, very simple, three parameters, amplitude, frequency and phase.
It is working fine when the data consists of less than one period(?). It
also works sometimes for a few periods when my starting values are close to
the actual parameters. How sensitive is leasqr to the starting parameters?
And why is it so difficult to fit to a sine? My math lectures are some time
ago and it seems I did not pay much attention during optimization...

I am not fitting to real data yet, I just generate my data points, no noise
added. I tried both, analytic dfdp and the dfdp function (which I found via I hope the derivative is correct:

function y = leasqrfunc(x,p)
  y = p(1)*sin(p(2)*x + p(3));

function y = leasqrdfdp(x,f,p,dp,func)
  y= [sin(p(2)*x+p(3)), p(1)*x.*cos(p(2)*x+p(3)), p(1)*cos(p(2)*x+p(3))];

octave2.1           2.1.35-5

Any hints, books, webpages, FAQs, welcome.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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