lecture 10 ideal filters
play

Lecture 10: Ideal Filters Mark Hasegawa-Johnson ECE 401: Signal and - PowerPoint PPT Presentation

DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Lecture 10: Ideal Filters Mark Hasegawa-Johnson ECE 401: Signal and Image Analysis, Fall 2020 DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary


  1. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Lecture 10: Ideal Filters Mark Hasegawa-Johnson ECE 401: Signal and Image Analysis, Fall 2020

  2. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

  3. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Outline Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

  4. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Review: DTFT The DTFT (discrete time Fourier transform) of any signal is X ( ω ), given by ∞ � x [ n ] e − j ω n X ( ω ) = n = −∞ � π x [ n ] = 1 X ( ω ) e j ω n d ω 2 π − π Particular useful examples include: f [ n ] = δ [ n ] ↔ F ( ω ) = 1 g [ n ] = δ [ n − n 0 ] ↔ G ( ω ) = e − j ω n 0

  5. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Properties of the DTFT Properties worth knowing include: 0 Periodicity: X ( ω + 2 π ) = X ( ω ) 1 Linearity: z [ n ] = ax [ n ] + by [ n ] ↔ Z ( ω ) = aX ( ω ) + bY ( ω ) 2 Time Shift: x [ n − n 0 ] ↔ e − j ω n 0 X ( ω ) 3 Frequency Shift: e j ω 0 n x [ n ] ↔ X ( ω − ω 0 ) 4 Filtering is Convolution: y [ n ] = h [ n ] ∗ x [ n ] ↔ Y ( ω ) = H ( ω ) X ( ω )

  6. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Outline Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

  7. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary What is “Ideal”? The definition of “ideal” depends on your application. Let’s start with the task of lowpass filtering. Let’s define an ideal lowpass filter, Y ( ω ) = L I ( ω ) X ( ω ), as follows: � X ( ω ) | ω | ≤ ω L , Y ( ω ) = 0 otherwise , where ω L is some cutoff frequency that we choose. For example, to de-noise a speech signal we might choose ω L = 2 π 2400 / F s , because most speech energy is below 2400Hz. This definition gives: � 1 | ω | ≤ ω L L I ( ω ) = 0 otherwise

  8. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Ideal Lowpass Filter

  9. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary How can we implement an ideal LPF? 1 Use np.fft.fft to find X [ k ], set Y [ k ] = X [ k ] only for 2 π k N < ω L , then use np.fft.ifft to convert back into the time domain? It sounds easy, but. . . np.fft.fft is finite length, whereas the DTFT is infinite length. Truncation to finite length causes artifacts. 2 Use pencil and paper to inverse DTFT L I ( ω ) to l I [ n ], then use np.convolve to convolve l I [ n ] with x [ n ]. It sounds more difficult. But actually, we only need to find l I [ n ] once, and then we’ll be able to use the same formula for ever afterward. This method turns out to be both easier and more effective in practice.

  10. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Inverse DTFT of L I ( ω ) The ideal LPF is � 1 | ω | ≤ ω L L I ( ω ) = 0 otherwise The inverse DTFT is � π l I [ n ] = 1 L I ( ω ) e j ω n d ω 2 π − π Combining those two equations gives � ω L l I [ n ] = 1 e j ω n d ω 2 π − ω L

  11. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Solving the integral The ideal LPF is � 1 � 1 � ω L � � � l I [ n ] = 1 e j ω n d ω = 1 − ω L = 1 e j ω n � ω L (2 j sin( ω L n )) 2 π 2 π 2 π jn jn − ω L So l I [ n ] = sin( ω L n ) π n

  12. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary l I [ n ] = sin( ω L n ) π n sin( ω L n ) is undefined when n = 0 π n sin( ω L n ) lim n → 0 = ω L π n π So let’s define l I [0] = ω L π .

  13. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary l I [ n ] = sin( ω L n ) π n

  14. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Outline Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

  15. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Ideal Highpass Filter Ideal Highpass Filter An ideal high-pass filter passes all frequencies above ω H : � 1 | ω | > ω H H I ( ω ) = 0 otherwise

  16. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Ideal Highpass Filter . . . except for one problem: H ( ω ) is periodic with a period of 2 π .

  17. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary The highest frequency is ω = π The highest frequency, in discrete time, is ω = π . Frequencies that seem higher, like ω = 1 . 1 π , are actually lower. This phenomenon is called “aliasing.”

  18. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Redefining “Lowpass” and “Highpass” Let’s redefine “lowpass” and “highpass.” The ideal LPF is � 1 | ω | ≤ ω L , L I ( ω ) = 0 ω L < | ω | ≤ π. The ideal HPF is � 0 | ω | < ω H , H I ( ω ) = 1 ω H ≤ | ω | ≤ π. Both of them are periodic with period 2 π .

  19. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Inverse DTFT of H I ( ω ) The easiest way to find h I [ n ] is to use linearity: H I ( ω ) = 1 − L I ( ω ) Therefore: h I [ n ] = δ [ n ] − l I [ n ] = δ [ n ] − sin( ω H n ) π n

  20. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary h I [ n ] = δ [ n ] − sin( ω H n ) π n

  21. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary h I [ n ] = δ [ n ] − sin( ω L n ) π n

  22. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Outline Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

  23. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Ideal Bandpass Filter Ideal Bandpass Filter An ideal band-pass filter passes all frequencies between ω H and ω L : � 1 ω H ≤ | ω | ≤ ω L B I ( ω ) = 0 otherwise (and, of course, it’s also periodic with period 2 π ).

  24. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Inverse DTFT of B I ( ω ) The easiest way to find b I [ n ] is to use linearity: B I ( ω ) = L I ( ω | ω L ) − L I ( ω | ω H ) Therefore: b I [ n ] = sin( ω L n ) − sin( ω H n ) π n π n

  25. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary b I [ n ] = sin( ω L n ) − sin( ω H n ) π n π n

  26. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary b I [ n ] = sin( ω L n ) − sin( ω H n ) π n π n

  27. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Outline Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

  28. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Ideal Filters are Infinitely Long All of the ideal filters, l I [ n ] and so on, are infinitely long. In videos so far, I’ve faked infinite length by just making l I [ n ] more than twice as long as x [ n ]. If x [ n ] is very long (say, a 24-hour audio recording), you probably don’t want to do that (computation=expensive)

  29. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Finite Length by Truncation We can force l I [ n ] to be finite length by just truncating it, say, to 2 M + 1 samples: � l I [ n ] − M ≤ n ≤ M l [ n ] = 0 otherwise

  30. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Truncation Causes Frequency Artifacts The problem with truncation is that it causes artifacts.

  31. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Windowing Reduces the Artifacts We can reduce the artifacts (a lot) by windowing l I [ n ], instead of just truncating it: � w [ n ] l I [ n ] − M ≤ n ≤ M l [ n ] = 0 otherwise where w [ n ] is a window that tapers smoothly down to near zero at n = ± M , e.g., a Hamming window: � 2 π n � w [ n ] = 0 . 54 + 0 . 46 cos 2 M

  32. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Windowing a Lowpass Filter

  33. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Windowing Reduces the Artifacts

  34. DTFT Ideal LPF Ideal HPF Ideal BPF Finite-Length Even Length Summary Outline Review: DTFT 1 Ideal Lowpass Filter 2 Ideal Highpass Filter 3 Ideal Bandpass Filter 4 Realistic Filters: Finite Length 5 Realistic Filters: Even Length 6 Summary 7

Recommend


More recommend