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

Home » Public Forums » archive » Re: Again an FFT question
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: Again an FFT question [message #80626 is a reply to message #80625] Thu, 28 June 2012 02:00 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Wednesday, June 27, 2012 6:45:46 PM UTC+2, alx wrote:
> On 27 juin, 18:45, alx <lecacheux.al...@wanadoo.fr> wrote:
>> On 27 juin, 18:33, David Fanning <n...@idlcoyote.com> wrote:
>>
>>
>>
>>
>>
>>> alx writes:
>>>> You can use the /CENTER keyword in FFT function since IDL7.1
>>
>>> Well, it was *present* in IDL 7.1. I don't think
>>> it actually worked until later.
>>
>>> Cheers,
>>
>>> David
>>
>>> --
>>> David Fanning, Ph.D.
>>> Fanning Software Consulting, Inc.
>>> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
>>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>>
>> ?
>> IDL> print,fft(cos(2*!pi*findgen(16)/16*3))
>> ( 5.06635e-008,     0.000000)( 8.06580e-008, 3.52675e-008)
>> (-9.04610e-009, 2.63418e-008)(     0.500000, 1.28007e-007)
>> (-9.08976e-008, 1.49012e-008)
>> (-2.65443e-008,-1.35536e-008)( 1.20273e-008, 2.63418e-008)
>> (-7.60014e-008,-9.51177e-008)( 1.25169e-007,    -0.000000)
>> (-7.60014e-008, 9.51177e-008)
>> ( 1.20273e-008,-2.63418e-008)(-2.65443e-008, 1.35536e-008)
>> (-9.08976e-008,-1.49012e-008)(     0.500000,-1.28007e-007)
>> (-9.04610e-009,-2.63418e-008)
>> ( 8.06580e-008,-3.52675e-008)
>> IDL> print,fft(cos(2*!pi*findgen(16)/16*3),/CENTER)
>> ( 1.25169e-007,    -0.000000)(-7.60014e-008, 9.51177e-008)
>> ( 1.20273e-008,-2.63418e-008)(-2.65443e-008, 1.35536e-008)
>> (-9.08976e-008,-1.49012e-008)
>> (     0.500000,-1.28007e-007)(-9.04610e-009,-2.63418e-008)
>> ( 8.06580e-008,-3.52675e-008)( 5.06635e-008,     0.000000)
>> ( 8.06580e-008, 3.52675e-008)
>> (-9.04610e-009, 2.63418e-008)(     0.500000, 1.28007e-007)
>> (-9.08976e-008, 1.49012e-008)(-2.65443e-008,-1.35536e-008)
>> ( 1.20273e-008, 2.63418e-008)
>> (-7.60014e-008,-9.51177e-008)
>> Both statements give expected results: i.e. non zero values at
>> positions 3 and 13 (CENTER=0) or 5 and 11 (CENTER=1).
>> alx.
>
> I forgot to say, by using 8.2.
> alx.

Thank you all for the answers. I guess the difference between changing sign of every second element and shift the array is due to a round-off error. This becomes clear when analyzing the differences between the two results using double precision or not.
Thanks also for the explanation of how the frequencies in an FFT are displayed.
I guess I'll have to update old code and remove the shift and use instead the center option.

Regards,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: problem in the path
Next Topic: Re: problem in the path

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

Current Time: Wed Oct 08 20:10:33 PDT 2025

Total time taken to generate the page: 0.37757 seconds