Fourier Series and Fourier Transform. Signal Denoising.


  1. Fourier Series
  2. Fourier Transform
  3. Signal Denoising using the Fourier transform

Fourier Series

Fourier series helps us define any periodic function as the sum of the sine and cosine functions. Also, it helps us to get the amplitude and phase spectrum. First of all, let’s have a look at the mathematical expression of the Fourier Series.

Fourier Series provides the decomposition of the periodic function on a base of the harmonic functions.

The given formula expresses the coefficients of the Fourier series. We can derive the equations related to the function. They can change regards to the demanding question.

We can propose another way of the Fourier Series equation:

This notation will help us to plot the Amplitude and Phase domain spectrum:

Suppose the given square-wave function with 3 second Period and a sampling rate of 0.0001.

Without detailing the mathematical details, let’s just plot the Fourier series. Start with n = 1. The result is:

For n=2.

So, as we can see that, when we increase the number of n, series are getting closer and closer to the shape of our function.

IF we do the same procedure to the half ramp signal, we will get:

For continuous periodic signals, a large number of harmonics can be used to approximate the signal well. For periodic signals with discontinuities, however, such as a periodic square wave, even a large number of harmonics will not be sufficient to reproduce the square wave exactly. This effect is known as the Gibbs phenomenon.

Fourier Transform

Fourier transform (FT) can be explained in exactly the same way as the Fourier Series. The only difference is usage. We generally use the Fourier Transform for Non-Periodic function. The Fourier Transform breaks a signal into an alternate representation, characterized by sine and cosines. The Fourier Transform shows that any signal can be re-written as the sum of sinusoidal functions.

Generally, It transforms the time domain function to the frequency domain function and that’s exactly what we need to perform the signal denoising.

Let f(t) be a real function of the time variable t, we define the direct Fourier Transform (FT) by the following integral (if exists):

here, v is the real variable and demonstrates the frequency. As we said, we get the frequency domain expression.” i” is the complex number. In some problems, we may need the inverse equation, get the time domain from the frequency domain, then we prefer to use the Invert Fourier Transform equation:

Or, we can use a simpler way of the representation, with the help of the pulsation (angular frequency) notation.

Delve into more details, Since it’s a complex expression, we can perform the following operations:

We can write F(v) by using Euler’s formula as following:

Signal Denoising

By the end of this article, we will have done a basic signal denoising task with the following steps:

  1. Import the signal and display it.
  2. Add some “fake” noise to the signal and display it.
  3. Apply the Fourier Transform in order to get the frequency domain and display it.
  4. Calculate the Power Spectral Density and display it.
  5. Analyze the plot, clean the noise part using the array filtering, and display the results.

So, Let’s start the practical part:

Import the needed libraries:

Importing the signal, and displaying it:

Adding some noise to the signal:

So, we can see our original signal (magenta) and the noise signal (green)

Apply the Fourier Transform to our signal.

We can implement the formulas and get the frequency domain function. But, thanks to the dynamicity and functionality to the python, we do not need to implement them from scratch. With the help of the “scipy” module, we may use both the direct and inverse Fourier transform. It called the Fast Fourier Transform.

The output is:

Demonstrating the Power Spectral Density

The power spectral density (PSD) of the signal describes the power present in the signal as a function of frequency, per unit frequency. It is the measure of the signal’s power versus frequency. Here’s the formula of PSD:

So, we see the PSD spectrum, we can observe the noise in the ground level of the spectrum. However, we see can observe 4 exact spectra, if we extract them, we can eliminate the noise. These spectra have greater than the 20 PSD. Using NumPy filtering, we can perform it:

Denoising process

So, we see that we used the correct indices and we get pretty good PSD spectra. Now, we need to edit our frequency domain and then transform it into the time domain. Again, we will use the “scipy” module in order to use the inverse Fourier transform. And we will demonstrate the new signal.

As we can see, the newly obtained signal looks like the original image.


Now, let us combine all the results together , and see what happens and discuss the results.

In the first image, we can see the original and the noise signal.

The second graph demonstrates the original signal(black) and denoised (blue) signal. Again we can see some differences between them, however, we can minimize them playing with the values.

The third image represents the PSD charts that we saw before.


  1. Maksim Bano — Introduction to the Signal Processing- French Azerbaijani University
  2. A. Maggie, J. Vergne — Signal Processing for Geosciences- French Azerbaijani University
  5. Steve Brunton — Data Denoising

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store