0% found this document useful (0 votes)
29 views

Handout - 6 The Discrete Fourier Transform

Uploaded by

mohammadtestpi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Handout - 6 The Discrete Fourier Transform

Uploaded by

mohammadtestpi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Digital Signal Processing

The Discrete Fourier


Transform (DFT)
Overview
• Introduction
• Definition of the DFT
• Properties of the DFT
Introduction
• In previous chapters, we have seen how to represent a
sequence in terms of a linear combination of complex
exponentials using the discrete-time Fourier transform (DTFT)
• Also, we used the sequence values as the coefficients in a
power series expansion of a complex-valued function of z.
• Practically, the DTFT and the z-transform are
– Defined for infinite-length sequences
– Functions of continuous variable (𝜔 or z)
– Not numerically computable transforms because we have to
evaluate infinite sums at uncountably infinite frequencies
• For finite-length sequences there is another representation,
called the discrete Fourier transform (DFT).
• DFT is very useful for digital computations and for digital
hardware implementations.
Definition of the DFT
• Unlike the DTFT, which is a continuous function of a continuous
variable, 𝜔, the DFT is a sequence that corresponds to samples
of the DTFT. It is defined as
𝑋[𝑘] ≝ DFT 𝑥[𝑛] = 𝑋(𝜔)ቚ
𝜔=2𝜋𝑘/𝑁

• The DFT of a signal 𝑥[𝑛] is defined as


𝑁−1 𝑁−1 where
2𝜋𝑘𝑛 2𝜋𝐾𝑛
−𝑗 𝑁
𝑋[𝑘] = ෍ 𝑥[𝑛]𝑒 = ෍ 𝑥[𝑛]𝑊𝑁𝑘𝑛 𝑊𝑁𝐾𝑛 = 𝑒 −𝑗 𝑁

𝑛=0 𝑛=0 𝑘 = 0,1, ⋯ , 𝑁 − 1


n= 0,1,⋯, 𝑁−1
• The inverse DFT (IDFT) is given by
𝑁−1 𝑁−1
1 2𝜋𝑘𝑛
𝑗 𝑁 1
𝑥[𝑛] = IDFT 𝑋[𝑘] = ෍ 𝑋[𝑘]𝑒 = ෍ 𝑋[𝑘]𝑊𝑁−𝑘𝑛
𝑁 𝑁
𝑘=0 𝑘=0
Definition of the DFT
• If we represent the sequence 𝑥[𝑛] as an N-point vector x and its
DFT by the N-point vector 𝐗, then we can express the DFT and
IDFT in a matrix form as follows
𝑋[0] 𝑥[0]
𝑋[1] 𝑥[1] 1 ∗
𝐗= = 𝐖𝑁 𝐱 𝐱= = 𝐖𝑁 𝐗
⋮ ⋮ 𝑁
𝑋[𝑁 − 1] 𝑥[𝑁 − 1]

Where the transform matrix 𝐖𝑁 is defined as


