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 #75040] Fri, 11 February 2011 12:41 Go to previous message
R.G.Stockwell is currently offline  R.G.Stockwell
Messages: 163
Registered: October 2004
Senior Member
"R.G. Stockwell" wrote in message news:ij46h9$cg9$1@speranza.aioe.org...

>
>
> "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.

**********************************************


also, for the odd case, IDL is also wrong.
When there is an odd number of points, the actual nyquist value is not
sampled. (great trick question for anyone who thinks the nyquist is 1/(2T))

so you have, N = 7, and take T = 1 as the sampling interval:
I, freq

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

so the 'centered' fft is:
i, old i, freq

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


From the example shown, the dc went to the 4th index when centered, it MUST
go to the 3rd index.


cheers,
bob

PS, I hope it's obvious how I am writing that. the first number is the
current index of the spectrum array. Then the next column is the "old"
index based on the result of a straight FFT (i.e with out the center
keyword), then the final column is what the frequency value is, of a N point
time series with sampling T = 1, and here N = 7 but I thought that it would
be confusing to write out the 7 each time.

----------------------------
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 13:31:06 PDT 2025

Total time taken to generate the page: 0.00471 seconds