DSP Module 3
DSP Module 3
Linear filtering methods based on the DFT: Use of DFT in Linear Filtering, Filtering
of Long data Sequences. Fast-Fourier-Transform (FFT) algorithms: Efficient Computation of
the DFT: Radix-2 FFT algorithms for the computation of DFT and IDFT-decimation-in-time
and decimation-in-frequency algorithms.
2.1 Introduction
Linear filtering is one of the most powerful image enhancement methods. It is a process
in which part of the signal frequency spectrum is modified by the transfer function of the
filter. Linear filtering of a signal can be seen as a controlled scaling of the signal components
in the frequency domain. DFT provides an alternative approach to time domain convolution.
It can be used to perform linear filtering in frequency domain. The advantage is that, having
knowledge of faster DFT techniques likes of FFT, a computationally higher efficient algorithm
can be developed for digital computer computation in comparison with time domain approach.
where h(n) is the impulse response of the FIR filter. The output sequence y(n) of the FIR
filter can be expressed in the time domain as the convolution of x(n) and h(n), that is
M
X −1
y(n) = h(k)x(n − k)
k=0
37
38 Module-2
Since h(n) and x(n) are finite-duration sequences, their convolution is also finite in duration.
In fact, the duration of y(n) is L + M − 1. The frequency-domain equivalent is
Y (ω) = X(ω)H(ω)
If the sequence y(n) is to be represented uniquely in the frequency domain by samples of its
spectrum Y (w) at a set of discrete frequencies, the number of distinct samples must equal or
exceed (L + M − 1). Therefore, a DFT of size N ≥ L + M − 1 is required to represent y(n)
in the frequency domain. Now if,
Y (k) = Y (ω)|ω=2πk/N ; k = 0, 1, . . . , N − 1
= X(ω)H(ω)|ω=2πk/N ; k = 0, 1, . . . , N − 1
then,
Y (k) = X(k)H(k); k = 0, 1, . . . , N − 1
The DFT provides an efficient way to calculate the time-domain convolution of two signals.
One of the most important applications of the DFT is calculating the time-domain convolution
of signals. This can be achieved by multiplying the DFT representation of the two signals
and then calculating the inverse DFT of the result as shown in Fig. 2.1.
1 4 3 2 1 15
2 1 4 3 2 12
y(n) = x(n) ⊗4 h(n) = =
3 2 1 4 2 8
4 3 2 1 0 14
1 0 0 4 3 2 1 1
2 1 0 0 4 3 2 4
3 2 1 0 0 4 2 9
y(n) = x(n) ⊗6 h(n) = =
4 3 2 1 0 0 0 14
0 4 3 2 1 0 0 14
0 0 4 3 2 1 0 8
Example 2.2: Obtain linear convolution using circular convolution. Also, verify the result.
x(n) = {1, 1, 0, −1, −1} and h(n) = {1, 2, 3, 2, 1}.
1 0 0 0 0 1 2 3 2 1 1
2 1 0 0 0 0 1 2 3 1 3
3 2 1 0 0 0 0 1 2 0 5
2 3 2 1 0 0 0 0 1 −1 4
y(n) = h(n) ⊗9 x(n) = 1 2 3 2 1 0 0 0 0 −1 = 0
0 1 2 3 2 1 0 0 0 0 −4
0 0 1 2 3 2 1 0 0 0 −5
0 0 0 1 2 3 2 1 0 0 −3
0 0 0 0 1 2 3 2 1 0 −1
Example 2.3: An FIR filter has the impulse response, h(n) = {1, 2, 3}. Determine the
response of the filter to the input sequence, x(n) = {1, 2}. Use DFT and IDFT. Also, verify
the result. .
Digital Signal Processing 41
1 1 1 1 1 3
1 −j −1 j 2 1 − 2j
H(k) = =
1 −1 1 −1 3 −1
1 j −1 −j 0 1 + 2j
1 1 1 1 1 6
1 −j −1 j 2 −2 − 2j
X(k) = =
1 −1 1 −1 0 2
1 j −1 −j 0 −2 + 2j
y(n)={1, 4, 7, 6}
Verification:
x(n) 1 2 3
h(n) 1 2
2 4 6
1 2 3
1 4 7 6
42 Module-2
1. Overlap-add method: Because convolution is linear, the output of a long sequence can
be calculated by simply summing the outputs of each block of the input. In this method,
overlapping the tail of the output from the previous block with the beginning of the
output from the present block.
Input signal:
L L L
x1(n) M-1
zeros
x21(n) M-1
zeros
Output signal: x31(n) M-1
zeros
y1(n)
Add
M-1 points y2(n)
Add
M-1 points y3(n)
2. Overlap-save method: Rather than sectioning the input and then calculating the output
Digital Signal Processing 43
from overlapped outputs from the individual input blocks, we will section the output
and then use whatever part of the input contributes to that output block. This method
has also been called overlap-discard because, rather than adding the overlapping output
blocks, the overlapping portion of the output blocks are discarded.
Input signal:
L L L
M-1
zeros
x1(n)
M-1 point
overlap x21(n)
M-1 point
overlap x31(n)
Output signal:
y1(n)
discard
y2(n)
M-1 points
discard
y3(n)
M-1 points
discard
M-1 points
Example 2.4: Consider a FIR filter with impulse response, h(n) = {3, 2, 1, 1}. If the input
is x(n) = {1, 2, 3, 3, 2, 1, −1, −2, −3, 5, 6, −1, 2, 0, 2, 1}. Find the output using overlap-add
method assuming the length of block as 7.
Solution:
1 0 0 0 3 3 2 3 3
2 1 0 0 0 3 3 2 8
3 2 1 0 0 0 3 1 14
y1 (n) = x1 (n) ⊗7 h(n) = 3 3 2 1 0 0 0 1 = 18
0 3 3 2 1 0 0 0 11
0 0 3 3 2 1 0 0 6
0 0 0 3 3 2 1 0 3
2 0 0 0 −2 −1 1 3 6
1 2 0 0 0 −2 −1 2 7
−1 1 2 0 0 0 −2 1 1
y2 (n) = x2 (n) ⊗7 h(n) = −2 −1 1 2 0 0 0 1 = −5
0 −2 −1 1 2 0 0 0 −4
0 0 −2 −1 1 2 0 0 −3
0 0 0 −2 −1 1 2 0 −2
−3 0 0 0 −1 6 5 3 −9
5 −3 0 0 0 −1 6 2 9
6 5 −3 0 0 0 −1 1 25
y3 (n) = x3 (n) ⊗7 h(n) = −1 6 5 −3 0 0 0 1 = 11
0 −1 6 5 −3 0 0 0 9
0 0 −1 6 5 −3 0 0 5
0 0 0 −1 6 5 −3 0 −1
Digital Signal Processing 45
2 0 0 0 1 2 0 3 6
0 2 0 0 0 1 2 2 4
2 0 2 0 0 0 1 1 8
y4 (n) = x4 (n) ⊗7 h(n) = 1 2 0 2 0 0 0 1 = 9
0 1 2 0 2 0 0 0 4
0 0 1 2 0 2 0 0 3
0 0 0 1 2 0 2 0 1
y1 (n) 3 8 14 18 11 6 3
y2 (n) 6 7 1 −5 −4 −3 −2
y3 (n) −9 9 25 11 9 5 −1
y4 (n) 6 4 8 9 4 3 1
y(n) 3 8 14 18 17 13 4 −5 −13 6 23 11 15 9 7 9 4 3 1
y(n) = x(n) ∗ h(n) = {3, 8, 14, 18, 17, 13, 4, −5, −13, 6, 23, 11, 15, 9, 7, 9, 4, 3, 1}.
Example 2.5: Determine the response of an LTI system with h(n) = {1, −1, 2} for an input
x(n) = {1, 0, 1, −2, 1, 2, 3, −1, 0, 2}. Employ overlap-add method with block length, N = 4.
Solution:
1 0 0 0 1 1
0 1 0 0 −1 −1
y1 (n) = x1 (n) ⊗4 h(n) = =
0 0 1 0 2 2
0 0 0 1 0 0
46 Module-2
1 0 0 −2 1 1
−2 1 0 0 −1 −3
y2 (n) = x2 (n) ⊗4 h(n) = =
0 −2 1 0 2 4
0 0 −2 1 0 −4
1 0 0 2 1 1
2 1 0 0 −1 1
y3 (n) = x3 (n) ⊗4 h(n) = =
0 2 1 0 2 0
0 0 2 1 0 4
3 0 0 −1 1 3
−1 3 0 0 −1 −4
y4 (n) = x4 (n) ⊗4 h(n) = =
0 −1 3 0 2 7
0 0 −1 3 0 −2
0 0 0 2 1 0
2 0 0 0 −1 2
y5 (n) = x5 (n) ⊗4 h(n) = =
0 2 0 0 2 −2
0 0 2 0 0 4
y1 (n) 1 −1 2 0
y2 (n) 1 −3 4 −4
y3 (n) 1 1 0 4
y4 (n) 3 −4 7 −2
y5 (n) 0 2 −2 4
y(n) 1 −1 3 −3 5 −3 3 0 7 0 −2 4
Example 2.6: Find the output of a linear filter, given the impulse response h(n) = {1, 2} and
input, x(n) = {1, 2, −1, 2, 3, −2, −3, −1, 1, 1, 2, −1} using overlap-add method.
Solution:
h(n) = {1, 2}; M = 2
x(n) = {1, 2, −1, 2, 3, −2, −3, −1, 1, 1, 2, −1}
N =M +L−1
N = 2M = 22 = 4
Digital Signal Processing 47
N =M +L−1⇒4=2+L−1⇒L=3
h(n) = {1, 2}; M = 2
x(n) = {1, 2, −1, 2, 3, −2, −3, −1, 1, 1, 2, −1}
N =M +L−1
N = 2M = 22 = 4
N =M +L−1⇒4=2+L−1⇒L=3
x1 (n) = {1, 2, −1, 0} ; y1 (n) = x1 (n) ⊗4 h(n)
x2 (n) = {2, 3, −2, 0} ; y2 (n) = x2 (n) ⊗4 h(n)
x3 (n) = {−3, −1, 1, 0}; y3 (n) = x3 (n) ⊗4 h(n)
x4 (n) = {1, 2, −1, 0} ; y4 (n) = x4 (n) ⊗4 h(n)
h(n) = {1, 2, 0, 0}
1 0 −1 2 1 1
2 1 0 −1 2 4
y1 (n) = x1 (n) ⊗ h(n) = =
−1 2 1 0 0 3
0 −1 2 1 0 −2
2 0 −2 3 1 2
3 2 0 −2 2 7
y2 (n) = x2 (n) ⊗ h(n) = =
−2 3 2 0 0 4
0 −2 3 2 0 −4
−3 0 1 −1 1 −3
−1 −3 0 1 2 −7
y3 (n) = x3 (n) ⊗ h(n) = =
1 −1 −3 0 0 −1
0 1 −1 −3 0 2
1 0 −1 2 1 1
2 1 0 −1 2 4
y4 (n) = x4 (n) ⊗ h(n) = =
−1 2 1 0 0 3
0 −1 2 1 0 −2
48 Module-2
y1 (n) 1 4 3 −2
y2 (n) 2 7 4 −4
y3 (n) −3 −7 −1 2
y4 (n) 1 4 3 −2
y(n) 1 4 3 0 7 4 −7 −7 −1 3 4 3 −2
Example 2.7: Find the output of a linear filter given the impulse response h(n) = {1, 2} and
input, x(n) = {1, 2, −1, 2, 3, −2, −3, −1, 1, 1, 2, −1} using overlap-save method.
Solution:
x1 (n) 0 1 2 −1
x2 (n) −1 2 3 −2
x3 (n) −2 −3 −1 1
x4 (n) 1 1 2 −1
x5 (n) −1 0 0 0
0 −1 2 1 1 −2
H
H
1 0 −1 2 2 1
y1 (n) = x1 (n) ⊗4 h(n) = =
2 1 0 −1 0 4
−1 2 1 0 0 3
−1 −2 3 2 1 −5
H
H
2 −1 −2 3 2 0
y2 (n) = x2 (n) ⊗4 h(n) = =
3 2 −1 −2 0 7
−2 3 2 −1 0 4
−2 1 −1 −3 1 0A
−3 −2 1 −1 2 −7
y3 (n) = x3 (n) ⊗4 h(n) = =
−1 −3 −2 1 0 −7
1 −1 −3 −2 0 −1
1 −1 2 1 1 −1
H
H
1 1 −1 2 2 3
y4 (n) = x4 (n) ⊗4 h(n) = =
2 1 1 −1 0 4
−1 2 1 1 0 3
−1 0 0 0 1 −1
H
H
0 −1 0 0 2 −2
y5 (n) = x5 (n) ⊗4 h(n) = =
0 0 −1 0 0 0
0 0 0 −1 0 0
y1 (n) 1 4 3
y2 (n) 0 7 4
y3 (n) −7 −7 −1
y4 (n) 3 4 3
y5 (n) −2 0 0
y(n) 1 4 3 0 7 4 −7 −7 −1 3 4 3 −2 0 0
Example 2.8: Find the output of a linear filter given the impulse response h(n) = {1, 1, 1}
and input, x(n) = {3, −1, 0, 1, 3, 2, 0, 1, 2, 1} using overlap-save method.
Solution:
50 Module-2
x1 (n) 0 0 3 −1 0 1 3 2
x2 (n) 3 2 0 1 2 1 0 0
0 2 3 1 0 −1 3 0 1 ∗
0 0 2 3 1 0 −1 3 1 ∗
3 0 0 2 3 1 0 −1 1 3
−1 3 0 0 2 3 1 0 0 2
y1 (n) = x1 (n) ⊗8 h(n) = =
0 −1 3 0 0 2 3 1 0 2
1 0 −1 3 0 0 2 3 0 0
3 1 0 −1 3 0 0 2 0 4
2 3 1 0 −1 3 0 0 0 6
3 0 0 1 2 1 0 2 1 ∗
2 3 0 0 1 2 1 0 1 ∗
0 2 3 0 0 1 2 1 1 5
1 0 2 3 0 0 1 2 0 3
y2 (n) = x2 (n) ⊗8 h(n) = =
2 1 0 2 3 0 0 1 0 3
1 2 1 0 2 3 0 0 0 4
0 1 2 1 0 2 3 0 0 3
0 0 1 2 1 0 2 3 0 1
Example 2.9: Find the output of a linear filter given the impulse response h(n) = {1, −1}
and input, x(n) = {1, 1, 1, 1, 1, 3, 1, 1, 4, 2, 1, 1, 3, 1} using overlap-save method. Use only 5
point circular convolution.
Digital Signal Processing 51
Solution:
h(n) = {1, −1}; M = 2
x(n) = {1, 1, 1, 1, 1, 3, 1, 1, 4, 2, 1, 1, 3, 1}
N =M +L−1
N =M +L−1⇒5=2+L−1⇒L=4
x(n) = {1, 1, 1, 1 |, 1, 3, 1, 1 |, 4, 2, 1, 1 |, 3, 1}
x1 (n) = {1, 1, 1, 1}
x2 (n) = {1, 3, 1, 1}
x3 (n) = {4, 2, 1, 1}
x4 (n) = {3, 1, 0, 0}
x1 (n) 0 1 1 1 1
x2 (n) 1 1 3 1 1
x3 (n) 1 4 2 1 1
x4 (n) 1 3 1 0 0
x1 (n) = {0, 1, 1, 1, 1}
x2 (n) = {1, 1, 3, 1, 1}
x3 (n) = {1, 4, 2, 1, 1}
x4 (n) = {1, 3, 1, 0, 0}
h(n) = {1, −1, 0, 0, 0}
0 1 1 1 1 1 ∗
1 0 1 1 1 −1 1
y1 (n) = x1 (n) ⊗5 h(n) = 1 1 0 1 1 0 = 0
1 1 1 0 1 0 0
1 1 1 1 0 0 0
1 1 1 3 1 1 ∗
1 1 1 1 3 −1 0
y2 (n) = x2 (n) ⊗5 h(n) = 3 1 1 1 1 0 = 2
1 3 1 1 1 0 −2
1 1 3 1 1 0 0
52 Module-2
1 1 1 2 4 1 ∗
4 1 1 1 2 −1 3
y3 (n) = x3 (n) ⊗5 h(n) = 2 4 1 1 1 0 = −2
1 2 4 1 1 0 −1
1 1 2 4 1 0 0
1 0 0 1 3 1 ∗
3 1 0 0 1 −1 2
y4 (n) = x4 (n) ⊗5 h(n) = 1 3 1 0 0 0 = −2
0 1 3 1 0 0 −1
0 0 1 3 1 0 0
y(n) = x(n) ∗ h(n) = {1, 0, 0, 0, 0, 2, −2, 0, 3, −2, −1, 0, 2, −2, −1, 0}.
N −1 N −1
2πkn
x(n)e−j
X X
X(k) = x(n)WNkn = N ; k = 0, 1, 2, . . . , N − 1
n=0 n=0
Let, N = 4.
3
X
X(k) = x(n)W4kn Multiplication Addition
n=0
3
X
k = 0; X(0) = x(n)W40×n = x(0)W40 + x(1)W40 + x(2)W40 + x(3)W40 4 3
n=0
X3
k = 1; X(1) = x(n)W41×n = x(0)W40 + x(1)W41 + x(2)W42 + x(3)W43 4 3
n=0
X3
k = 2; X(2) = x(n)W42×n = x(0)W40 + x(1)W42 + x(2)W44 + x(3)W46 4 3
n=0
X3
k = 3; X(3) = x(n)W43×n = x(0)W40 + x(1)W43 + x(2)W46 + x(3)W49 4 3
n=0
Total 16 12
Hence, for N = 4.
No. of complex computation required for X(k) is 16.
No. of complex addition required for X(k) is 12.
In general,
Digital Signal Processing 53
Complex multiplication:
Complex addition:
Example 2.10: Calculate the number of complex multiplications, complex additions, real
multiplications, real additions and trigonometric functions required for computing DFT for
N = 64 using direct method.
Solution:
Twiddle factors are a set of values that is used to speed up DFT and IDFT calculations.
Twiddle factors are mathematically represented as: WN = e−j2π/N .
j2πk
WNk+N = e− N = WNk
k+N/2
2. Symmetry property of WN : WN = −WNk
j2π k+ N
( )
k+ N 2 j2πk j2πN j2πk
WN 2
= e− N = e− N e− 2N = e− N e−jπ
k+ N j2πk j2πk
WN 2
= e− N ∗ −1 = −e− N = −WNk
3. WN2 = WN/2
j2π(2) j2π
− N/2
WN2 = e− N =e = WN/2
computational part is too long with this technique. We want to reduce that. This can be done
through FFT or fast Fourier transform. So, we can say FFT is nothing but computation of
DFT in an algorithmic format, where the computational part will be reduced. The main idea
of FFT algorithms is to decompose an N-point DFT into transformations of smaller length.
For example, if we devise a hypothetical algorithm which can decompose a 1024-point DFT
into two 512-point DFTs.
The radix-2 decimation-in-time algorithm rearranges the DFT equation into two parts: a
sum over the even-numbered discrete-time indices n = (0, 2, 4, ..., N − 2) and a sum over the
odd-numbered indices n = (1, 3, 5, ..., N − 1).
Let x(n) be a N -point sequence where N is assumed to be power of 2. Decimate/break
the sequence into 2 sequences of length N/2, where one is even indexed values of x(n) and
other is odd indexed values of x(n). ie.,
Since, Xe (k) and Xo (k) are periodic interms of k with period N/2 and so for k = N/2, ....., N −
1, the values are same as those for k = 0, 1, ..., N/2 − 1.
(k+N/2)
∴ for k ≥ N/2; WN = −WNk
We can write,
(k−N/2)
X(k) = Xe (k − N/2) − WN Xo (k − N/2); k = N/2, ..., N − 1
Let us consider N = 8
X(k) = Xe (k) + W8k Xo (k)
X(k) = Xe (k − 4) − W8k−4 Xo (k − 4)
56 Module-2
x(0)
xe(0)
x(1)
xe(1)
4-point x(2)
xe(2) DFT
x(3)
xe(3)
w80 x(4)
xoe(0)
w81 x(5)
xo(1)
4-point w82
xo(2) DFT x(6)
w83
xo(3) x(7)
Fig. 2.4. Decimation in time of a length N-DFT into two length-N/2 DFTs followed by
a combining stage.
N/2−1 N −1
X X
X(k) = x(n)WNkn + x(n)WNkn
n=0 n=N/2
Let m = n − N/2
n = N/2; m = N/2 − N/2 = 0
n = N − 1; m = (N − 1) − N/2 = N/2 − 1
N/2−1 N/2−1
X X k(m+N/2)
X(k) = x(n)WNkn + x(m + N/2)WN
n=0 m=0
N/2−1
X
kn
X(2k) = g1 (n)WN/2
n=0
N/2−1
X
kn
X(2k + 1) = g2 (n)WN/2
n=0
Let, N = 8
g1 (n) = x(n) + x(n + 4); g2 (n) = [x(n) − x(n + 4)]W8n
g1 (0) = x(0) + x(4); g2 (0) = [x(0) − x(4)]W80
g1 (1) = x(1) + x(5); g2 (1) = [x(1) − x(5)]W81
g1 (2) = x(2) + x(6); g2 (2) = [x(2) − x(6)]W82
g1 (3) = x(3) + x(7); g2 (3) = [x(3) − x(7)]W83
This is called a decimation in frequency because the frequency samples are computed sepa-
rately in alternating groups, and a radix-2 algorithm because there are two groups. Fig. 2.5
graphically illustrates this form of the DFT computation.
g1(0)
x(0) x(0)
g1(1)
x(1) w8 0
4-point x(4)
w8 1 g1(2) DFT x(2)
x(2)
w8 2 g1(3)
x(6)
x(3)
w8 3
g2(0)
x(1)
x(4) g2(1)
4-point x(5)
x(5) g2(2) DFT x(3)
x(6) g2(3)
x(7)
x(7)
Fig. 2.5. Decimation in frequency of a length N-DFT into two length-N/2 DFTs preceded
by a pre-processing stage.
Bit-reversed addressing is used for simplifying and speeding-up the access to the arrays in
FFT algorithms. In bit reversed addressing, transposed the original binary bits representing
Digital Signal Processing 59
the normal index order by reversing their positions. The most significant bit becomes the
least significant bit and the least significant bit becomes the most significant bit, the next
to the most significant bit becomes the next to the least significant bit, and the next to the
least significant bit becomes the next to the most significant bit, and so on.
Let, N = 23 = 8. ∴ N/2 = 4 = 100. Perform the addition from left to right (−→).
Example 2.11: Using DIF-FFT algorithm compute DFT of the sequence, x(n) =
{1, 2, −1, 2, 4, 2, −1, 2}.
Solution:
60 Module-2
Given, x(0) = 1, x(1) = 2, x(2) = −1, x(3) = 2, x(4) = 4, x(5) = 2, x(6) = −1, x(7) = 2.
a c=a+b
b d=(a-b)Wnr
Example 2.12: Obtain 8-point DFT of the sequence x(n) = {2, 1, 2, 1} using radix-2 DIF-FFT
algorithm. Show all the results along signal flow graph.
Solution:
Given, x(0) = 2, x(1) = 1, x(2) = 2, x(3) = 1, x(4) = 0, x(5) = 0, x(6) = 0, x(7) = 0.
Digital Signal Processing 61
A I
x(0) X(0)
B J
x(1) X(4)
w80
C K
x(2) X(2)
w80
D L
x(3) X(6)
w82 w8 0
E M
x(4) X(1)
w8 0
F N
x(5) X(5)
w8 1 w8 0
G P
x(6) X(3)
w8 2 w80
H Q
x(7) X(7)
w8 3 w82 w8 0
a c=a+b
b d=(a-b)Wnr
A I
x(0) X(0)
B J
x(1) X(4)
w80
C K
x(2) X(2)
w80
D L
x(3) X(6)
w82 w8 0
E M
x(4) X(1)
w8 0
F N
x(5) X(5)
w8 1 w8 0
G P
x(6) X(3)
w8 2
w80
H Q
x(7) X(7)
w8 3 w82 w8 0
Example 2.13: Obtain 8-point DFT of the sequence x(n) = {1, 1, 1, 1, 0, 0, 0, 0} using radix-2
DIT-FFT algorithm. Show all the results along signal flow graph.
Solution:
Given, x(0) = 1, x(1) = 1, x(2) = 1, x(3) = 1, x(4) = 0, x(5) = 0, x(6) = 0, x(7) = 0.
a c=a+Wnrb
b d=a-Wnrb
A I
x(0) X(0)
B J
x(4) X(1)
w80
C K
x(2) X(2)
w8 0
D L
x(6) X(3)
w80 w8 2
E M
x(1) X(4)
w80
F N
x(5) X(5)
w80 w81
G P
x(3) X(6)
w80 w82
H Q
x(7) X(7)
w80 w82 w83
Example 2.14: Obtain 8-point DFT of the sequence x(n) = {1, 1, 0, 0, −1, −1, 0, 0} using
radix-2 DIT-FFT algorithm. Show all the results along signal flow graph.
Solution:
Given, x(0) = 1, x(1) = 1, x(2) = 0, x(3) = 0, x(4) = −1, x(5) = −1, x(6) = 0, x(7) = 0.
a c=a+Wnrb
b d=a-Wnrb
A I
x(0) X(0)
B J
x(4) X(1)
w80
C K
x(2) X(2)
w8 0
D L
x(6) X(3)
w80 w8 2
E M
x(1) X(4)
w80
F N
x(5) X(5)
w80 w81
G P
x(3) X(6)
w80 w82
H Q
x(7) X(7)
w80 w82 w83
X(k) = {0, 3.414 − j1.414, 0, 0.586 − j1.414, 0, 0.586 + j1.414, 0, 3.414 + j1.414}.
Example 2.15: What is the speed improvement factor in calculating 64-point DFT of a
sequence using direct computation and FFT algorithm? Also mention the number of real
registers required.
Solution:
Direct computation:
Complex multiplication = N 2 = 4096.
Digital Signal Processing 65
FFT algorithm:
N
Complex multiplication = 2 log2 N = 192
Complex addition = N log2 N = 384
N2 4096
Speed improvement factor = N
log2 N
= 192 = 21.33
2
Example 2.16: Calculate the IDFT of X(k) = {0, 2.8284 − j2.8284, 0, 0, 0, 0, 0, 2.8284 +
j2.8284} using inverse radix-2 DIT-FFT algorithm.
Solution:
Given, X(0) = 0, X(1) = 2.8284 − j2.8284, X(2) = 0, X(3) = 0, X(4) = 0, X(5) =
0, X(6) = 0, X(7) = 2.8284 + j2.8284.
a c=a+b
b d=(a-b)Wn-r
1
A = X(0) + X(4) = 0 I =A+C =0 x(0) = 8
(I + J) = 0.707
B = X(1) + X(5) = 2.8284 − j2.8284 J = B + D = 5.6568 x(4) = 1
8
(I − J)W8−0 = −0.707
C = X(2) + X(6) = 0 K = [A − C]W8−0 = 0 x(2) = 1
8
(K + L) = 0.707
D = X(3) + X(7) = 2.8284 + j2.8284 L = [B − D]W8−2 = 5.6568 x(6) = 1
8
(K − L)W8−0 = −0.707
E = [X(0) − X(4)]W8−0 = 0 M =E+G=0 x(1) = 1
8
(M + N ) = 1
F = [X(1) − X(5)]W8−1 = 4 N =F +H =8 x(5) = 1
8
(M − N )W8−0 = −1
G = [X(2) − X(6)]W8−2 = 0 P = [E − G]W8−0 = 0 x(3) = 1
8
(P + Q) = 0
H = [X(3) − X(7)]W8−3 = 4 Q = [F − H]W8−2 = 0 x(7) = 1
8
(P − Q)W8−0 = 0
A I 1/8 x(0)
X(0)
B J 1/8 x(4)
X(1)
w8-0
C K 1/8 x(2)
X(2)
w8-0
D L 1/8 x(6)
X(3)
w8-2 w8-0
E M 1/8 x(1)
X(4)
w8-0
F N 1/8 x(5)
X(5)
w8-1 w8-0
G P 1/8 x(3)
X(6)
w8-2 w8-0
H Q 1/8 x(7)
X(7)
w8-3 w8-2 w8-0
Example 2.17: Compute the IDFT of the sequence X(k) = {0, 2−j4.8284, 0, 2+j0.8284, 0, 2−
j0.8284, 0, 2 + j4.8284} using DIF-FFT algorithm.
Solution:
Given, X(0) = 0, X(1) = 2 − j4.8284, X(2) = 0, X(3) = 2 + j0.8284, X(4) = 0, X(5) =
2 − j0.8284, X(6) = 0, X(7) = 2 + j4.8284.
a c=a+Wn-rb
b d=a-Wn-rb
A I 1/8 x(0)
X(0)
B J 1/8 x(1)
X(4)
-0
w8
C K 1/8 x(2)
X(2)
w8-0
D L 1/8 x(3)
X(6)
w8-0 w8-2
E M 1/8 x(4)
X(1)
w8-0
F N 1/8 x(5)
X(5)
w8 -0
w8-1
G P 1/8 x(6)
X(3)
w8-0 w8-2
H Q 1/8 x(7)
X(7)
w8-0 w8-2 w8-3
Example 2.18: If x(n) = {1, 2, 0, 1} and y(n) = {1, 3, 3, 1} obtain z(n) = x(n) ⊗4 y(n) using
DIT-FFT algorithm.
Solution:
68 Module-2
A
x(0) X(0)
B
x(2) X(1)
w40
C
x(1) X(2)
w40
D
x(3) X(3)
w40 w41
A
y(0) Y(0)
B
y(2) Y(1)
w40
C
y(1) Y(2)
w40
D
y(3) Y(3)
w40 w41
A 1/4
Z(0) z(0)
B 1/4
Z(1) z(2)
-0
w4
C 1/4
Z(2) z(1)
w4-0
D 1/4
Z(3) z(3)
w4-1 w4-0
(iv) Y (k) :
Digital Signal Processing 69
Example 2.19: If x(n) = {1, 1, 1, 1} and y(n) = {1, 0, 1, 0} obtain z(n) = x(n) ⊗4 y(n) using
DIF-FFT algorithm.
Solution:
A
x(0) X(0)
B
x(1) X(2)
w40
C
x(2) X(1)
w40 w40
D
x(3) X(3)
w41
A
y(0) Y(0)
B
y(1) Y(2)
w40
C
y(2) Y(1)
w40 w40
D
y(3) Y(3)
w41
Z(0)
A 1/4
z(0)
B 1/4
Z(2) z(1)
w4-0
Z(1)
C 1/4 z(2)
w4-0
Z(3)
D 1/4 z(3)
w4-0 -1
w4
Example 2.20: Let x(n) = {1, 1/2, 1/4, 1/8} and y(n) = {1, 1, 1, 1}. Compute the DFT
of x(n) by the decimation in time FFT algorithm and that of y(n) by the decimation in
frequency FFT algorithm. Using the above results, evaluate the circular convolution of x(n)
and y(n).
Solution:
(iii) X(k) :
5 15
A = x(0) + W40 x(2) = 4 X(0) = A + W40 C = 8
3 3
B = x(0) − W40 x(2) = 4 X(1) = B + W41 D = 4 + j 38
5 5
C = x(1) + W40 x(3) = 8 X(2) = A − W40 C = 8
3 3
D = x(1) − W40 x(3) = 8 X(3) = B − W41 D = 4 − j 38
(iv) Y (k) :
15
A = Z(0) + Z(2) = 2 z(0) = 14 [A + B] = 15
8
B = Z(1) + Z(3) = 0 z(2) = 14 [A − B]W4−0 = 15
8
C = [Z(0) − Z(2)]W4−0 = 15
2 z(1) = 14 [C + D] = 15
8
D = [Z(1) − Z(3)]W4−1 = 0 z(3) = 14 [C − D]W4−0 = 15
8
A
x(0) X(0)
B
x(2) X(1)
w40
C
x(1) X(2)
w40
D
x(3) X(3)
w40 w41
A
y(0) Y(0)
B
y(1) Y(2)
w40
C
y(2) Y(1)
w40 w40
D
y(3) Y(3)
w41
A 1/4
Z(0) z(0)
B 1/4
Z(1) z(2)
-0
w4
C 1/4
Z(2) z(1)
w4-0
D 1/4
Z(3) z(3)
-0
w4-1 w4
Example 2.21: Using DIF-FFT algorithm compute DFT of the sequence, x(n) =
{1, 2, −1, 2, 4, 2, −1, 2}. If y(n) = x(−n) without performing FFT, find Y (k) using X(k).
Solution:
Given, x(0) = 1, x(1) = 2, x(2) = −1, x(3) = 2, x(4) = 4, x(5) = 2, x(6) = −1, x(7) = 2.
Digital Signal Processing 73
A I
x(0) X(0)
B J
x(1) X(4)
w80
C K
x(2) X(2)
w80
D L
x(3) X(6)
w82 w8 0
E M
x(4) X(1)
0
w8
F N
x(5) X(5)
w8 1 w8 0
G P
x(6) X(3)
w8 2
w80
H Q
x(7) X(7)
w8 3
w82 w8 0
11
-3 -3
7 7 X(k)
X((-k))8
-3 -3
-5
Example 2.22: First five points of eight point DFT of a real valued sequence is given by,
X(k) = {0, 2 + 2j, −4j, 2 − 2j, 0}. Determine the remaining points. Hence find the sequence
x(n) using DIF-FFT algorithm.
Solution:
Given, X(k) = {0, 2 + 2j, −4j, 2 − 2j, 0}
X(0) = 0, X(1) = 2 + 2j, X(2) = −4j, X(3) = 2 − 2j, X(4) = 0.
X(5) = X(3)∗ = 2 + 2j
X(6) = X(2)∗ = 4j
X(7) = X(1)∗ = 2 − 2j
X(k) = {0, 2 + 2j, −4j, 2 − 2j, 0, 2 + 2j, 4j, 2 − 2j}.
*
X(1) X(3) X(4) X(5) X(7)
X(0) X(2) X(6)
*
*
X(0) = 0, X(1) = 2 + 2j, X(2) = −4j, X(3) = 2 − 2j, X(4) = 0, X(5) = 2 + 2j, X(6) =
4j, X(7) = 2 − 2j.
B J 1/8 x(1)
X(4)
-0
w8
C K 1/8 x(2)
X(2)
w8-0
D L 1/8 x(3)
X(6)
w8-0 w8-2
E M 1/8 x(4)
X(1)
w8-0
F N 1/8 x(5)
X(5)
w8 -0
w8-1
G P 1/8 x(6)
X(3)
w8-0 w8-2
H Q 1/8 x(7)
X(7)
w8-0 w8-2 w8-3
a c=a+Wn-rb
b d=a-Wn-rb
Example 2.23: Bring out differences between linear convolution and circular convolution.
Solution:
76 Module-2
Solution:
DIT-FFT DIF-FFT
(i) Reducing samples in time do- Reducing samples in fre-
main quency domain
(ii) Input is bit reversed while the Input is in natural order while
output is in normal order the output is bit reversed.
(iii) Splits the two DFTs into even Splits the two DFTs into first
and odd indexed input sam- half and last half of the input
ples samples
(iv) Multiplication is done before Multiplication is done after
addition addition
(v) Butterflies are defined on the Butterflies are defined on the
last pass of FFT first pass of FFT