Fast Fourier Transform (FFT) - Digital Signal Processing Lecture 6
Fast Fourier Transform (FFT) - Digital Signal Processing Lecture 6
Borbala Hunyadi
Definition
The Discrete Fourier Transform (DFT) of a sequence x[n] is
N−1
X [k] = ∑ x[n]e −j2π N , for 0 ≤ k ≤ N − 1
kn
n=0
Applications:
● Filtering
● Spectral analysis
2 / 13
Recap: Discrete Fourier Transform
Definition
The Discrete Fourier Transform (DFT) of a sequence x[n] is
N−1
X [k] = ∑ x[n]e −j2π N , for 0 ≤ k ≤ N − 1
kn
n=0
Applications:
● Filtering
● Spectral analysis
Is DFT efficient enough?
2 / 13
Computational complexity of the DFT
Let’s define WN = e −j2π/N ! Then the DFT can be expressed as:
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Steps of the direct computation algorithm:
Stage 1:
Compute and store the values
WNl = e −j2πl/N = cos(2πl/N) − j ⋅ sin(2πl/N)
Stage 2:
for k = 0 ∶ N − 1
X [k] ← x[0]
for n = 1 ∶ N − 1
l = (kn)N
X [k] ← X [k] + x[n]WNl
end
end
3 / 13
Computational complexity of the DFT
Let’s define WN = e −j2π/N ! Then the DFT can be expressed as:
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Steps of the direct computation algorithm:
Stage 1:
Compute and store the values N evaluations of sin
WNl = e −j2πl/N = cos(2πl/N) − j ⋅ sin(2πl/N) and cos functions
Stage 2:
for k = 0 ∶ N − 1
X [k] ← x[0]
for n = 1 ∶ N − 1
l = (kn)N
X [k] ← X [k] + x[n]WNl
end
end
3 / 13
Computational complexity of the DFT
Let’s define WN = e −j2π/N ! Then the DFT can be expressed as:
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Steps of the direct computation algorithm:
Stage 1:
Compute and store the values N evaluations of sin
WNl = e −j2πl/N = cos(2πl/N) − j ⋅ sin(2πl/N) and cos functions
Stage 2:
for k = 0 ∶ N − 1 N 2 complex
X [k] ← x[0] multiplications and
for n = 1 ∶ N − 1 N(N − 1) complex
additions
l = (kn)N
X [k] ← X [k] + x[n]WNl
end
end
3 / 13
Computational complexity of the DFT
Let’s define WN = e −j2π/N ! Then the DFT can be expressed as:
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Steps of the direct computation algorithm:
Stage 1:
Compute and store the values N evaluations of sin
WNl = e −j2πl/N = cos(2πl/N) − j ⋅ sin(2πl/N) and cos functions
Stage 2:
for k = 0 ∶ N − 1 N 2 complex
X [k] ← x[0] multiplications and
for n = 1 ∶ N − 1 N(N − 1) complex
additions
l = (kn)N
X [k] ← X [k] + x[n]WNl
+ overhead:
end addressing, indexing...
end
3 / 13
Computational complexity of the DFT
Let’s define WN = e −j2π/N ! Then the DFT can be expressed as:
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Steps of the direct computation algorithm: O(N 2 ) - very costly
Stage 1:
Compute and store the values N evaluations of sin
WNl = e −j2πl/N = cos(2πl/N) − j ⋅ sin(2πl/N) and cos functions
Stage 2:
for k = 0 ∶ N − 1 N 2 complex
X [k] ← x[0] multiplications and
for n = 1 ∶ N − 1 N(N − 1) complex
additions
l = (kn)N
X [k] ← X [k] + x[n]WNl
+ overhead:
end addressing, indexing...
end
3 / 13
Fast Fourier Transform
4 / 13
Fast Fourier Transform
4 / 13
Divide and conquer FFT
Essential ingredients:
5 / 13
Divide and conquer FFT
Essential ingredients:
● Break down the N-point DFT to a cascade of smaller-size DFTs
5 / 13
Divide and conquer FFT
Essential ingredients:
● Break down the N-point DFT to a cascade of smaller-size DFTs
5 / 13
Divide and conquer FFT
Essential ingredients:
● Break down the N-point DFT to a cascade of smaller-size DFTs
● Exploit symmetries
5 / 13
Divide and conquer FFT
Essential ingredients:
● Break down the N-point DFT to a cascade of smaller-size DFTs
● Exploit symmetries
WNk = WNk+N
WNLk = WN/L
k
5 / 13
Radix-2 FFT
Radix-2 FFT is the most important divide and conquer type FFT
algorithm. It can be used if N = 2r . This can always be achieved using
zero-padding the sequence.
6 / 13
Radix-2 FFT
N-point DFT (N = 2r ) solved by a cascade of r stages:
The following slides show the exact operations performed during these
stages.
7 / 13
2-point DFT: How to compute in a simple way?
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Let us write out the expression for both DFT coefficients:
8 / 13
2-point DFT: How to compute in a simple way?
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Let us write out the expression for both DFT coefficients:
8 / 13
2-point DFT: How to compute in a simple way?
N−1
X [k] = ∑ x[n]WNkn , for 0 ≤ k ≤ N − 1
n=0
Let us write out the expression for both DFT coefficients:
The 2-point DFT coefficients are given by taking the sum and the
difference of the samples. This simple operation is represented by the
so-called butterfly diagram.
8 / 13
Combine two 2-point DFTs into a 4-point DFT
3
X [k] = ∑ x[n]W4kn , for 0 ≤ k ≤ 3
n=0
9 / 13
Combine two 2-point DFTs into a 4-point DFT
3
X [k] = ∑ x[n]W4kn , for 0 ≤ k ≤ 3
n=0
9 / 13
Combine two 2-point DFTs into a 4-point DFT
3
X [k] = ∑ x[n]W4kn , for 0 ≤ k ≤ 3
n=0
9 / 13
Combine two 2-point DFTs into a 4-point DFT
3
X [k] = ∑ x[n]W4kn , for 0 ≤ k ≤ 3
n=0
3
X [k] = ∑ x[n]W4kn , for 0 ≤ k ≤ 3
n=0
9 / 13
4-point DFT from 2-point DFTs
10 / 13
4-point DFT from 2-point DFTs
10 / 13
4-point DFT from 2-point DFTs
10 / 13
General case: N-point DFT from N/2-point DFTs
N−1
X [k] = ∑ x[n]WNkn
n=0
11 / 13
General case: N-point DFT from N/2-point DFTs
N−1
X [k] = ∑ x[n]WNkn
n=0
N/2−1 N/2−1
= ∑ x[2r ]WN2kr + WNk ∑ x[2r + 1]WN2kr
r =0 r =0
11 / 13
General case: N-point DFT from N/2-point DFTs
N−1
X [k] = ∑ x[n]WNkn
n=0
N/2−1 N/2−1
= ∑ x[2r ]WN2kr + WNk ∑ x[2r + 1]WN2kr
r =0 r =0
N/2−1 N/2−1
kr
= ∑ x[2r ]WN/2 + WNk ∑ x[2r + 1]WN/2
kr
r =0 r =0
11 / 13
General case: N-point DFT from N/2-point DFTs
N−1
X [k] = ∑ x[n]WNkn
n=0
N/2−1 N/2−1
= ∑ x[2r ]WN2kr + WNk ∑ x[2r + 1]WN2kr
r =0 r =0
N/2−1 N/2−1
kr
= ∑ x[2r ]WN/2 + WNk ∑ x[2r + 1]WN/2
kr
= G [k] + WNk H[k]
r =0 r =0
11 / 13
Example: 8-point FFT
12 / 13
Computational complexity of Radix-2 FFT
● v = log2 N stages
● per stage, there are N/2 butterflies
● per butterly, 1 complex multiplication and 2 complex additions
Total: log2 N ⋅ N/2 complex multiplications and log2 N ⋅ N complex
additions, i.e. O(Nlog2 N).
13 / 13