Chapter 2 Part 2
Chapter 2 Part 2
2
2.4 DFT – Definition and Equations
• The simplest relation between an N-length sequence , defined for
and its DTFT is obtained by uniformly sampling on the -axis at
3
2.4 DFT – Definition and Equations
• DFT: (2.6)
Let , then
(2.7)
• Inverse DFT:
(2.8)
4
2.4 DFT – Definition and Equations
5
2.4 DFT - Energy and power spectrum
• The energy of the spectrum
2
E xx (k ) X (k )
6
2.4 DFT - Computation
7
2.4 DFT - Computation
8
2.4 DFT – Twiddle factor
2.4 DFT – Example 1
• Find the twiddle factors for an eight-point DFT
2.4 DFT – Example 2
Find DFT of the sequence x[n]={1,0,1,0}
2.4 DFT – Example 3
Find DFT of the sequence x(n)={1,2,1,1}
Solution:
Step 1: Find a twiddle factor of 4 point DFT
x(n) x(n)
k=0 k=0 1 1 1 1
k=1 k=1 1 -j -1 j
X(k) X(k)
k=2 k=2 1 -1 1 -1
k=3 k=3 1 j -1 -j
2.4 DFT – Example 3
•
2.4 DFT – Example 4
A finite duration sequence with a length of eight has a DFT of as shown
below.
• This means that the 16-point DFT should contain two copies of the 8-
point DFT of and has a period of 8. The DFT as a function of is shown
below:
2.4 DFT – Example 5
A discrete frequency representation of a sample size of 16 are
given as below
X ( k ) 16 k 0
8 k 1
8 k 15
0 elsewhere
17
2.4 DFT – Example 5
By applying the inverse equation, the discrete-time representation is:
Since
18
2.4 DFT – Basic properties
19
2.4 DFT – Linear convolution (revisit)
Linear convolution between two N-length sequences, and results in a (2N-1)-
length sequence, :
20
2.4 DFT – Circular convolution
• To develop a convolution-like operation resulting in a N-length
sequence , we need to define a circular time-reversal and then
apply a circular time-shift.
• The resulting operation is called circular convolution.
• Let represent the circular convolution of the sequences and , then
is given as:
(2.9)
21
2.4 DFT – Example 6
Perform linear and circular convolution between
g[n] = [1 2 0 1] and h[n] = [2 2 1 1].
Linear convolution :
[1 2 0 1] [1 2 0 1] [1 2 0 1] [1 2 0 1]
[1 1 2 2] [1 1 2 2] [1 1 2 2] [1 1 2 2]
[2 0 0 0] 2 [2 4 0 0] 6 [1 4 0 0]5 [1 2 0 2] 5
[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
22
2.4 DFT – Example 6 𝑁 −1
Circular convolution : 𝑦 𝑐 [ 𝑛 ] = ∑ 𝑔 [ 𝑚 ] h [ ⟨ 𝑛− 𝑚 ⟩ 𝑁 ]
𝑚=0
g[n] = [1 2 0 1] and h[n] = [2 2 1 1].
[1 2 0 1] [1 2 0 1] [1 2 0 1] [1 2 0 1]
[ 2 1 1 2 ] h[1-m4] [ 2 2 1 1 ] h[2-m4] [ 1 2 2 1 ] h[3-m4] [ 1 1 2 2 ] h[-m4]
[2 2 0 2] 6 [2 4 0 1] 7 [1 4 0 1] 6 [1 2 0 2] 5
Why the answer is We need to apply zero padding to it before applying a circular
not similar? convolution
23
2.4 DFT – Example 6
Extend the sequence g[n] and h[n] to length 7 as follows:
[1 2 0 1 0 0 0] [1 2 0 1 0 0 0]
[2 0 0 0 1 1 2] he[1-m7] [2 2 0 0 0 1 1] he[2-m7]
[2 0 0 0 0 0 0] 2 [2 4 0 0 0 0 0] 6
[1 2 0 1 0 0 0] [1 2 0 1 0 0 0]
[1 2 2 0 0 0 1] he[3-m7] [ 1 1 2 2 0 0 0 ] he[4-m7]
[1 4 0 0 0 0 0] 5 [1 2 0 2 0 0 0] 5
24
2.4 DFT – Example 6
[1 2 0 1 0 0 0] [1 2 0 1 0 0 0]
[0 1 1 2 2 0 0] he [5-m7] [0 0 1 1 2 2 0] he[6-m7]
[0 2 0 2 0 0 0] 4 [0 0 0 1 0 0 0] 1
[1 2 0 1 0 0 0]
[ 0 0 0 1 1 2 2 ] he[-m7]
[0 0 0 1 0 0 0] 1
25
2.4 DFT – Example 7
h(n)
x(n).h(n)
2 2 1 1
1 2 2 1 1
2 4 4 2 2
x(n) 3 6 6 3 3
0 0 0 0 0
1 2 2 1 1
2.4 DFT – Example 7
h(n)
x(n).h(n)
2 2 1 1
1 2 2 1 1
2 4 4 2 2
x(n) 3 6 6 3 3
0 0 0 0 0
1 2 2 1 1
2.4 DFT – Example 7
2.4 DFT – Exercise (ULearn)
29
2.4 DFT – Linear vs Circular convolution
Note that the results of linear and circular convolution are different.
For starters, they are not even of equal length: For two sequences of
length N and M, the linear convolution is of length N+M-1, whereas its
circular convolution is of length max(N, M), where the shorter sequence
is zero padded to make it the same length as the longer one.
All LTI systems are based on the principle of linear convolution, as the
output of an LTI system is the linear convolution of the system impulse
response and the input to the system, which is equivalent to the
product of the respective DTFTs in the frequency domain.
DTFT is based on linear convolution whereas DFT is based on circular
convolution.
30
2.4 DFT – Linear vs Circular convolution
Is there any relationship between the linear and circular convolutions?
Yes!
Fact: if we zero pad both sequences x[n] and h[n], so that they are both
of length N+M-1, then linear convolution and circular convolution result
in identical sequences.
The inverse DFT of X(k)•H(k) is the circular convolution of x[n] and h[n].
If they are zero padded, then the inverse DFT is the linear convolution
of the two.
I.e. if the respective DFTs of the zero padded sequences are X(k) and
H(k), then the inverse DFT of X(k)•H(k) is equal to the linear convolution
of x[n] and h[n].
31
2.4 DFT - Computing Convolution using DFT
• We can compute the convolution using the inverse DFT of X(k)•H(k)
since it is equal to the linear convolution of x[n] and h[n].
• It is often more computationally efficient to compute the DFTs of X(k)
and H(k), multiply them, and take the inverse DFT than to compute
the convolution in time domain:
• However, the IDFT gives the circular convolution. To ensure that one
gets linear convolution, both sequences in the time domain must be
zero padded to appropriate length.
32
2.4 DFT – Example 8
x[n]
k=0 1 1 1 1
k=1 1 -j -1 j
X(k)
k=2 1 -1 1 -1
k=3 1 j -1 -j
2.4 DFT – Example 8
x(n)
k=0 1 1 1 1
k=1 1 j -1 -j
X(k)
k=2 1 -1 1 -1
k=3 1 -j -1 j
35
2.5 Fast Fourier Transform (FFT)
DFT plays an important role in analysis, design and implementation
of discrete-time signal processing algorithms and systems.
One major problem with the DFT is its extremely high
computational requirement, thus it is important to have an
efficient algorithm to compute DFT.
A number of algorithms have been developed for that purpose and
they are collectively known as Fast Fourier Transform (FFT)
algorithms.
There are many ways to measure the complexity and efficiency of
an implementation or algorithm.
36
2.5 Fast Fourier Transform (FFT)
We normally use the number of arithmetic multiplications and
additions as a measure of computational complexity.
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 the transforming
the sequences involved, multiplying the transform results and
inverse-transforming the product back to time-domain.
37
2.5 Fast Fourier Transform (FFT)
Recall that the DFT of a finite-length sequence of length N is
defined as
38
2.5 Fast Fourier Transform (FFT)
I.e. the amount of computation and the corresponding
computation time for DFT is proportional to N2.
The number of arithmetic operations required becomes very large
for large values of N, e.g., if N = 1000, one million arithmetic
operations are required!
One way to improve the efficiency of DFT computation is to exploit
the symmetry and periodicity properties of :
39
2.5 Fast Fourier Transform (FFT)
By taking these two properties as the twiddle factor, it is possible
to reduce the number of operations to approximately Nlog2N.
Algorithms that do this are called Fast Fourier Transforms (FFT).
FFT algorithms are based on the fundamental principle of
decomposing the computation of DFT of a length-N sequence into
successively smaller DFTs.
Initially, an N-point DFT can be decomposed into two (N/2)-point
DFTs.
Each (N/2)-point DFT can be further decomposed into two (N/4)-
point DFTs, and so on, until a set of (N/2) 2-point DFTs is
obtained.
40
2.5 FFT - Mathematics
Break a signal of N samples into two subsequences with N/2
samples (decimation in time)
One sequence contains samples with even-numbered values of
n, the other contains those with odd-numbered values of n.
Writing n(even) = 2m and n(odd) = 2m +1, we have DFT of:
41
2.5 FFT - Mathematics
(2.10)
42
2.5 FFT - Mathematics
Computation of Eq. (2.10) is generally broken down into N/2 so called
“butterfly operations”
Example: N = 8, and we consider the case of k = 1 and k = N/2 +1 = 5:
43
2.5 FFT - Mathematics
Time decimated FFT, N = 8
44
2.5 FFT - MATLAB
n=0:31; k=0:31 ;
x=0.9. "n;
w=linspace(0, 2*pi, 512);
k=linspace(0, 2"pi, 32);
X1 =1 ./(1-0.9*exp(-j*w));
X2=(1-(0.9*exp(-j*(2*pi/32)*k)). "32)./
(1-0.9*exp(-t(2"pi/32)*k));
X=fft(x);
subplot(311)
plot(w, abs(X1 )); grid
subplot(312)
stem(k, abs(X2), 'r', 'filled'); grid
subplot(313)
stem(k, abs(X), 'g', 'filled'); grid
Findings: (1) DFT is indeed the sampled version of DTFT and (2) DFT and
FFT produce identical results
45