Understanding the Fourier Transfrom
Fundamental Principles
Part 1 (sine waves only)
If you want to know how much of a particular sine wave (with phase zero) contributes to a signal, just multiply the signal by the sine wave at each point, and then add up the area under the curve. To note, we are only considering a standard sine wave with no phase shift (we only choose the frequency).



The sine wave we multiply the signal with has an amplitude of just one. The summed green area would tell us what amplitude this sine wave actually contributes.
Question. If the sine wave and signal match exactly with only green area, shouldn’t integral sum to infinity? Answer: You’re right. FT only converges for finite signals.

Part 2 (cosine waves)
So far, we’ve only multiplied by sine waves. However, this wouldn’t be complete.


This means we have to multiply the signal by a sine wave and a cosine wave, and find amplitude contributions for each. The above diagram shows a cosine signal (blue) being multiplied by a sine and cosine signal (yellow and red). The red wave results to zero, meaning no contribution from the sine wave, and the yellow wave makes full contribution. This is reflected in the equation, with amplitude 1 and 0.
Now what if the blue signal is shifted?

Both the red sine wave and yellow cosine wave make contributions. The ratio of their contributions is the phase of the original signal.
Remember the identity:
where:
-
-
Multiplying by both a sine and cosine wave, we can capture the contribution of a sinusoidal wave of any phase.
To create the frequency spectrum for this example, we simply take as the amplitude at a frequency . This also means that two identical signals with different phases would have the same frequency spectrum, but have different phase diagrams.
Final Part
The following quote is from the start of this document,
If you want to know how much of a particular sine wave (with phase zero) is in a signal, just multiply the signal by the sine wave at each point, and then add up the area under the curve. To note, we are only considering a standard sine wave with no phase shift (we only vary the frequency).
Now we can say instead, that if we want to know how much of a sine wave of a specific frequency with a phase shift is in a signal, just multiply the signal by a sine wave and a cosine wave at each point. The ratio of the contributions determines the contribution of a particular sine wave with a particular phase shift.
Quite conveniently, we have Euler’s formula:
We only need to multiply the signal by an exponential, where the real part of the sum is the cosine amplitude, and the imaginary part is the sine amplitude.
Recap
It is possible to break a signal down into a sum of sine waves, with each wave having it’s own amplitude, frequency and phase.
We do this by first specifying a frequency of wave we want to test, then multiplying the signal by a sine and cosine of that frequency. From this, we can find the contribution of the wave and it’s phase shift.
Consider the following formula:
and are the contributions we learn from the integration sum for each wave.
is the phase shift of the wave we are testing.
is the contribution of that wave.
We’ve now found the contribution of a specific frequency wave, as well as it’s phase. All that’s left to do is plot the contribution in a frequency spectrum.
We can derive an equation that will give us the contribution and phase of a sinusoid of any frequency . We do this using…
The Fourier Transform
Continuous-Time Fourier Transform (CTFT)
Given a continuous-time signal :
We multiply the signal by a sine and cosine of frequency , and then integrate to find the contribution of a sinusoid of frequency . This is exactly what we are trying to do!
Plotting the magnitude of gives us the frequency spectrum.
Now, what if the signal was discrete…
Discrete Time Fourier Transform
The immediate analogy for the Fourier Transform in the discrete domain is the Discrete Time Fourier Transform, where is replaced with , the sample number. The output is a continuous periodic spectrum. The transform works identically to the standard Fourier, but now only multiplying and integrating over sampled points.
Discrete Time Fourier Transform:
Input: Discrete-time signal, potentially of infinite length
Output: Continuous function of frequency, defined for all
The output is periodic with period
This is like typical sampling shown in Image Processing
Discrete Fourier Transform
In reality, discrete signals have a finite duration. We take a different approach to computing the spectrum, treating the finite samples as periodic and representing the spectrum as a combination of harmonic frequencies.
As the samples are finite (and further considered periodic), we only need a finite number of frequencies to represent the signal. The reason why we have to consider the samples as periodic is because a finite set of frequencies will always produce a periodic signal when summed. This in contrast to the ideal frequency spectrum for an infinite signal, that would require an infinite number of frequencies to completely reconstruct.
Harmonic Frequencies
The lowest frequency measurable in a finite set of samples is the frequency equal to the duration of the signal.

Higher detectable frequencies are just integer multiples of this fundamental frequency.

The maximum measurable frequency is limited by the number of samples.

The total number of frequencies we use to represent the signal is equal to the number of samples in the signal, .

There are 8 samples in this signal, so we use 8 harmonic frequencies representing the signal.

Here we multiply by the DC value (1 in this case) and then integrate. This sums to zero, so there is no DC offset/contribution.

Now we look at the lowest frequency. We multiply by a sine and cosine of the same frequency and integrate to find the contribution of this frequency.

Continue doing this for each frequency multiple. Now you have the discrete frequency spectrum.
DFT Equation
Now we must represent this mathematically.
Discrete Fourier Transform:
Input: Finite-duration discrete-time signal of length
Output: Finite set of complex numbers representing frequency samples
, where
These are coefficients or contributions of the harmonic frequencies.
There are two indexes, and :
refers to the discrete sample in and is also the discrete analogy for .
The analogy explains why appears in the exponential. Standard form for a sinusoid:
refers to the harmonic frequency/coefficient number.
For example, to find the coefficient for the second harmonic frequency, you would set in the equation, then sum from to (since we have samples and the first sample is indexed at 0).
The equation multiplies the signal by a harmonic frequency at discrete points on the wave, then integrates (sums) to find the contribution.
Frequency of the first harmonic is , and for nth harmonic, , up to (Nth frequency would be the same as the first harmonic). These can be represented on a unit circle in angular frequency (radians), .

Example
,
Compute (DC coefficient):
Compute (coefficient for first harmonic):
Each exponential in this sum is basically a sampled point on the harmonic we are testing. Imagine the was , and the integral was with respect to , multiplying each point on the sine with the signal.
Imagine the in the exponential is analogous to but only at discrete points. This is to multiply discrete points on the sinusoid with discrete signal samples.
Compute :
We calculate each exponential term:
-
-
-
-
So:
Compute :
Evaluate each term:
-
-
-
-
Now substitute:
Final DFT Result:
Questions
Why is the frequency spectrum of am infinite aperiodic discrete signal, continuous and periodic?
Answer: Go back to image processing and read how sampling a signal in time domain is like multiplying with a comb function, and in the frequency domain, this is like convolving with the Fourier Transform of the comb function, which repeats the spectrum.