Plot the Fourier-transform algorithm to understand it

Most of the time, people have trouble handling the Fourier transform of a signal because of its complex form. Except for very specific cases, the Fourier transform of a time series is most of the time a complex-numbered sequence — and complex numbers are not always simple to grasp, especially when you are not used to handling those kinds of numbers.

In this post, I want to show a few ways to visualize the Fourier transform of a 1D sequence of real numbers, which is what you handle 99% of the time, especially in data analysis and time series.

All images by author.

This post is the third of my Fourier-transform for time-series. Check out the previous posts here:

Review how the convolution relate to the Fourier transform and how fast it is:

Deepen your understanding of convolution using image examples:

Before diving into the actual computing and plotting of 1D Fourier transforms, we’ll review a few basic concepts of complex numbers that are crucial to what’s next. As you’ll see, complex numbers are actually pretty simple: just consider them as a vector of 2 numbers.

The end goal of this post is to make you more comfortable with the actual numbers behind your Fourier transforms.

Any complex number can be represented with its canonical form, using 2 real values, a and b, respectively called their “real” and “imaginary” parts:

where i is the unit complex number with the well-known property that if you square it…