210 likes | 430 Views
Lecture 3. Linear filtering based on the DFT Advanced Digital Signal Processing Dr Dennis Deng Department of Electronic Engineering, La Trobe University 1998,1999. Contents. Linear filter and circular convolution Overlap and save method Overlap and add method Self test exercises.
E N D
Lecture 3 Linear filtering based on the DFT Advanced Digital Signal Processing Dr Dennis Deng Department of Electronic Engineering, La Trobe University 1998,1999
Contents • Linear filter and circular convolution • Overlap and save method • Overlap and add method • Self test exercises
Linear Filtering • A sequence x(n) of length L filtered by an FIR filter h(n) of length M • The length of y(n) is L+M-1 • Example x(n) =[1 1 1] , h(n) =[-1 1]
Linear Filtering • In the frequency domain • Sampling both side by an interval • The kth sample is given by • Using the DFT notation X(k) and H(k) are the DFT (with zero padding) of x(n) and h(n), respectively.
Linear Filtering • Performing the inverse DFT • Is the same as y(n) ? YES. Because is the Fourier transform of y(n), to recover y(n), an N-point sampling of and an N-point IDFT is necessary. • An equivalent question is under what condition circular convolution becomes linear convolution ? • A 4-point circular convolution of the previous example in the following slide
Linear Filtering • This example shows that by zero padding such that the length of the circular convolution is greater than or equal to L+M-1, circular convolution is the same as linear convolution.
Linear Filtering • The multiplication in DFT domain corresponds to circular convolution in the time domain. • By zero padding the two sequences, circular convolution becomes linear convolution • To perform linear convolution using the DFT (1) zero padding x(n) and h(n) such that the length of them is N=L+M-1 (2) Calculate an N-point DFT for both sequences and multiply them point-by-point (3) perform an N-point inverse DFT
Linear Filtering • The following example shows a 3-point circular convolution
Linear Filtering • The following example shows a 5-point circular convolution • These examples show that when circular convolution is the same as linear convolution
Overlap-save method • When the DFT is used to implement linear filtering, a signal is processed in blocks. Due to the real-time requirement (low delay) and the limitation of physical memory, the size of the block can not be arbitrarily large. • The length of the FIR filter is M and the length of on block of data is L (L>M) • Each time a block of data of length L+M-1 is filtered by using the DFT method.
Overlap-save method • The method is shown in the following diagram
Overlap-save method • Each step consists: (1) calculating N-point DFT of x(n) and multiply it with the N-point DFT of h(n). (2) calculating N-point IDFT and discarding the first M-1 output sample. The last L samples are the desired filter output (3) append the last M-1 samples to the beginning of the new block of signal (4) goto (1) until reach the end of the signal.
Overlap-save method • The reason for discarding the first M-1 output samples is that they are the result of circular convolution. Linear convolution starts at the Mth sample. • For the same reason, the last M-1 samples of the processed block should be appended to the beginning of the new block
Overlap-save method • This is can be easily seen from a simple example: x(n)=[1 2 2 1]; h(n)=[1 -1]. (L=4, M=2). A 6-point circular convolution (x(n) represents a block of data)
Overlap-add method • This method is shown in the following diagram
Overlap-add method • In each step: (1) perform the L+M-1 point DFT, multiplication and IDFT (2) the last M-1 samples of the previous output is added to the first M-1 samples of the current output
Summary • The DFT can be used to implement linear filtering • A key point is to choose the N-point DFT such that circular convolution is the same as linear convolution • The overlap-save and overlap-add methods can be used in real time signal processing.
Self test exercises • For a signal x(n)=[1 2 3 2 1] and a filter h(n)=[1 -2 1], (1) Calculate its circular convolution. (2) Verify your result by using Matlab (hint: real(ifft(fft(x).*fft(h,6)))) (3) Calculate its N-point (N=8,9,10,128) circular convolution. Which one is the same as linear convolution • For a signal x(n)=[1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4] and a filter h(n)=[1 2 1], calculate the filter output using (1) Overlap-save (2) Overlap-add