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

Home » Public Forums » archive » Re: FFT phase?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: FFT phase? [message #82902] Fri, 25 January 2013 13:48
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Friday, January 25, 2013 8:18:28 AM UTC-5, Yngvar Larsen wrote:
> On Friday, 25 January 2013 07:49:00 UTC+1, xqin...@gmail.com wrote:
> OR, if you know the frequency of your signal exactly a priori, you have to truncate your data to a periodic signal, i.e. an integer number of cycles, in order to extract A and B reliably. This is what Craig did in his reply, using only a single cycle.

Well, 2 cycles, but yes. :-)
Craig
Re: FFT phase? [message #82909 is a reply to message #82902] Fri, 25 January 2013 05:18 Go to previous message
Yngvar Larsen is currently offline  Yngvar Larsen
Messages: 134
Registered: January 2010
Senior Member
On Friday, 25 January 2013 07:49:00 UTC+1, xqin...@gmail.com wrote:
> Thanks. I have known the reason. What I use is like x= 2*!dpi*2*dindgen(25)/16, so the amplitude and phase are not so accurate.

As a rule of thumb for harmonic analysis, you need at least 10 cycles in your data to get a reliable phase/magnitude estimate. Your example using around 1.5 cycles is probably the worst case scenario.

OR, if you know the frequency of your signal exactly a priori, you have to truncate your data to a periodic signal, i.e. an integer number of cycles, in order to extract A and B reliably. This is what Craig did in his reply, using only a single cycle.

--
Yngvar
Re: FFT phase? [message #82911 is a reply to message #82909] Thu, 24 January 2013 22:49 Go to previous message
xqinshan is currently offline  xqinshan
Messages: 21
Registered: November 2008
Junior Member
Thanks. I have known the reason. What I use is like x= 2*!dpi*2*dindgen(25)/16, so the amplitude and phase are not so accurate.

在 2013年1月25日星期五UTC+8上午10时11分30秒,Craig Markwardt写道:
> On Thursday, January 24, 2013 12:28:02 PM UTC-5, xqin...@gmail.com wrote:
>
>> Hi,
>
>>
>
>>
>
>>
>
>> just use FFT(y). For example, y=A*cos(x+B), C=fft(y). I think atan(C,/phase) should equal to B, but the return reslut is not. How to obtain A and B from complex C?
>
>
>
> It is correct. Example:
>
> x = 2*!dpi*2*dindgen(16)/16 ;; Angle in radians
>
> y = 0.7*cos(x + 1.6000)
>
> c = fft(y,-1)
>
> print, atan(c[2],/phase)
>
> ==> 1.6000
>
>
>
> Craig
Re: FFT phase? [message #82915 is a reply to message #82911] Thu, 24 January 2013 18:11 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Thursday, January 24, 2013 12:28:02 PM UTC-5, xqin...@gmail.com wrote:
> Hi,
>
>
>
> just use FFT(y). For example, y=A*cos(x+B), C=fft(y). I think atan(C,/phase) should equal to B, but the return reslut is not. How to obtain A and B from complex C?

It is correct. Example:
x = 2*!dpi*2*dindgen(16)/16 ;; Angle in radians
y = 0.7*cos(x + 1.6000)
c = fft(y,-1)
print, atan(c[2],/phase)
==> 1.6000

Craig
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: how to convert a row of data in a column?
Next Topic: autocorrelation help

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

Current Time: Wed Oct 08 15:06:24 PDT 2025

Total time taken to generate the page: 0.00482 seconds