help-octave
[Top][All Lists]

## A question on fftshift

 From: Steve M. Robbins Subject: A question on fftshift Date: Thu, 18 Jul 2002 11:46:51 -0500 User-agent: Mutt/1.4i

```Hi,

I hope someone can tell me if the bug lies in the fftshift doc or
my comprehension.

My understanding of the discrete Fourier transform, confirmed by
Numerical Recipes

http://www.ulib.org/webRoot/Books/Numerical_Recipes/bookcpdf/c12-1.pdf

is that the frequency interval for the FFT output is [-fc,fc] where fc
is the critical (Nyquist) frequency.

For samples spaced Dt apart, fc = 1/(2*Dt), so I expect the output
range to be [-1/(2*Dt),1/(2*Dt)].  Or, rather, the standard "wrapped"
sequence of this.  Thus, I would expect that after "fftshift", the
frequency values for the sample points should be

linspace( -1/(2*Dt), 1/(2*Dt) - 1/(N*Dt), N )

for an input of N samples.

The documentation for fftshift says otherwise, however.

- Function File:  fftshift (V)
Perform a shift of the vector V, for use with the `fft' and `ifft'
functions, in order the move the frequency 0 to the center of the
vector or matrix.

If V is a vector of E elements corresponding to E time samples
spaced of Dt each, then `fftshift (fft (V))' corresponds to
frequencies

f = linspace (-E/(4*Dt), (E/2-1)/(2*Dt), E)

Who is correct?

Thanks,
-Steve

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```