Categories
MATLAB

How to use the Fourier Transform to find the frequency components of a signal buried in noise using MATLAB

This is very useful for cleaning and de-noising data that could be from real experiments pulling out the dominant frequency components and filtering out everything else (in this instance noise). This technique can be used in many different applications (eg audio data processing, sensor data) were noise or glitches embedded in a signal could be a major issue and needs to be filtered out to recover the original clean signal for easier data analysis.

This example illustrates how to compute the Fourier Transform of a corrupted noisy signal that is the sum of two sinewaves (eg a 2 tone signal) + random noise, using the FFT, how to interpret the Power Spectrum Density (PSD) (ie how much power is in each frequency component) then use it to filter out any noise and inverse fourier transform (iFFT) to recover the cleaned original timed domain signal.

The key here is to locate all the indices of the frequencies where the power is greater than a threshold value, take the PSD and multiply it with those indices to keep the large peaks and zero any entries less than the threshold value to filter out any bunch of noise.

Here is the MATLAB code that illustrates how to use the Fourier Transform to find the frequency components of a signal buried in noise :

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