Skip to main content

Ch 11: The Discrete Time Fourier Transform, the FFT, and the Convolution Theorem

This chapter directly expands on the previous by talking about how the Fourier Transform works and what it is used for, as well as the Convolution Theorem and its implications. This is an important chapter as the the Fourier Transform is the backbone of many analyses!

The Fourier transform works by computing the convolution using various sine waves as the kernels.  The general equation of a sine wave is:

Asin(2πf t + θ)

  • A is the amplitude
    • Power is amplitude squared, and is a term you may see used interchanged 
  • f is the frequency
    • The number of cycles per seconds, expressed as Hz
  • t is the time
    • The time you are calculating the wave in seconds. This is the dependent variable of the equation
  • θ is the phase
    • Measured in radians or in degrees (be careful here), essentially is the offset of the whole wave in regards to time

Use online graphing calculates and play with the sine equation until you feel familiar with how changing these properties changes the resultant wave!

On a 2D representation, we see sine waves cycling up and down. However, as discussed in the future, sine waves can be better described as a 3D spiral going through space (phasors), and the 2D plot is just a projection of this onto a plane.

You can take several sine waves, and add them together to get a more complicated signal.

image.png

11.2 Finding Waves in EEG Data with the Fourier Transform

With analysis of EEG time-series data, we want to know the frequency makeup of the signal. That is where the Fourier Transform comes in, as it gives us that information. 

While realistically you will be using pre-made functions to do the Fourier Transform (or more practically, the Fast Fourier Transform, more on this later), it is still important to understand where this comes from.

11.3 The Discrete Time Fourier Transform

The Fourier Transform in its original form is straight forward, Use a sine wave as a kernel and take the convolution with the time series data. Then repeat with another sine wave at another frequency. Then repeat again and again until you map out the frequency spectrum.

The number of since waves and the frequency of each is determined by the number of data points in the time-series data. In addition, instead of using "sin" directly as a function, we use Euler's Formula to use the form e-1ix of sine waves instead (more on this in Chapter 13).

The frequency of each sine wave iteration is equivalent to 2 * π * (Loop_Index). This does mean that the very first sine wave iteration we take has a frequency of zero. A sine wave of 0 frequency is a straight line, and the convolution using this gives us what is called the DC Component of the signal (DC being Direct Current). The DC Component is the mean offset of the entire signal.

The number of times / iterations we do is dependent on Nyquist's Theorem. It states that to sample any sine wave, you must sample at least 2 times per cycle. Ergo, the number of frequencies we can sample from a signal is one half of the total number of points in the time-series data set of the signal, plus 1 (the +1 being from the DC Component where frequency is 0). 

This can be written as the following formula:

image.png

NOTE: This equation was changed from the textbook, where it denoted as k = 1. As k is the loop index, the Textbook which is written for Matlab used k = 1 since Matlab loop indexing starts at 1. However, generally indexing in other actually sane languages starts at 0, so I changed this to k = 0 to be more in line in generic use

An understanding on the Discrete Fourier Transform (the original form) is important. If the above explanation is confusing, I highly suggest checking out this video for a more visual overview

11.4 Visualizing the Results of a Fourier Transform

11.5 Complex Results and Negative Frequencies

11.6 Inverse Fourier Transform

11.7 The Fast Fourier Transform

11.8 Stationarity and the Fourier Transform

11.9 Extracting More or Fewer Frequencies than Data Points

11.10 The Convolution Theorem

11.11 Tips for Performing FFT-Based Convolution in Matlab