[SciPy-user] RE : Re: help on numerical modelisation of near-sinusoidal function using SciPy for pendulum analysis

Robert VERGNES robert.vergnes at yahoo.fr
Fri Dec 8 01:34:54 CST 2006

Thanx for your help.

Travis Oliphant <oliphant at ee.byu.edu> a écrit : palazzol at comcast.net wrote:

>I think optimize.minpack.leastsq() could be made to work, but it would be best if you could make good initial guesses for a,b,co, and phi.   You could use some ad-hoc methods to come up with guesses for these initial conditions, based on looking at a bit of the waveform, and then use leastsq() to calculate the best values and residual error norm.  For example, a is the average over time, b is the half the amplitude between peaks, co based on Theta(t) crossing a, etc.

optimize.leastsq  (don't use the minpack itermediary because that could 
change)   is the function you want for general curve-fitting.  You can 
also use another optimization function with a slightly different function.

This is also similar to the frequency estimation problem so the fft is a 
good fit to get starting estimates as Frank suggests.   A simple 
algorithm could be constructed in a few lines using the fft and 


SciPy-user mailing list
SciPy-user at scipy.org

 Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20061208/9a998d5a/attachment-0001.html 

More information about the SciPy-user mailing list