Version 1.0.1 (380 KB) by Don Koks
PlotFourierSpectrum plots the Fourier spectrum of a given data set.


Updated 23 Mar 2023

View License

PlotFourierSpectrum is a set of Matlab code that will plot the Fourier spectrum of an array of data, given a sampling frequency. It is based on the discrete Fourier transform. It allows you to experiment with changing the data and sampling frequencies, without having to worry each time about the arcane details of how to plot the spectrum.
The plot that is produced extends over both positive and negative frequencies. Various plotting options can be specified, such as plotting the absolute values of the Fourier coefficients, plotting their real and imaginary parts separately, or plotting the full complex values of these coefficients.
The package also contains a "how to use" pdf file, and several functions that can be used more generally in calculations involving the discrete Fourier transform.
This release is a minor update. I have made the plots in the usage pdf slightly better, and have simplified the code in a few places. The one "major" change is to two comments in Dft.m and DftInverse.m. These two comments referred in passing to Matlab's "dot" function and used that function in a (commented) code snippet, without my realising that "dot" complex-conjugates its first argument. So I've changed those comments to omit mention of "dot".

Cite As

Don Koks (2023). PlotFourierSpectrum (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Fourier Analysis and Filtering in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

See the main description.

This is a very minor update to fix a problem with the figure placement when using Microsoft Windows. (The original code was developed on unix, and works fine on unix and Macs. It will continue to work fine with this update.)
An update that doesn't change the code, but attempts to get the formatting right on the usage notes, since the Mathworks site has reformatted what I submitted.