unit of fft(DFT) x axis

shaloo shaloo picture shaloo shaloo · Nov 15, 2012 · Viewed 15k times · Source

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?

Answer

Paul R picture Paul R · Nov 15, 2012

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.