1 1 1 ⋯ 1 Note that:
1 𝑊𝑁 𝑊𝑁2 ⋯ 𝑊𝑁𝑁−1
2(𝑁−1) 1 𝐻 1 ∗
𝐖𝑁 = 1 𝑊𝑁2 𝑊𝑁4 ⋯ 𝑊𝑁 𝐖𝑁−1 = 𝐖𝑁 = 𝐖𝑁
⋮ ⋮ ⋮ ⋱ ⋮ 𝑁 𝑁
2(𝑁−1) (𝑁−1)(𝑁−1)
1 𝑊𝑁𝑁−1 𝑊𝑁 ⋯ 𝑊𝑁
Definition of the DFT
Example:
Compute the 4-point (𝑁 = 4) DFT of the sequence
𝑥[𝑛] = 1, 2, 3
Solution:
We have to pad the sequence with one zero to become
𝑥[𝑛] = 1, 2, 3, 0
1 1 1 1 1
1 −𝑗 −1 𝑗 2
𝐖4 = and 𝐱=
1 −1 1 −1 3
1 𝑗 −1 −𝑗 0
6
−2 − 2𝑗
therefore 𝐗 = 𝐖4 𝐱 =
2
−2 + 2𝑗
1
Note (IDFT): Given X[K]. Find x[n] --------x[n]=𝑁 𝐖𝑁∗ X
Definition of the DFT
Computational Complexity of the DFT
• According to its definition, the DFT requires:
▪ 𝑁 2 complex multiplications
▪ 𝑁(𝑁 − 1) complex additions
• Computing DFT directly from the definition is inefficient due to
the high computational complexity of 𝑂(𝑁 2 ) arithmetical
operations.
• A more simplified and efficient method to compute the same
DFT is called the Fast Fourier Transform (FFT). It drastically
reduces the computational complexity to 𝑂(𝑁 log 2 𝑁)
operations.
• Matlab uses the FFT method to compute the DFT.
Definition of the DFT
• Mathematically, the sampling of the DTFT results in a periodic
sequence 𝑥[𝑛] of a period 𝑁 too.
• Therefore, both 𝑥[𝑛] and 𝑋[𝑘] are now 𝑁-point periodic
sequences of period 𝑁.
• If 𝑥[𝑛] has a length 𝑁1 < 𝑁, we should append it with (𝑁 − 𝑁1 )
zero samples to calculate the 𝑁-point DFT. This is called zero
padding. So, the variables 𝑛 and 𝑘 are restricted to the range:
0 ≤ 𝑛, 𝑘 ≤ 𝑁 − 1
• The zero padding gives a high-density spectrum and provides a
better displayed version for plotting. However, zero padding
does not give a higher resolution spectrum because no new
information is added to the signal.
• To get higher resolution spectrum, one has to obtain more data
from the experiment or observations (increase 𝑁).
Properties of the DFT
Circular Shifting
Since both 𝑥[𝑛] and 𝑋[𝑘] are periodic of period 𝑁, their shifts are circular.
They are denoted as 𝑥 𝑛 − 𝑛0 𝑁 and 𝑋 𝑘 − 𝑘0 𝑁 , respectively. The
modulo-𝑵 notation 𝑚 𝑁 means that (remainder)
m modulo N , 𝑚 𝑁 = 𝑚 + 𝑖𝑁
for some integer 𝑖 such that
0≤ 𝑚 𝑁 ≤ 𝑁 − 1.
𝑭𝒐𝒓 𝒆𝒙𝒂𝒎𝒑𝒍𝒆: 12 8 =rem(12,8)=4 , −12 8 = −12 + 8 8 = ‫ۦ‬−12 +
2𝑥8ۧ8 = 4 8
Note : Make sure the # inside is positive, if not, multiply N by 2,3….
𝑭𝒐𝒓 𝒆𝒙𝒂𝒎𝒑𝒍𝒆: −20 + 3𝑥8 8 = 4 8
Therefore : 12 8 = 4 8 = −12 8 = −4 8 = −20 8

and 𝑅𝑁 [𝑛] is an 𝑁-point rectangular window defined as


1, 0≤𝑛 ≤𝑁−1
𝑅𝑁 [𝑛] = ቊ
0, otherwise
Circular Shifting
𝑬𝒙𝒂𝒎𝒑𝒍𝒆: given x[n]={1,2,3,4} and N=4
Circular shift by 1 sample is:
y[n] = 𝑥 𝑛 − 𝑛0 4

y[0] =𝑥 0−1 4 =𝑥 −1 + 4 4 = 𝑥 3 4 = 𝑥 3 =4
y[1] =𝑥 1−1 4 =𝑥 0 4 = 𝑥 0 =1
y[2] =𝑥 2−1 4 =𝑥 1 4 = 𝑥 1 =2
y[3] =𝑥 3−1 4 =𝑥 2 4 = 𝑥 2 =3
Properties of the DFT
Illustration of circular shift:

8-points sequence Circular shift by 2 samples

𝒏=𝟎 𝒏=𝟎
7 1 7 1

6 2 6 2

5 3 5 3
4 4
Properties of the DFT
Example of circular shift:

4-points sequence Circular shift by 1


𝑥[𝑛] 𝑥[ 𝑛 − 1 4 ]

Circular shift by 2 Circular shift by 3


