7

Possible Duplicate:
How to get Frequency from FFT result

I am somehow confused with the x axis of fft(DFT) command in Matlab. When we do a fft command for a signal which has sampled in n point, we get a plot in which the x axis is 0 to n-1. Does it mean frequency in Hz? For example when I have a spike on n=2 is it mean that the signal frequency is 2Hz?

Community
  • 1
  • 1
shaloo shaloo
  • 213
  • 1
  • 2
  • 9
  • May also find this useful (Units of a Fourier Transform (FFT) when doing Spectral Analysis of a Signal) http://stackoverflow.com/q/1523814/181638 – Assad Ebrahim Nov 15 '12 at 12:29

1 Answers1

13

The X axis is dimensionless. To get the correspondence between bin index and frequency you need to know (a) the sample rate (in Hz), Fs, and (b) the number of points in the FFT, N. The centre frequency for the bin is then:

f = i * Fs / N

where f is the bin frequency in Hz and i is the bin index.

See this answer for a more complete explanation.

Community
  • 1
  • 1
Paul R
  • 208,748
  • 37
  • 389
  • 560