DSP Module 2
DSP Module 2
MODULE 2
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.
• Since 𝑥 𝑛 and h 𝑛 are finite duration sequences, y 𝑛 is also finite of length L+M-1.
• In frequency domain 𝑌 𝜔 = 𝑋 𝜔 𝐻(𝜔).
• In terms of DFT, 𝑌 𝑘 = 𝑋 𝑘 𝐻 𝑘 𝑘 = 0,1,2 … . 𝑁 − 1.
• N-point circular convolution of 𝑥 𝑛 and h 𝑛 is equivalent to their linear convolution.
…LINEAR FILTERING METHODS BASED ON
DFT…
▪ FILTERING OF LONG DATA SEQUENCES:
• In some real time processing of applications involving linear filtering of signals, the
input sequence 𝑥 𝑛 is a very long sequence.
• Linear filtering on such signals involving DFT imposes severe memory constraints.
• In such filtering the sequences are processed block-wise and the output blocks are
fitted together to form the overall sequence.
• There are two methods for this:
❑ Overlap Save Method:
• Size of input data block N=L+M-1 and size of DFT and IDFT is N.
…LINEAR FILTERING METHODS BASED ON
DFT…
• Each data block consists of M-1 points of previous block and N new points.
• N-point DFT is computed per block.
• Impulse response of filter is increased by appending L-1 zeros and its DFT computed.
• For mth block we have, 𝑌𝑚 𝑘 = 𝐻 𝑘 𝑋𝑚 𝑘 , multiplication of two N-point DFTs 𝐻 𝑘 and
𝑋𝑚 𝑘 .
• Then N-point IDFT is computed to yield, 𝑌𝑚 𝑛 = {𝑦ො𝑚 0 𝑦ො𝑚 1 … 𝑦ො𝑚 𝑀 − 1
𝑦ො𝑚 𝑀 … 𝑦ො𝑚 𝑁 − 1 }.
• For a N-length record, the first M-1 datapoints of 𝑦𝑚 𝑛 are corrupted by aliasing and
discarded.
• Last L points of 𝑦𝑚 𝑛 are that similar to linear convolution.
…LINEAR FILTERING METHODS BASED ON
DFT…
• To avoid data loss due to aliasing, the last M-1 points of each record are made the
first M-1 points of subsequent record.
• To process the data, the first M-1 points of first block is set to zero.
• The block of data is as follows:
OVERLAP ADD EXAMPLE
Given x[n]={3,-1,0,1,3,2,0,1,2,1} & h[n]={1,1,1}
Let, L=5
Length of h[n], M= 3 , Therefore, M-1= 2
We know, L=(N+M-1)
5=N+3-1
N=3
∴Pad M-1=2 zeros with h[n]
i.e. h[n]={1,1,1,0,0}
Performing yk[n]= xk[n] h[n],
where k=1,2,3,4
1. y1[n]= {3,2,2,-1,0}
2. y2[n]= {1,4,6,5,2}
3. y3[n]= {0,1,3,3,2}
4. y4[n]= {1,1,1,0,0}
…LINEAR FILTERING METHODS BASED ON
DFT…
❑ Overlap Add method:
• Size of input data block L and size of DFT and IDFT is N.
• Each data block is appended with M-1 zeros and DFT calculated.
• The block of data is as follows:
…LINEAR FILTERING METHODS BASED ON
DFT…
• The two N-point DFTs are multiplied to obtain 𝑌𝑚 𝑘 = 𝐻 𝑘 𝑋𝑚 𝑘 .
• IDFT yields N-points that are free of aliasing.
• Since each data block is terminated with M-1 zeros, the last M-1 points of each
block is added to M-1 points of subsequent block.
• Overlapping and adding yields, 𝑦 𝑛 = {𝑦1 0 , 𝑦1 1 , . . 𝑦1 𝐿 − 1 , 𝑦1 𝐿 +
{𝑦2 1 , … 𝑦1 𝑁 − 1 + 𝑦2 𝑀 − 1 , 𝑦1 𝑀 , … }
OVERLAP SAVE EXAMPLE
Given x[n]={3,-1,0,1,3,2,0,1,2,1} & h[n]={1,1,1}
Let, L=5
Length of h[n], M= 3, Therefore, M-1= 2
We know, L=(N+M-1)
5=N+3-1
N=3
∴Pad M-1=2 zeros with h[n] i.e. h[n]={1,1,1,0,0}
x1[n]=(0 0 3 -1 0) x2[n]=(-1 0 1 3 2) x3[n]=(3 2 0 1 2) x4[n]=( 1 2 1 0 0)
Performing yk[n]= xk[n] h[n], where k=1,2,3,4
1. y1[n]= {-1,0,3,2,2}
2. y2[n]= {4,1,0,4,6}
3. y3[n]= {6,7,5,3,3}
4. y4[n]= {1,3,4,3,1}
OVERLAP SAVE VS ADD
METHOD
Overlap Save Overlap Add
2 2
𝑁
𝑁 𝑁 𝑘+
• Periodic sequences, 𝐹1 𝑘 + = 𝐹1 𝑘 and 𝐹2 𝑘 + = 𝐹2 𝑘 . Also 𝑊𝑁 2 = −𝑊𝑁𝑘 .
2 2
𝑁 𝑁
• 𝑋 𝑘 = 𝐹1 𝑘 + 𝑊𝑁𝑘 𝐹2 𝑘 and 𝑋 𝑘 + = 𝐹1 𝑘 − 𝑊𝑁𝑘 𝐹2 𝑘 , 𝑘 = 0,1,2 … − 1.
2 2
𝑁2 𝑁 𝑁
• Computation of 𝑋 𝑘 requires + . Also 𝐺1 𝑘 = 𝐹1 𝑘 and 𝐺2 𝑘 = 𝑊𝑁𝑘 𝐹2 𝑘 , 𝑘 = 0,1,2 … − 1.
2 2 2
𝑁 𝑁
• 𝑋 𝑘 = 𝐺1 𝑘 + 𝐺2 𝑘 and 𝑋 𝑘 + = 𝐺1 𝑘 − 𝐺2 𝑘 , 𝑘 = 0,1,2 … − 1.
2 2
…RADIX-2FFT…
• The process is repeated for 𝑓1 𝑛 and 𝑓2 𝑛 .
• 𝑓1 𝑛 results in two N/4 point sequences-𝑣11 𝑛 = 𝑓1 (2𝑛) and 𝑣12 𝑛 = 𝑓1 2𝑛 + 1 , k =
N
0,1,2. . − 1.
4
• 𝑓2 𝑛 results in two N/4 point sequences-𝑣21 𝑛 = 𝑓1 (2𝑛) and 𝑣22 𝑛 = 𝑓2 2𝑛 + 1 , k =
N
0,1,2. . − 1.
4
𝑘 𝑁
• By using these we obtain N/2-point DFTs: 𝐹1 𝑘 = 𝑉11 𝑘 + 𝑊𝑁/2 𝑉12 , 𝐹1 𝑘 + = 𝑉11 𝑘 −
4
𝑁 N
𝑘
𝑊𝑁/2 𝑉12 , 𝐹2 𝑘 = 𝑉21 𝑘 𝑘
+ 𝑊𝑁/2 𝑉22 , 𝐹2 𝑘 + = 𝑉21 𝑘 − 𝑊𝑁𝑘 𝑉22 , k = 0,1,2 … − 1.
4 4
2
𝑁2
• 𝐹1 𝑘 and 𝐹2 𝑘 can be accomplished with + 𝑁 complex multiplications.
4
• Decimation is repeated again and again till one point sequence is obtained. Operation can be
performed 𝑣 = log 2 𝑁 times.
𝑁
• Number of complex multiplications: log 2 𝑁. Number of complex additions: N log 2 𝑁.
2
…RADIX-2FFT…
• N=8 point DFT computation is as follows.
…RADIX-2FFT…
• Butterfly Diagram
…RADIX-2FFT…
• Data points to be stored are 2N in bit reversed manner.
• Decimation in frequency FFT algorithm uses M=2 and L=N/2.
𝑘𝑁
𝑁
•𝑋 𝑘 = σ𝑁/2−1
𝑛=0 𝑥 𝑛 𝑊𝑁𝑘𝑛 + σ𝑁−1 𝑘𝑛
𝑁 𝑥(𝑛)𝑊𝑁 = σ𝑁−1 𝑘𝑛
𝑛=0 𝑥 𝑛 𝑊𝑁 + 𝑊𝑁 2
σ𝑁/2−1
𝑛=0 𝑥 𝑛 + 𝑊𝑁𝑘𝑛 .
𝑛= 2
2
𝑘𝑁
𝑊𝑁 2
= (−1)𝑘 ,
𝑁
thus 𝑋 𝑘 = σ𝑁−1 𝑘
𝑛=0 [𝑥 𝑛 + (−1) 𝑥 𝑛 + ] 𝑊𝑁𝑘𝑛 .
2
• Shuffling of data and bit reversal
…RADIX-2FFT…
• We split 𝑋 𝑘 into odd numbered and even numbered sequence.
𝑁 𝑁
−1 𝑁 𝑘𝑛 −1 𝑁
• 𝑋 2𝑘 = σ𝑛=0[𝑥 𝑛 + 𝑥 𝑛 +
2
] 𝑊𝑁 and 𝑋 2𝑘 + 1 = σ𝑛=0[𝑥 𝑛 − 𝑥 𝑛 +
2
𝑊𝑁𝑛 ] 𝑊𝑁𝑘𝑛 ,
2 2
𝑁 2 2
𝑘= 0,1 … − 1. 𝑊𝑁2 = 𝑊𝑁 .
2 2
𝑁
• If 𝑔1 (𝑛) and 𝑔2 (𝑛) are two N/2-point sequences, 𝑔1 𝑛 = 𝑥 𝑛 + 𝑥 𝑛 + and
2
𝑁 𝑁
𝑔2 𝑛 = [𝑥 𝑛 − 𝑥 𝑛 + ]𝑊𝑁𝑛 , 𝑛 = 0,1,2 … − 1.
2 2
𝑁 𝑁
−1 −1
• 𝑋 2𝑘 = σ𝑛=0 𝑔1 (𝑛)𝑊𝑁𝑘𝑛 and 𝑋 2𝑘 + 1 = σ𝑛=0 𝑔2 (𝑛)𝑊𝑁𝑘𝑛 .
2 2
2 2
• The computation procedure can be repeated and the process involves 𝑣 = log 2 𝑁 stages of
decimation.
• First stage of decimation in frequency FFT.
• Butterfly computation for Decimation in Frequency Algorithm
𝑁
• Number of complex multiplications: log 2 𝑁.
2
• Number of complex additions: N log 2 𝑁.