𝑥[ 𝑛 − 2 4 ] 𝑥[ 𝑛 − 3 4 ]
Properties of the DFT
Circular Folding
Similarly, circular folding is different than linear folding in using the
module-𝑁 notation operation. If an 𝑁-point sequence, 𝑥[𝑛] is
circularly folded, then
𝑥[0] 𝑛=0
𝑥 −𝑛 𝑁 = ቊ
𝑥[𝑁 − 𝑛] 1 ≤ 𝑛 ≤ 𝑁 − 1

Example of circular folding: X(n)=[1,-1,1,0], X(-n)=[1,0,1,-1] see next (circle)


𝑥[𝑛]
𝑥 −𝑛 4
Properties of the DFT
Illustration of circular fold:

8-points sequence Circular fold

𝑛=0 𝑛=0
7 1 1 7

6 2 2 6

5 3 3 5
4 4
Properties of the DFT
1. Linearity:
𝐷𝐹𝑇
𝑎1 𝑥1 [𝑛] + 𝑎2 𝑥2 [𝑛] 𝑎1 𝑋1 [𝑘] + 𝑎2 𝑋[𝑘]
2. Time Shifting
𝐷𝐹𝑇 𝑘𝑛 2𝜋
𝑥 𝑛 − 𝑛0 𝑁 𝑊𝑁 0 𝑋[𝑘] 𝑊𝑁 = 𝑒 −𝑗 𝑁

3. Frequency Shifting
−𝑛𝑘0 𝐷𝐹𝑇
𝑊𝑁 𝑥[𝑛] 𝑋 𝑘 − 𝑘0 𝑁

4. Circular Convolution
𝑁−1
𝐷𝐹𝑇
𝑥1 𝑛 ⊛ 𝑥2 𝑛 = ෍ 𝑥1 𝑚 𝑥2 𝑛 − 𝑚 𝑁 𝑋1 [𝑘]𝑋2 [𝑘]
𝑚=0
Properties of the DFT
Example of Circular Convolution
Perform the 4-point circular convolution of the following sequences
ℎ[𝑛] =[1,-1,1,0] 𝑥[𝑛] =[1,2,3,3]

ℎ −𝑚 4 =[1,0,1,-1]
3

𝑦 𝑛 = ෍ 𝑥 𝑚 ℎ[ 𝑛 − 𝑚 4 ]
𝑚=0

𝑦[0] = σ3𝑘=0 𝑥 𝑚 ℎ[ −𝑚 4 ] = 1x1+2x0+3x1+3x-1=1


Properties of the DFT
Example of Circular Convolution (cont.) 𝑥[𝑛] =[1,2,3,3]
Similarly
3

𝑦 1 = ෍𝑥 𝑚 ℎ 1−𝑚 4 =
𝑘=0

= 1𝑥(−1) + 2𝑥1 + 3𝑥0 + 3𝑥1 = 4


ℎ[ 1 − 𝑚 4 ] =[-1,1,0,1]

𝑦[2] = ෍ 𝑥 𝑚 ℎ[ 2 − 𝑚 4 ] = 2
𝑘=0
3

𝑦[3] = ෍ 𝑥 𝑚 ℎ[ 3 − 𝑚 4 ] = 2 Note:CW
𝑘=0
Thus,
𝑦[𝑛] = ℎ[𝑛] ⊛ 𝑥[𝑛] = 𝛿[𝑛] + 4𝛿[𝑛 − 1] + 2𝛿[𝑛 − 2] + 2𝛿[𝑛 − 3]
Properties of the DFT
Circular Convolution Using Tabular Method 𝑥[𝑛]
𝑥[𝑛]
1 2 3 3
1 1 2 3 3 1 2 3 3
-1 -1 -2 -3 -3 -1 -2 -3 -3
ℎ[𝑛]

1 1 2 3 3 1 2 3 3 ℎ[𝑛]
0 0 0 0 0 0 0 0 0

𝑦[𝑛] 1 4 2 2

𝑦[𝑛] = ℎ[𝑛] ⊛ 𝑥[𝑛] = 𝛿[𝑛] + 4𝛿[𝑛 − 1] + 2𝛿[𝑛 − 2] + 2𝛿[𝑛 − 3]


Matlab Commands
circshift Shift array circularly
fft Discrete Fourier transform using the FFT technique
fftshift Shift zero-frequency component to center of spectrum
ifft Inverse Discrete Fourier transform using the FFT technique

You might also like