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?
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:where
f
is the bin frequency in Hz andi
is the bin index.See this answer for a more complete explanation.