Fourier Transforms#
The Fourier transform converts a function from a physical-space (or time) representation into a frequency-space representation. The two representations are equivalent, but give alternate views into how the function behaves.
The general form of a Fourier transform is:
where \(f(x)\) is the real-space form of the function. If we think of this in terms of space, \(x\) has dimensions of length and \(k\) has dimensions of 1/length, and can be interpreted as a wavenumber.
You can think of \(F(k)\) as being the amount of the function \(f\) represented by a frequency \(k\).
If we think of it in terms of time, then \(f(t)\) is the time-domain function and the transform is:
and \(\nu\) is now a frequency (units of 1/time).
The inverse transform is then:
Note
Alternate definitions of the transform exist, including swapping the minus sign in the exponental between the forward and inverse transform.
Discrete Fourier transform#
The discrete Fourier transform (DFT) works on discrete data, e.g.:
a time-series from an experiment
simulation data for a velocity field
We’ll work on the assumption that our data is evenly-spaced.
The discrete analogue of the Fourier transform is:
where we have \(N\) samples with values \(f_n\).
The inverse transform is:
Note
The convention we choose here is the same as used by the NumPy library in numpy.fft
Note
The discrete Fourier transform is closely related to the Fourier series.
Sometimes we write the DFT operation as:
and the inverse as:
Significance of real and imaginary parts#
Recall that we are integrating with a factor \(e^{-2\pi i k x}\). Euler’s formula tells us that
This means that the real part of the transform represents the cosine terms (symmetric functions) and the imaginary part represents the sine terms (antisymmetric).
If \(f_n\) is real, then:
Note
\(k = 0\) is special:
This is sometimes called the DC offset.
Normalization#
We haven’t yet motivated the \(1/N\) in front of the inverse DFT. This can be shown to arise from the discrete form of the Plancherel theorem—namely that both the real-space and frequency-space form of the function contain the same power.
But we can motivate it by a simple example.
Consider \(f(x) = 1\):
If we look at the discrete transform then:
For \(k = 0\): \(\cos(0) = 1\) and \(\sin(0) = 0\), so \(F_0 = N\)
For \(k > 0\): we are essentially doing a sum over the cosine and sine using equally spaced points, and the sum is always over a multiple of a full wavelength \(\rightarrow\) \(F_k = 0\)
With these frequency-space \(F_k\)’s, we can compute the inverse transform:
So we see that the \(1/N\) is needed to get back the original value of \(f(x)\).