Fourier Series and Transform

Editovat
Fourier analysis
  • Study of how general functions (e.g., on ) can be approximated by sums of simpler (e.g., trigonometric) functions.

  • Fourier’s original motivation was to solve the heat equation, a partially differentiable equation.

    • A partially differentiable equation (PDE) involves multiple variables and one or more of their derivatives.

    • Example: I want to know what happens, when I put two rods of different temperatures into contact.

Fourier series

Fourier series (FS)

Series expansion (CZ: rozvinutí nekonečné řady) of a periodic function into a sum of basis functions.

  • For basis functions, it uses and functions with a whole number frequency.

  • Foundation for Fourier analysis and expansion of periodic functions in general.

  • Simple mathematical tool for approximation of periodic functions.

  • The coefficients are called frequency spectrum.

  • Each coefficient is the projection of the -th basis function onto .

  • It answers the question: "How important is this basis function in the grand scheme of ?"

  • Typically, we use a scale for visualization of the coefficients.

Fourier series on -periodic functions

Any -period function can be expanded in the following way:

  •  — frequency at which and oscillate

  •  — coefficients of even parts of

  •  — coefficients of odd parts of

Fourier series on L-periodic functions

Similar to -periodic functions, but we multiply by , where :

Complex Fourier series on -periodic functions

With complex numbers the formula becomes:

After expanding the inner product in the above formula for , we get a conversion from time to frequency:

Complex Fourier series on L-periodic functions

We multiply by and adjust the scaling factor and integral boundaries, where :

Expansion/Frequency → Time:

Time → Frequency:

Why use complex numbers in the Fourier series and Fourier transform?
  1. They simplify the formula:

    • (Euler’s formula)

  2. With them, FT is can be solved linearly and expressed using matrix multiplication. Without them, it’s an optimization problem that must be solved numerically.

    • If we used real numbers and, for example, as the basis function, we would not be able to use matrix multiplication and would have to find numerically.

  3. Complex numbers also symbolize rotation, which makes for a nice intuitive explanation (see below).

Proof of orthogonality for the Fourier series

We want to show that::

Proof:

Gibbs phenomenon

Functions with discontinuities are hard to be approximated with Fourier series as and are both smooth.

fa02 gibbs

Fourier transform

Fourier transform (FT)

A tool for frequency analysis. It decomposes a signal into a sum of sine and cosine waves of varying frequencies (and phases).

Fourier transform is a function taking a signal (a function of time) and converting it to the frequency domain (function of frequencies).

  • FT is a generalization of FS. It’s derived from L-periodic complex FS with .

  • FS handles only periodic signal. FT handles aperiodic signal.

  • It’s total. Lossless. Doesn’t throw away any information. It’s invertible. A bijection. A linear mapping.

Inverse transform (frequency → time):

Forward transform (time → frequency):

Commonly:

Coefficients of the Fourier transform
  • Each coefficient is associated with a basis function oscillating at frequency .

  • is simply a complex number, where:

    • amplitude  — strength of basis function

    • phase  — controls the phase shift of basis function

Spectral density

Plot of for .

fa02 spectral density
Function pairs in the Fourier transform
  • FT of the rectangle function is sinc.

  • FT of a Gaussian is a (different) Gaussian.

Intuitive explanation of the Fourier transform [2]
  1. Complex numbers describe rotation, therefore multiplying by a set of complex numbers "winds up" around a circle.

  2. Sampling this wound-up version of (whether using an integral or sum) means calculating the center of mass of the wound up version.

  3. When the center of mass is far away from the origin, the wound-up "aligns" with itself, meaning there is a strong correlation between and the sinusoid given by the "winding" frequency.

    • Except in FT, there is no division by the length of the studied interval, so it’s a "scaled center of mass". This has the effect that the more persistent a frequency is, the higher its spike.

fa02 intuitive ft 1
fa02 intuitive ft 2
Note
The "winding" is clockwise by convention. That’s why there’s a in the equation.
Properties of the Fourier transform
  • Shift affects only the phase

  • Scaling — Narrowing in the time domain causes widening in the frequency domain, and vice versa:

  • Derivative enhances high frequencies:

Proof of scaling of FT

We want to show:

Proof:

fa02 proof cft scaling
Note
We solve the integral using substitution . Normally, we would get a factor in front of the integral. However, we must make one case for and another for , which together resolve in .
Convolution theorem (CZ: věta o konvoluci)

Given two signals and and their Fourier transforms and , respectively, the following holds:

where '' stands for a convolution and '' for point-wise multiplication.

Proof of convolution theorem for CFT

We want to show:

Proof:

fa02 proof cft convolution theorem
Discrete time Fourier Transform (DTFT)
  • We sample the time domain.

  • In other words, we turn discrete samples that are evenly-spaced in time into a continous function.

  • Under the Nyquist-Shannon sampling theorem we can, under certain conditions, recover the original continuous signal from the samples.

  • Theoretical tool used in mathematics but not in signal processing.

