Categories
MATLAB

Discrete Fourier Transform (DFT) of a sinusoid signal with an integer frequency value

The analysis of a signal often requires studying it’s frequency spectrum to determine the components that compose the signal. FFT does exactly this. An FFT is a fast computation algorithm for Discrete Fourier Transform (DFT).

FFT-based measurement requires digitization of a continuous signal. It’s output is a complex vector containing information about the frequency content of the signal. The magnitude tells us the strength of the frequency components relative to other components & the phase tells us how all the frequency components align in time.

There are 2 main types of DFT issues : Aliasing & leakage

Choice of an appropriate sample-rate is the key to minimizing distortion. According to the Nyquist criterion, the sampling frequency (fs) must be at least twice the maximum frequency component in the signal. If this criterion is violated, aliasing occurs. Frequencies higher than fs/2 will appear as a low frequency component in the spectrum because of aliasing.

The sinusoid signal in the example below has an integer frequency value of 4. There will be no spread of spectral energy across a number of bins here since the sinusoid frequency value is integer and not a decimal fraction. So no leakage issue is present here. This issue and how to eliminate it will be discussed in another article where the input sinusoid signal has a fractional number of cycles.

In this example, one side of the Magnitude double side band spectrum plot is the mirror reflection of another side and the point of reflection happens at the fs/2 value (which corresponds to 50 bins). We do not need both sides of the spectrum to represent the signal, a single side will do, known as Single Side Band (SSB) spectrum.

Here is the MATLAB code that illustrates how to compute the DFT of a simple sinusoid signal (including it’s magnitude & phase information) :

https://usercontent.one/wp/www.kevnugent.com/wp-content/uploads/2020/10/fft_plot.pdf?media=1712708755