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

Home » Public Forums » archive » Re: possible bug with center keyword option for FFT
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: possible bug with center keyword option for FFT [message #75041 is a reply to message #75040] Fri, 11 February 2011 12:34 Go to previous messageGo to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
>
>
> "Mark" wrote in message
> news:babf90b7-e4a3-48bc-aecf-ae81e4a055d4@o18g2000prh.google groups.com...
>
>
> 2: According to the documentation, with the center keyword off in
> FFT(), element(0) is the FFT coefficient for the zero frequency. With
> the keyword center set, this coefficient is shifted to the 'center' of
> the array. This is a little ambiguous, especially when an array might
> have an even or odd number of points in a dimension.


You are absolutely correct. This is an error in IDL.


The normal packing is

0 DC value
1/(NT)
2/(NT)
...
(N/2-1)/(NT)
(N/2)/NT = 1/(wT) = special point, IF n is even, aliased nyquist value
-(N/2-1)/(NT)
-(N/2-2)/(NT)
...
-2/NT
-1/NT


So, if you want to "center" it, then you obviously want the most neg freq
which I would say is -(N/2-1)/(NT), but you could arguably say it is the
nyquist (for the even case). There is an ambiguity there.
But, you always want the DC at the "center" followed by all the positive
frequencies.


For the case of 8 points you have
i, freq

0 DC
1 1/N
2 2/N
3 3/N
4 nyquist
5 -3/N
6 -2/N
7 -1/N


So to 'center' it, it must become
i, old i, freq

0 5 -3/N
1 6 -2/N
2 7 -1/N
3 0 DC
4, 1 1/N
5, 2 2/N
6, 3 3/N
7, 4 nyquist

However, it could also be (cause the nyquist is both most neg and most
positive)
I, old I, freq

0 4 nyquist
1, 5 -3/N
2, 6 -2/N
3, 7 -1/N
4, 0 DC
5, 1 1/N
6, 2 2/N
7, 3 3/N


Now, either way, IDL is wrong since it has a postive frequency as it's first
point, then the nyquist, then the neg freqs.

Here, the DC can go to index 3, or to 4, but NOT to 5.


cheers,
bob



--

----------------------------
R.G. Stockwell, Ph.D.
Northwest Research Associates,
Colorado Research Associates Div.
3380 Mitchell Lane Boulder CO USA 80301
----------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Optimization Question: Sum at each element of array
Next Topic: Using non-default symbols in IPLOT

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

Current Time: Wed Oct 08 19:58:16 PDT 2025

Total time taken to generate the page: 0.24518 seconds