Chapter 5 Slides
Chapter 5 Slides
1
Fourier Transform
• The main use of Fourier transform is to find a signal
representation in the frequency domain.
• Signal can be converted from time to frequency domain
and vice versa.
• In the frequency domain, we can see the frequency content
of the signal (as presented by the Fourier coefficients).
2
Signal (time domain) Spectrum (frequency domain)
2.5 60
2
50
1.5
1
40
0.5 Fourier
30
0
-0.5
Transform 20
-1
-1.5 10
-2
0
-2.5 0 5 10 15 20 25 30 35 40 45 50
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
5 15 30 Hz
3
Four Types of Fourier Analysis
1 1 N −1
ck = T xa (t )e − j 2πkF0t dt 1
Tp p
F0 =
Tp ck =
N
x(n)e− j (2π / N )kn
FS n =0 DFS N −1
∞
xa (t ) = ck e j 2πkF0t x ( n) = ck e j (2π / N )kn
k = −∞ k =0
X(Ω)
Ω
∞ ∞
X a (F ) = x ( n ) e − jΩ n
− j 2πFt
x (t )e
−∞ a
dt X ( e jΩ ) =
n = −∞
CTFT DTFT
∞ 1
2π X ( e
j 2πFt
xa (t ) = X a ( F )e dF x(n ) = jΩ
) e jΩ n d Ω
−∞ 2π
Fourier Series
1
ak = T x ( t ) e − j 2 π kf 0 t dt 1 xN (t ) = kN=− N ak e j 2πkf0t
T0 p f0 = Hz
T0
∞
X a (F ) = xa (t )e − j 2πFt dt
−∞ Synthesis equation
Analysis equation ∞
xa (t ) = X a ( F )e j 2πFt dF
−∞
Discrete Time Fourier Transform
X(Ω)
∞
X (e jΩ
)= x ( n ) e − jΩ n Synthesis equation
n = −∞ 1
x(n ) =
2π 2π X (e jΩ )e jΩn dΩ
Analysis equation
2π f
Ω= 7
fs
Limitations of DTFT
• It turns out that an infinite number of samples x[n] are
required to compute DTFT. This would require
infinite memory.
• DTFT cannot be performed by digital processor
because frequency in DTFT is a continuous value.
• Computer only understands and processes discrete
values.
• Discrete Fourier Transform (DFT) is designed to
overcome this problem (by sampling the frequency
signal).
(
X [k ] = X e jΩ k ) Ωk =
2πk k = 0 ,1, K , N − 1
N
8
Relation Between DTFT and DFT
DTFT DFT
∞ N −1 2π
( ) = x[n]e
X e jΩ − jΩn
X [k ] = x[n] e
−j
N
kn
n = −∞ n =0
X(Ω) 2π
δΩ =
N
X(kδΩ)
Ω
kδΩ
9
Discrete Fourier Transform
• The DFT of an arbitrary periodic digital signal x[n] (of N samples
in a period) is
N −1 2π
−j kn
X [k ] = x[n] e N k = 0, 1, ..., N − 1
n =0
Usually the notation is used : WN = e − j 2π N
L L
−∞ ∞
n
0 1 ……. N-1 11
Computing Discrete Fourier Transform
for k = 0
3 3
X [0] = x[ n]e − j 0 = x[ n] = 1 + 0 + 0 + 1 = 2
n =0 n =0
for k = 1
3
X [1] = x[n]e − j 2πn / N = 1 + 0 + 0 + 1e − j 2π 3 / 4
n =0
− j 3π / 2 3π 3π
X [1] = 1 + e = 1 + cos( ) − j sin( ) = 1 + j = 2∠45 o
2 2
12
N −1
X [k ] = x[n] e − j 2 πkn N k = 0,1,K , N − 1
n =0
for k = 2
3 3
X [ 2] = x[ n]e − j 2π 2 n / N
= x[n]e − j 4πn / N
n =0 n =0
X [ 2] = 1 + 0 + 0 + 1e − j 4π 3 / 4 = 1 + 0 + 0 + 1e − j 3π = 1 − 1 = 0
for k = 3
3
X [3] = x[ n]e − j 2π 3n / N = 1 + 0 + 0 + 1e − j 9π / 2 = 1 − j = 2∠ − 45 o
n =0
1.5
0.5
0
0 0.2 0.4 0.6 0.8 1 (w)
0 1 2 3 (k)
14
MATLAB/Octave Function to Compute DFT
DFT Magnitude
2
1.8
1.4
0.6
0.4
0
0 0 .5 1 1 .5 2 2.5 3
xvec=0:3; Xk =
stem(xvec,Xk_mag); Columns 1 through 2
xlabel('Frequency index k'); 2.0000 1.0000 +
1.0000i
WN = e − j 2π N
WNkn = e − j 2πkn N
17
Example: Compute the DFT of x(n) = [0 1 2 3].
Solution
The DFT matrix is given by
W40 W40 W40 W40 W40 W40 W40 W40 1 1 1 1
0 1 2 3 0 1 2 3
W4 W4 W4 W4 W4 W4 W4 W4 1 − j − 1 j
= =
W 0 2 4
W4 W4 W4 6 W 0 2 0
W4 W4 W4 2 1 − 1 1 − 1
40 4
1
W4 W43 W46 W49 W40 3 2
W4 W4 W4 1 j − 1 − j
X (0) 1 1 1 1 0 6
X (1) 1 − j − 1 j 1 − 2 + 2 j
= =
X (2) 1 − 1 1 − 1 2 − 2
X (3) 1 j − 1 − j 3 − 2 − 2 j
18
Independent Variables of the Frequency Domain
• The horizontal axis of the frequency domain can be
referred to in 3 different ways.
- Frequency index, k (unitless)
- Normalized frequency, Ω (in rad)
2πk
Ωk =
N
- Analog frequency, f (in Hz)
f sk
fk =
N
fs
Frequency resolution (in Hz) is given by .
N
19
Consider an input signal x(n) where
x(n) = 1 for n = 0,1, …7 x(n) = 0 for n > 7
The 32-point DFT is shown below.
9
|X(k)| 5
0
0 5 10 15 20 25 30
Frequency index, k 20
8
4
|X(k)|
3
0
0 1 2 3 4 5 6 7
Normalized Frequency w 0-2pi
Ω0 Ω1 Normalized frequency, Ω (rad)
21
Information on sampling frequency is required for this type of plot.
Suppose sampling frequency = 1000Hz
8
5
|X(k)|
4
0
0 100 200 300 400 500 600 700 800 900 1000
L L
−∞ ∞
n
0 1 ……. N-1
0 1 2 3 4 0 1 2 3 4 0 1 2 3 4
2π
undergo a phase shift of − kno
N
27
Symmetric Properties
• If x[n] is real-valued, then X(k) is conjugate
symmetric.
• Practical signal is real.
• Stated in different ways
X(k) = X*(-k) = X*(N-k)
X(N-k) = X*(k)
X[k]
k Real Imaginary
0 3.0000 0
1 2.1126 -0.7606
2 5.5048 2.6934
3 -2.1174 -4.6815
4
5
6
29
Solution
X[k]
k Real Imaginary
0 3.0000 0
1 2.1126 -0.7606
2 5.5048 2.6934
3 -2.1174 -4.6815
4 -2.1174 4.6815
5 5.5048 -2.6934
6 2.1126 0.7606
N −1
yC [n] = g [m]h[ n − m N
] = g[n] N h[n]
m =0
[1 2 0 1] [1 2 0 1] [1 2 0 1]
[1 1 2 2] [1 1 2 2] [1 1 2 2]
[0 2 0 2] 4 [0 0 0 1] 1 [0 0 0 1] 1
33
Making Linear Convolution Equal to Circular
Convolution
• If the length of g[n] is N1 and the length of h[n] is N2 then
linear convolution between g[n] and h[n] will produce a
sequence of length N1 + N2 - 1.
34
Example : Extend the sequences g[n] and h[n] to length 7 as follows
g [n], 0 ≤ n ≤ 3 h[n], 0 ≤ n ≤ 3
g e [n] = he [n] =
0, 4≤n≤6 0, 4≤n≤6
[1 2 0 1 0 0 0] [1 2 0 1 0 0 0] [1 2 0 1 0 0 0]
he[-m7] [ 2 0 0 0 1 1 2 ] he[1-m7] [ 2 2 0 0 0 1 1 ] he[2-m7] [ 1 2 2 0 0 0 1 ]
[2 0 0 0 0 0 0] 2 [2 4 0 0 0 0 0] 6 [1 4 0 0 0 0 0] 5
[1 2 0 1 0 0 0] [1 2 0 1 0 0 0]
he[3-m7] [ 1 1 2 2 0 0 0 ] he[4-m7] [ 0 1 1 2 2 0 0 ]
[1 2 0 2 0 0 0] 5 [0 2 0 2 0 0 0] 4
[1 2 0 1 0 0 0] [1 2 0 1 0 0 0]
he [5-m7] [ 0 0 1 1 2 2 0 ] he[6-m7] [ 0 0 0 1 1 2 2 ]
[0 0 0 1 0 0 0] 1 [0 0 0 1 0 0 0] 1
36
c) Compute the product Y[k] = Ge[k] He[k] for 0 ≤ k ≤ M - 1.
d) Obtain y[n] by computing the inverse DFT of Y[k].
37
Example: Linear Convolution Using DFT
Given
g[n] = [1 2 0 1] (N1 = 4) and h[n] = [2 2 1 1] (N2 = 4)
Find the linear convolution between g[n] and h[n] through the
DFT.
Solution
38
b) Compute Ge[k] and
Ge[k] = [4.0 1.3 – 2i 1.2 - 1.2i -1.0 - 1.8i
-1.0 + 1.8i 1.2 + 1.2i 1.3 + 2i ]
He[k] = [6.0 2.1- 3i 1.3 - 0.7i 0.6 - 1.0i
0.6 + 1i 1.3 + 0.7i 2.1 + 3i ]
c)
Y[k] = Ge[k] He[k]
[24.0000 -3.0794 - 8.2428i 0.6479 - 2.3573i -2.5685 - 0.0170i
-2.5685 + 0.0170i 0.6479 + 2.3573i -3.0794 + 8.2428i]
d) Inverse DFT
yL[n] = [2 6 5 5 4 1 1]
39
Relation Between DTFT and DFT
DTFT DFT
∞ N −1 2π
Xe( )=
jΩ
x[n]e − jΩn
X [k ] = x[n] e
−j
N
kn
n = −∞ n =0
(
X [k ] = X e jΩ k ) Ωk =
2 πk k = 0 ,1, K , N − 1
N
40
• Let X(ejΩ) be the DTFT of a length-N sequence x[n]. We wish to
evaluate X(ejΩ) at Ωk = 2πk/M, k = 0, 1, …, M-1 where M >> N.
N −1 N −1
X (Ω k ) = x[n]e − jΩ k n
= x[n ]e − j 2πkn M
n =0 n =0
n =0
9
X[k]
8
7
X[Ω]
Magnitude
6
M agnitude
4
DFT
0
0 0.2 0.4 0.6 0.8 1
Norm alis ed angular frequency
42
• As we have seen previously, the DTFT is usually approximated by
zero-padding a sequence x[n] before applying DFT.
• Note that zero-padding gives us a high-density spectrum and
provides a better displayed version for plotting. But it DOES NOT
give us a high-resolution spectrum because no new information is
added to the signal; only additional zeros are added in the data.
• To get a high-resolution spectrum, one has to obtain more data
from the experiment or observations.
2
N = R = 10
1
x(n) 0
-1
-2
0 1 2 3 4 5 6 7 8 9 10
n
Samples of DTFT Magnitude
10
DFT Magnitude
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
1
N = 10, R = 50
x(n) 0
-1
-2
0 5 10 15 20 25 30 35 40 45 50
n
DTFT Magnitude
10
DFT Magnitude
8
Cannot detect the 2
6 frequencies in x[n]
4
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
-1
-2
0 10 20 30 40 50 60 70 80 90 100
n
DTFT Magnitude
10
Still cannot detect the
DFT Magnitude
8
2 frequencies in x[n]
6
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
1
x(n) 0
-1
-2
0 10 20 30 40 50 60 70 80 90 100
n
DTFT Magnitude
60
DFT Magnitude
N = R = 100
40
Resolution is
sufficient to detect the
20 2 frequencies in x[n]
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
1
N = 100, R = 200
x(n) 0
-1
-2
40
Higher density plot
20
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
2
N = 100, R = 500
1
x(n) 0
-1
-2
40
20
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
Ideally, the spectrum is computed by using as many samples of signal x[n] as possible
but due to memory limitation, the samples need to be truncated. This is done by
multiplying x[n] with the window function w[n].
This produces a spectrum that is distorted due to convolution of the sinc function
with the impulse function located at the frequencies present in the signal x[n].
Distorted
spectrum, DTFT
of windowed
Ideal signal. DFT is
spectrum obtained by
sampling this
DTFT.
50
Fast Fourier Transform (FFT)
51
There are many ways to measure the complexity of an algorithm.
Computational complexity can be measured by the number of
arithmetic multiplications and additions.
In terms of multiplications and additions, FFT algorithms can be
of orders of magnitude more efficient than competing algorithms.
The efficiency of FFT is so high that in many cases the most
efficient way of implementing convolution is by transforming the
sequences involved, multiplying the transform results and inverse-
transforming the product back to the time-domain.
.
52
N −1
DFT of length N X [k ] = x[n]WNkn , k = 0,1,K , N − 1
n =0
53
Most approaches to improving the efficiency of DFT computation
exploit the symmetry and periodicity properties of WNkn :
WN = e − j 2π N
1
2 - point DFT : X [k ] = x [n ] e − j 2πkn 2
k = 0,1
n =0
x(0)
x(1)
X [k ] = x[n ]
W nk
N + x[n ]
W nk
N
n even n odd
56
WN2 = e −2 j (2π N)
= e − j 2π ( N 2 ) = WN 2
( N 2 )−1 ( N 2 )−1
X [k ] = x[2r ]WNrk 2 + WNk x[2r + 1]WNrk 2
=0 42443
1r 4 =0 442444
1r 4 3
G [k ] H [k ]
H[0]
x[1] WN4
X[4]
H[1]
x[3] (N/2)-point WN5
X[5]
Odd H[2]
samples
x[5] DFT X[6]
WN6
H[3]
x[7] WN7
X[7]
( N 4 )−1 ( N 4 )−1
Similarly, H [k ] = h[
l =0
2l ]W lk
N 4 + W k
N 2 h[
l =0
2l + 1]W lk
N 4
x[0] X[0]
WN0 WN0 WN0
x[4] X[1]
WN4 WN2 WN1
x[2] WN4 X[2]
WN0 WN2
x[6] X[3]
WN4 WN6 WN3
63
Complete flow graph of the decimation-in-time decomposition of an N-point
DFT computation into four (N/4)-point DFT computations (N=8) after
consideration of the following property :
WNN 2 = e − j ( 2π N )N 2
= e − jπ = −1
WNr + N 2 = WNN 2WNr = −WNr
x[0] X[0]
WN0
x[4] X[1]
-1
WN0
x[2] -1
X[2]
WN0 WN2
x[6] X[3]
-1 -1
WN0
x[1] X[4]
-1
WN0 WN1
x[5] X[5]
-1 WN0 WN2 -1
x[3] -1
X[6]
WN0 WN2 -1 WN3
x[7] X[7]
-1 -1 -1
x(0) 2-point
x(4) DFT Combine X(0)
2-point X(1)
x(2) 2-point DFT's X(2)
x(6) DFT Combine
X(3)
x(1) 2-point 4-point X(4)
x(5) DFT Combine DFT's X(5)
2-point
x(3) 2-point X(6)
x(7) DFT DFT's X(7)
65
For the general case of N being power of 2, we can apply the FFT
technique by decomposing the N-point DFT into (N/2)-point
DFTs and then into (N/4)-point DFTs and continue until we are
left with 2-point DFTs.
The computational saving resulting from the decomposition is as
follows:
N-point (N/2)-point (N/4)-point 2-point
DFT DFT DFT DFT
N2 N + 2(N/2)2 2N + 4(N/4)2 N log2N
No. of complex
Since N = 2v, there can only be v = log2N no. of times
multiplications
decomposition can be carried out. Thus we get total of
& additions
N.v = N log2N complex multiplications & additions.
For large N this represents a significant reduction in
computation compared to the N2 operations required for
the DFT. For example if N=1024, the computational
reduction is 102 times.
66
FFT Input/Output Data Index Bit Reversal
Let’s look into some of the special properties of the FFT that are
important to FFT software developers and FFT hardware
designers.
The decimation-in-time phrase refers to how we divided the DFT
input samples into odd and even parts in the derivation of FFT.
This time decimation leads to the scrambled order of the input
data’s index n.
The pattern of this shuffled order can be understood with the help
of the table shown in next slide.
The shuffling of the input data is known as bit reversal because
the scrambled order of the input data index can be obtained by
reversing the bits of the binary representation of the normal input
data index order.
67
Notice the normal index order in the left column of the above
table and the scrambled order in the right column that
corresponds to the final decimated input index order in
decimation-in-time FFT.
68
Example: Compute the DFT of x(n) = [1 2 3 4]
using FFT.
Solution
69
1+3=4 4 X[0]=4+6=10
x[0]=1
1-3=-2 -2 X[1]=-2+2j
x[2]=3
2+4=6 6 X[2]=4-6=-2
x[1]=2
2-4=-2 2j X[3]=-2-2j
x[3]=4
W40 = 1 W41 = e − j 2π 4 = − j
70
FFT Algorithm : Decimation-in-Frequency
Besides decimation-in-time, we can also divide X[k] into smaller
and smaller subsequences in the same manner as before:
decimation-in-frequency algorithms.
We can express X[k] as follows:
( N / 2) −1
X [2r ] = ( x[n] + x[ n + ( N / 2)])WNrn/ 2 , r = 0, 1, ..., ( N / 2) - 1
n =0
( N / 2) −1
X [2r + 1] = ( x[n] − x[ n + ( N / 2)])WNnWNrn/ 2 , r = 0, 1, ..., ( N / 2) - 1
n =0
71
72