File Exchange

image thumbnail

fft_plot function

version 1.0.4 (2.91 KB) by pierre-alexandre chauvenet
Plot signal FFT norm and phase versus frequency and signal versus time. Customizable display, also return FFT data.


Updated 10 Aug 2020

View License

Function can also return fft results.

optionnal input argument:
- 'legend': 'signal name'
- 'title': 'your title'
- 'window': 'none', 'hann', 'hamming', 'flattop', 'blackman', 'blackmanharris'
- 'subplot': 'fft', 'fft_signal', 'fft_angle', 'all', 'none'
- 'MinNorm': if norm is lower than this value, angle is forced to 0.
(angle makes no sense for small norm)
- 'H1': replace frequency axis with harmonic number (divide frequency axis by H1)
- 'fmin': display frequency fmin to fs/2 (if H1 != 1 then fmin = Harmonic min)
- 'fmax': display frequency 0 to fmax (if H1 != 1 then fmax = Harmonic max)
- 'Amax': display amplitude 0 to Amax
- 'style': 'line', 'stem', 'bar', 'stairs', 'area', (fft norm only)
- 'scale': 'linear', 'semilogx', 'semilogy', 'loglog'
- 'linewidth': number (defaut is 0.5)

Cite As

pierre-alexandre chauvenet (2020). fft_plot function (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Johan Aubier

Simple, efficient and well written code for FFT visual analysis. Perfect fit for presentation purpose.
Would be good if mathworks use it as a native function.



add option to replace frequency axis with harmonic number


additional display options


- take both line or column signal input


return fft data (norm, angle, frequency)
plot angle becomes optionnal

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux