The world’s leading publication for data science, AI, and ML professionals.

Fourier Transforms: An Intuitive Visualisation

An intuitive visualisation of a discrete Fourier transform applied to simple time-series data.

Time-series Data Processing

Image by Author
Image by Author

This article visualizes the decomposition of a time series signal into its harmonics using the Fourier transform. The formula is explained in a visual manner to help understand its meaning.

Why Fourier Transforms?

The Fourier Transform is an extremely powerful tool used extensively in a wide variety of fields. Its power can be attributed to its ability to decompose time series signals into sinusoidal waveforms. This can be useful for example when denoising a signal and attempting to find the harmonics of a waveform.

Example Application

Say for example one wants to extract information from the vibration signal of a jet engine. This signal can be extremely noisy, as a jet engine can contain thousands of moving parts, each contributing to the vibration signal. As you can imagine, the time-series signals of each component will be roughly sinusoidal, since the engine is rotating. If you can deconstruct the time series into a set of sinusoidal signals, maybe you can identify the vibration signal of specific components, and then identify whether those parts are operating as intended.

The Formula

Where g(t) represents the time-series signal, f is a frequency, and G is the function of the amplitude of each frequency
Where g(t) represents the time-series signal, f is a frequency, and G is the function of the amplitude of each frequency

When first looking at the equation for the Fourier transform it may seem a be daunting. In this article, I will set out a small example that will help you understand what the formula is doing in a visual way.

Our Mission

To understand Fourier transforms, let’s set out a mission, if you can complete it you will understand Fourier transforms!

Image by Author
Image by Author

Above are three-time series signals. The blue and the red signals are sinusoidal (each with a period of 4π and 2π). The green is the sum of the two. Now let’s say we only have the green signal. Can we extract the blue and the red signals only using the green signal?

Wrapping in polar coordinated

Going back to the formula, the e ^ 2πi term may be familiar to you. This is a position in the complex plane, concretely e ^ 2πi = 1 and lives on the real axis plane. When taking e ^ 2πit, one can imagine a circle being traced in the complex plane, each position of the circle being indicated by the time t. When multiplying by g(t), one is simply mapping the time series signal to the circle in the complex plane.

Image by Author
Image by Author

As you can see, these are the same time-series signals as before, wrapped around the argand diagram. The only things missing from the formula are the frequency term in the exponent, and the integral.

Varying the frequency

So far, we have seen that part of the Fourier transforms merely wraps a time-series signal in polar coordinates. But how does this help us identify what sinewaves are used to make up the green signal?

The frequency term in the exponent can be thought of as the frequency at which we are wrapping the time-series signal in the polar plane. The higher the frequency, the more laps the time-series signal does around the polar coordinates.

Remember that the blue curve has a period of 2π, red has a period of 4π, and green is the sum of the two. Let’s see what happens when we vary the period at which we wrap the time series signals around the polar plane.

Image by Author
Image by Author

As you can see, the signals seem a bit chaotic, until the period reaches 2π, then suddenly the chaos turns into order.

This is pretty, but we still don’t know what sine ways make up the green signal.

Barycenters and Natural Frequencies

The last thing to interpret in the Fourier transform formula is the integral.

In the figure above I am showing the barycenters of each curve as a gray dot. This can be interpreted as the integral term in the Fourier transform formula. As you can see, the barycenter is always near zero, and then when approaching a natural frequency, the barycenter suddenly moves away from zero. For signals 1 and 3, a period of 2π corresponds to their natural frequency and the barycenter moves away from the origin. The barycenter in signal 2 stays at zero because it has a period of 4π, not 2π.

Because the barycenter of signal 3 moves away from the origin, we can identify that a period of 2π corresponds to a natural frequency of signal 3.

And that’s it! All the Fourier transform formula is giving you is the distance of the barycenter from the origin of the curves we have seen. When this distance spikes, we know we are approaching a natural frequency.

Back to the formula

So to recap, we have seen that the G(f) term in the Fourier transform formula represents the distance from the origin of the barycenter of the time series signal wrapped around the complex plane. When the distance from the origin is high, this frequency is a natural frequency of the time series.

Let’s graph the distance from the centroid to the origin for signal 3.

Image by Author
Image by Author

At periods 2π and 4π, the distance of the barycenter to the origin is very elevated, meaning one could approximate signal 3 as the sum of 2 sinusoidal waves with periods of 2π and 4π. Mission accomplished!

Conclusion

This was a little introduction to Fourier transforms and how they can be interpreted in a visual way.

Support me 👏

Hopefully this helped you, if you enjoyed it you can follow me!

You can also become a medium member using my referral link, get access to all my articles and more: https://diegounzuetaruedas.medium.com/membership

Other articles you might enjoy

Information Theory Applied to Wordle

Reinforcement Learning: An Introduction


Related Articles