comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » mpfit of parametric data?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: mpfit of parametric data? [message #40533 is a reply to message #40290] Thu, 12 August 2004 15:00 Go to previous message
jamiesmyth_uni@yahoo. is currently offline  jamiesmyth_uni@yahoo.
Messages: 6
Registered: July 2004
Junior Member
After two weeks of vacation I'm back at this. I've de-trended the
original time series by fitting to a quadratic, and estimated the
frequencies of the components by looking at the power spectrum.
Unfortunately, I still cannot fit the amplitude and phase of a trivial
sinusoid such as 'A*sin(2*!dpi*w*t+phi)'. How do I go about estimating
the phase of the following trivial example?

IDL> n = 2048
IDL> t = dindgen(n) * 0.125 ; time
IDL> freq = dindgen(n)/(n*0.128)
IDL> p0 = [0.03, 0.06923, 2.3]
IDL> data = p0(0)*sin( 2*!dpi*p0(1)*t + p0(2) )
IDL> plot, t, data
IDL> Ft_data = fft(data)
IDL> plot, freq, abs(Ft_data)^2, xrange=[0,0.5] ; frequency estimate
IDL> plot, freq, atan(double(Ft_data),imaginary(Ft_data)),
xrange=[0,0.5] ; ?phase estimate?

I think I understand what Craig said about a local-minimum but I'm a
little surprised that such a simple problem (i.e. estimating the
amplitude, frequency and phase of a sine wave) would be so difficult?
How is it that my Lecroy/Tektronix scope can solve this in real time
but I cannot do it with IDL and a dual xeon? Surely I must be missing
something...

Any help is greatly appreciated!
Jamie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: ENVI: how to avoid stretching in image displays?
Next Topic: animate loaded images

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 08:11:40 PDT 2025

Total time taken to generate the page: 0.31922 seconds