Re: FFT Exasperation [message #40058] |
Sun, 11 July 2004 20:57 |
Kenneth P. Bowman
Messages: 585 Registered: May 2000
|
Senior Member |
|
|
In article <ccsdvn$cjn@odbk17.prod.google.com>, jamiesmyth_uni@yahoo.ca
wrote:
> Hi all,
>
> Can someone please walk me through the IDL FFT function with regards to
> the code below. In particular can someone explain why, 'Method 1' has
> problems with n={1023, 1022, 1021} but works fine for 1020, 1024? I
> thought I understood FFTs well enough but here I am with 3 different
> texts getting more confused by the minute about the difference between
> the math on the page and the code in my head... At this point, I'm not
> even sure I understand why the two shifts in 'Method 2' are required.
> The only think that I do know is that all my texts agree that a top-hat
> function ought to transform to a pure sinc function. Something is
> obviously getting lost between theory and practice.
I'm not quite sure what you are doing with all the indexing. Try this:
PRO FFTTEST2
; Create a sinc function in IDL starting with a rectangular
; modulation function.
!p.multi=[0,1,2]
n = 1023 ; number of points
w = 50 ; width of box
a = DBLARR(n)
a[0:w-1] = 1.0D0
PLOT, a, /XSTYLE
PLOT, SHIFT(FLOAT(FFT(a)), n/2), /XSTYLE
END
It seems to work fine for various n and w.
Ken Bowman
|
|
|