time → frequency:

frequency → time:

Discrete Fourier transform (DFT)
  • We obtain it from DTFT by limiting the time domain (i.e., it’s not anymore).

  • In practice, it’s finite. Mathematically, it’s infinite but periodic.

Given a discrete 1D signal of length (), let be an orthonormal basis:

where:

  • is the index (position)

  • is frequency (speed of oscillation)

Then a projection of into basis would be:

When the constant is extracted, we obtain the forward 1D DFT:

Inverse 1D DFT (expansion):

Note
If we define without the , the forward transform would have no factor in the front, and the inverse would have similar to the L-periodic FS above.
Root of unity
  • A complex number that yields 1, when raised to some power .

  • An n-th root of unit is where .

  • Any integer power of an n-th root of unity is also an n-th root of unity: .

DFT in matrix notation

Let be the Nth root of unity, then:

Then is the forward DFT matrix:

and , and .

Fourier coefficients of DFT
  • is the "direct current (DC)", "mean", or "normalizovaný součet"

  • are the "alternating current (AC)" terms

  • corresponds to the highest frequency in (because of aliasing)

Properties of DFT
  • Periodicity

    • We can index outside of the range and a value will be there.

    • However, the input signal also seems periodic although it’s not, resulting in a "false edge".

  • Oddness and evenness

    • DFT of an even function missed the imaginary part ( waves)

    • DFT of an odd function missed the real part ( waves)

  • Shift

  • Reciprocity — a narrow signal results in a wide frequency domain and a wide signal results in a narrow frequency domain

  • Hermitian symmetry

  • Linearity

  • Convolution theorem

    • It’s more effective to to a DFT followed by an IDFT than to do a convolution, but we need a long enough signal!

  • Stretch by a factor in the time domain results in -fold repetition of in the frequency domain. These repetitions are dampened by .

    fa02 stretch
  • Rayleigh theorem — Conservation of "energy".

    Warning
    Scaling doesn’t work in the discrete world. Instead, we undersample or oversample, which may result in loss of information.
Proof of periodicity of DFT

We want to show:

Proof:

fa02 proof dft periodicity
Proof of shift of DFT

We want to show:

Proof:

fa02 proof dft shift
Proof of Hermitian symmetry of real signal in DFT

We want to show:

Proof:

fa02 proof dft hermitian symmetry
Proof of linearity of DFT

We want to show:

Proof:

Proof of the convolution theorem for DFT

We want to show:

Proof:

fa02 proof dft convolution theorem

where is Kronecker delta (not Dirac delta).

Hamming window
  • A solution to the "false edge" problem of DFT periodicity.

  • We blur the edges of the frequency domain (using a convolution).

Mixing console

Allows to limit/enhance specific ranges of frequencies.

Fast Fourier transform (FFT)
  • Recursive, divide and conquer.

  • It doesn’t really compute DFT directly, it uses its properties. Specifically, oddness & evenness, stretch, shift, and linearity:

  • Also that . (FFT on a single sample, is just the single sample.)

  1. Split the original -point signal () into two N/2-point signals, one with all the odd samples and one with all the even samples. Run FFT recursively on each.

  2. Stretch the even signal to the size of the original signal. There is now a zero at every odd index. The FFT of the streched signal is the same as before, but repeated twice.

  3. Stretch the odd signal to the size of the original signal and shift it one to the left. The FFT of the stretched and shifted signal is the same as before, but repeated twice and phase-shifted.

  4. Recombine the two signals (using linearity).

1D Fourier transform formula summary
fa02 fa summary

Sampling

Low-pass filter
  • Linear filter

  • Low frequencies pass through. High get suppressed.

  • Examples: Gaussian, Sinc, Box, Tent, B-Spline, Lanczos

High-pass filter
  • Linear filter

  • High frequences pass through. Low get suppressed.

  • Examples: 1st and 2nd derivatives

Sampling
  • In spatial/time domain, sampling of signal is multiplication by sampling (i.e., comb) function .

  • In Fourier domain, sampling is convolution of and .

    • Convolution with Dirac impulses, replicates (much like in DTFT).

  • To properly sample a continuous function, it has to have an frequency upper bound, otherwise the frequency spectrum will be cut off.

  • The sampling frequency is limited from the lower end by us not wanting to lose information, and from the upper end by reasonability.

  • The comb function density must be high enough to guarantee proper sampling.

fa02 frequency domain sampling
Nyquist-Shannon theorem

Exact reconstruction of a continuous signal from its samples is possible if the signal is bandlimited and the sampling frequency is greater than twice the signal maximum frequency.

Reconstruction

Reconstruction is a convolution of a discrete sequence with some low-pass filter with the objective to get the original continuous signal.

Aliasing

