Instead of diving straight into MATLAB's FFT routine you should instead consider using the periodogram function. When people say "FFT" they usual mean PSD or periodogram, i.e. a plot of power spectral density using a suitably windowed and FFTed sample. The periodogram function in MATLAB takes care of all the details of this for you, i.e. applying a window function, calculating the FFT, deriving magnitude from FFT output, appropriate scaling of axes, and even plotting if required.
Note: periodogram
is in the MATLAB Signal Processing Toolbox - if you do not have access to this then you can either consider using Octave (free MATLAB clone) which has a periodogram
clone, otherwise you would need to put the various building blocks together yourself:
- window function
- FFT
- calculate magnitude
- take scare of scaling of freq and magnitude values
- plot PSD