Design of Digital Filters

Design of Digital Filters

Chapter 8 Design of Digital Filters Contents Overview . 8.2 General Considerations . 8.2 Design of FIR Filters . 8.4 Design of linear-phase FIR filters using windows . 8.7 Time-delay in desired response . 8.9 Sidelobes . 8.10 ◦ Hilbert transform (90 phase shift) . 8.12 Design of FIR filters by frequency sampling . 8.12 “Optimum” equiripple linear-phase FIR filters . 8.14 Comparison of FIR methods . 8.17 Design of IIR Filters from Analog Filters . 8.18 IIR filter design by bilinear transformation . 8.19 Frequency Transformations . 8.24 Design of Digital Filters Based on Least-Squares Method . 8.24 Summary . 8.24 8.1 8.2 c J. Fessler, May 27, 2004, 13:18 (student version) So far our treatment of DSP has focused primarily on the analysis of discrete-time systems. Now we finally have the analytical tools to begin to design discrete-time systems. All LTI systems can be thought of as filters, so, at least for LTI systems, to “design” a system means to design a digital filter. (The design of nonlinear or time-varying systems is generally more complicated, and often more case specific.) Goal: given desired • magnitude response j Hd(!) j • phase response \ Hd(!) • tolerance specifications (how far from ideal?), we want to choose the filter parameters N, M, fakg, fbkg such that the system function M b z−1 (z − z ) H(z) = k=0 k = g i i ; PN −1 Q (z − p ) k=0 akz j j P Q where a0 = 1, yields a frequency response H(!) ≈ Hd(!). Rational H(z), so LTI system described by a constant-coefficient difference equation, so can be implemented with finite # of adds, multiplies, and delays. In other words, filter design means choosing the number and locations of the zeros and poles, or equivalently the number and values of the filter coefficients, and thus H(z), h[n], H(!). Overview • N = 0, FIR or all-zero. linear passband phase. • N > 0, IIR. lower sidelobes for same number of coefficients. 8.1 General Considerations • Ideally would like N and M or N + M to be as small as possible for minimal computation / storage. • Causal (for now) • Poles inside unit circle for stability 8.1.1 Causality We will focus on designing causal digital filters, since those can be implemented in real time. Noncausal filter design (e.g., for off-line applications) is much easier and many of the same principles apply anyway. An LTI system is causal iff • input/output relationship: y[n] depends only on current and past input signal values. • impulse response: h[n] = 0 for n < 0 • system function: number of finite zeros ≤ number of finite poles • frequency response: What can we say about H(!)? Fact: if h[n] is causal, then • Paley-Wiener Theorem: H(!) cannot be exactly zero over any band of frequencies. (Except in the trivial case where h[n] = 0.) • Furthermore, jH(!)j cannot be flat (constant) over any finite band. • HR(!) and HI (!) are Hilbert transform pairs. Therefore they are not independent. Hence magnitude and phase response are interdependent. Thus those ideal filters with finite bands of zero response cannot be implemented with a causal filter. Instead, we must design filters that approximate the desired frequency response Hd(!). c J. Fessler, May 27, 2004, 13:18 (student version) 8.3 8.1.2 Characteristics of practical frequency-selective filters No perfectly flat regions Fact: since causal filters cannot have a band of frequencies with zero response, nor can they have any band of frequencies over which the frequency response is a constant. Proof by contradiction. Suppose H(!) = c for !1 ≤ ! ≤ !2, with corresponding impulse response h[n]. Now define a new filter g[n] = h[n] −c δ[n]. Then certainly g[n] is also causal. But G(!) = H(!) −c = 0 for !1 ≤ ! ≤ !2, which is impossible if g[n] is causal. Causal filters cannot have a band of frequencies with zero response. Nor can they have an infinitely sharp transition between the passband and the stopband. Nor can they have perfectly flat passband. So a typical realistic magnitude response looks like the following. jH(!)j 1 + δ1 1 Passband Ripple 1 − δ1 Transition Band Passband PSfrag replacements Stopband δ2 Stopband Ripple !p !s π ! Practical filter design means choosing δ1, δ2, !c and !s, and then designing N, M, fakg, fbkg to satisfy those requirements. Often one must iterate. Often we plot jH(!)j using dB, i.e., 20 log10 jH(!)j, and express the ripple in dB as well. Note that stopband ripple is not defined peak-to-peak, since the highest magnitude response in the stopband is more important than how wiggly the response is in the stopband. Example application: CD digital crossover Separate woofer and tweeter signals digitally inside CD player, rather in analog at speaker. Why is passband ripple tolerable in this context (distortion)? Room acoustics act as another filter. Speaker response is not perfectly flat. Keep filter ripple below these other effects. Now imagine that we have specified δ1, δ2, !c and !s, and we wish to design N, M, fakg, fbkg to satisfy those requirements. As mentioned above, we have two broad choices: FIR and IIR. We focus first on FIR. 8.4 c J. Fessler, May 27, 2004, 13:18 (student version) 8.2 Design of FIR Filters An FIR filter of length M is an LTI system with the following difference equation1: M−1 y[n] = bk x[n − k] : kX=0 Note that the book changes the role of M here. Earlier, when discussing rational system functions, M was the number of zeros. Now M is the number of “nonzero” elements of h[n], which corresponds to at most M − 1 zeros. (More precisely, we assume bM−1 6= 0 and b0 6= 0, but some of the coefficients in between could be zero.) M−1 The problem: given δ1, δ2, !c, and !s, we wish to choose M and fbkgk=0 to achieve that goal. We focus on linear-phase FIR filters, because if linear phase is not needed, then IIR is probably preferable anyway. We focus on lowpass filters, since transformations can be made to form highpass, bandpass from lowpass, as discussed previously. Impulse response Clearly for an FIR filter b ; n = 0; : : : ; M − 1 h[n] = n 0; otherwise: So rather than writing everything in terms of bk's, we write it directly in terms of the impulse response h[n]. In fact, for FIR filter design we usually design h[n] directly, rather than starting from a pole-zero plot. (An exception would be notch filters.) 8.2.1 Symmetric and antisymmetric FIR filters I focus on the symmetric case. System function: M−1 H(z) = h[n] z−n: nX=0 How do we make a filter have linear phase? We previously answered this in the pole-zero domain. Now we examine it in the time domain. An FIR filter has linear phase if h[n] = h[M − 1 − n]; n = 0; 1; : : : ; M − 1. Example. For M = 5: h[n] = fb0; b1; b2; b1; b0g : Such an FIR filter is called symmetric. Caution: this is not “even symmetry” though in the sense we discussed previously. This is related, but not exactly the same as circular symmetry. Example. For M = 3 and h[n] = 1=2; 1; 1=2 . Does this filter have linear phase? Is it lowpass or highpass? n o 1 1 1 1 H(!) = + e−|! + e−|2! = e−|! e|! + 1 + e−|! = e−|! (1 + cos !); 2 2 2 2 so since 1 + cos ! ≥ 0, \ H(!) = −!; which is linear phase. So it works for this particular example, but why does the symmetry condition ensure linear phase in general? 1 M M−1 Caution. At this point the book switches from k=0 to k=0 apparently. This inconsistent with MATLAB, so there are “M − 1” factors that appear frequently in the MATLAB calls. I think that MATLABPis consistentP and the book makes an undesirable switch of convention here. c J. Fessler, May 27, 2004, 13:18 (student version) 8.5 Symmetric real FIR filters, h[n] = h[M − 1 − n]; n = 0; : : : ; M − 1, are linear phase. Proof. Suppose M is even: M−1 H(z) = h[n] z−n Xn=0 M=2−1 M−1 = h[n] z−n + h[n] z−n (split sum) Xn=0 n=XM=2 M=2−1 M=2−1 0 = h[n] z−n + h[M − 1 − n0] z−(M−1−n ) (n0 = M − 1 − n) Xn=0 nX0=0 M=2−1 M=2−1 = h[n] z−n + h[n] z−(M−1−n) (symmetry of h[n]) Xn=0 Xn=0 M=2−1 = h[n] z−n + z−(M−1−n) (combine) Xn=0 h i M=2−1 = z−(M−1)=2 h[n] z(M−1)=2−n + z−((M−1)=2−n) (split phase). Xn=0 h i Thus the frequency response is H(!) = H(z) z=e|! M=2−1 = e−|!(M−1)=2 h[n] e|!((M−1)=2−n) + e−|!((M−1)=2−n) Xn=0 h i M=2−1 M − 1 = 2 e−|!(M−1)=2 h[n] cos ! − n 2 Xn=0 −|!(M−1)=2 = e Hr(!) M=2−1 M − 1 H (!) = 2 h[n] cos ! − n : (Real since h[n] is real.) r 2 Xn=0 Phase response: ! M−1; ! > \ − 2 Hr( ) 0 H(!) = M−1 −! 2 + π; Hr(!) < 0: The case for M odd is similar, and leads to the same phase response but with a slightly different Hr(!).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    24 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us