Phenomenon occurring when a continuous signal is sampled at a rate insufficient to capture its complete frequency content.

  • It happens when the Nyquist-Shannon condition is broken.

    • When the sampling frequency is not high enough (e.g., wagon wheel effect).

    • When the signal is not badlimited (e.g., far horizon).

fa02 aliasing
Prefiltering

A solution to aliasing, where we apply a harware-based low-pass filter before sampling the continuous signal, effectivelly lowering the upper bound of its frequencies.

Resampling

Changing the sampling frequency of an already sampled signal, preferably without introducing aliasing.

  1. Reconstruct the continuous signal from the discrete one.

  2. Warp the domain of the continuous signal.

  3. Prefilter the warped, continuous signal.

  4. Sample this signal to produce a new discrete signal.

During implementation:

  • We don’t actually construct any continuous signal.

  • For each position in the resampled signal that’s being constructed, we look for the corresponding positions and their neighbors in the original signal.

  • Since the computation is inverted, we invert the warp () as well.

where

  • is the original discrete signal

  • is the reconstruction filter

  • is a (lowpass) prefilter

  • is called a resampling filter

  • is the warping function (i.e., mapping from one coordinate system to another)

  • If is affine (linear + shift), then

Postfiltering/supersampling

If is not affine, the resampling filter is space-variant. In that case, we do actually have to reconstruct the continous signal from the original discrete signal, warp it, sample it at very high resolution to avoid aliasing, and the postfilter it to produce a lower resolution output signal. The convolution happens at the very end.

Fourier Transform in 2D

Fourier transform in 2D

Forward continuous:

Inverse continuous:

Forward discrete (2D DFT) of image with pixels:

Inverse discrete (2D IDFT) of frequency domain with values:

Frequency domain (FD) in 2D DFT
  • We only care about one period of FD. Thus, the FD "image" has the same size as the original.

  • We shift the image by so that zero frequency is in the center (and not in the corner).

  • The FD has two components (real/imaginary, or magnitude/phase). Typically, we only display magnitude but phase still exists!

  • We show the FD magnitudes on a scale.

fa02 2d frequency domain

The phase contains what seems like noise, but it’s important for the structure (edges) of the image:

fa02 2d dft phase

Visually, each vector of FD represents a 2D sinusoidal function of . Magnitude of is the frequency. Direction of is the orientation of the "waves".

fa02 2d basis function example

Questions

Explain the meaning of Fourier coefficients.

They measure the amount of correlation of a particular basis function with the expanded function.

Prove that Fourier transform is a linear mapping.

See proof of linearity for DFT above. It’s the same except there are integrals instead of sums.

Describe the spectral density plot.

A chart with two axes: x = intensity, y = frequency. Similar to a histogram.

Which frequencies dominate in the Gaussian plot?

Low frequencies, around 0.

Which operation in frequency domain corresponds to convolution in time domain?

Point-wise multiplication.

Is there ever any reason to do a convolution in the frequency domain?

Yes. If we do a convolution in the frequency domain, we duplicate the signal many times. We can use this to check if the sampling frequency is selected properly (not too low, not too high). See Sampling above.

Which frequencies are enhanced if we apply a derivative to an input signal?

High frequencies. Higher with every derivation.

Define a discrete Fourier basis function with frequency and overall length .

In FT, it would be (where replaces length ), so in DFT it is where . ( is a column vector.) is added for normalization.

Note
This is how the basis functions would appear in the inverse DFT, since that’s derived from FS. In forward FT, a complex conjugate is used because of how dot products work with complex numbers, therefore there is a negative sign in front of .
Create a matrix that can perform forward (discrete) Fourier transform for a signal of length .

There is no point in having basis functions with frequency greater than , so the matrix will be N x N = 2 x 2:

What is the product of the projection of an even function into a sin wave?

Zero.

Why are the wide functions in time domain transformed into their narrow counterparts in frequency domain and vice versa?

Wide functions have low frequencies, which are near the origin of the frequency domain. The wider the function, the lower the frequency, the closer to the origin of the frequency domain. And vice versa.

Compare the complexity of standard DFT and FFT.
  • Complexity of DFT is , because of the double sum.

  • Complexity of FFT is , because of the binary-search-like approach.

What happens in Fourier domain if the signal samples are interleaved with zeros?

The values repeat because it’s periodic.

Prove that DFT is a linear mapping.

See Proof of linarity of DFT above.

Why does scaling not work in the case of DFT?

Because the discrete world is not infinitely scalable like real numbers are.

Explain the reciprocity of time and frequency domain.
  • Square functions in one turn to smooth in the other.

  • Wide turn into narrow.

Show an example of the aliasing effect.
fa02 aliasing
Explain the difference between low-pass and high-pass filter.

Low-pass filter preserves low frequencies. High-pass filter preserves high frequencies.

What is a prefilter?

A low-pass filter to prevent aliasing while (re)sampling.

Give an example of warping function.

Rotation, halving the resolution, offsetting by one pixel to the left, etc.

References