help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fftshift help in octave 2.1.35, incorrect?


From: Hugo van der Merwe
Subject: fftshift help in octave 2.1.35, incorrect?
Date: Sat, 13 Apr 2002 15:40:58 -0500
User-agent: Mutt/1.3.28i

Hello,

I'm running Debian, and have Octave 2.1.35-7

help fftshift from within octave claims:


 - 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)


The way I understand the fourier transform, I would believe that the
highest frequency you would get out of an fft would be half the sampling 
frequency. E.g. if you sample at 44.1kHz, from an fft you should get a 
spectrum from -22.05kHz to nearly 22.05kHz.

Is this incorrect? Because if it isn't, that linspace line must be 
incorrect. Taking a larger E will allow lower frequencies, and a more 
dense frequency spectrum, not a larger range of frequencies.

I would suggest

  samplerate = 1/Dt
  f = -samplerate/2 : samplerate/E : samplerate/2-samplerate/E

In terms of linspace, Dt and E this would be
  f = linspace (-1/(2*Dt), 1/(2*Dt)-1/(E*Dt), E)
but that is ugly.

Please CC replies.

Thanks,
Hugo van der Merwe



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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]