hapter 7: Filter Design 7. Practical Filter Terminology Analog and digital filters and their designs constitute one of the major emphasis areas in signal processing and communication systems. This is due to the fact that most of the LTI system blocks have a transfer function of a LP, HP, BP, BS or all pass nature. Traditionally, filters and their implementations have been in the analog realm but more and more digital versions become the staple of the engineering design tools. We have presented the spectral descriptions of ideal filters. Terminology of a practical analog LP filter: H ( w δ δ δ Observations: In addition to passband extending to w P and stopband starting from w S w P rad/s or H, depending on the units of the horiontal axis. wp 7. ws w S, there is a transition region The ripple of ± δ around the nominal value of. in the passband is called the passband or in-band ripple.
Similarly, δ at the highest level that the spectrum can reach in the stopband is called stopband ripple. Both of these ripple parameters are expressed either in db or in percentage. An analog LP filter is expressed by: δ H( w δ H( w δ A digital LP filter is expressed by: H( δ H( δ if S if w w if w w if P Smaller the transition better the performance or higher the roll-off of a filter. P S Filters are specified in terms of these characteristics and there are both FIR and IIR structures for realiation. Some filter classes have no ripple in the passband and some others exhibit equi-ripple characteristics. Almost all the time LP filters or LPF equivalent of other filters are designed and special transformations are used for obtaining actual systems. 7. Filter Parameter Transformations There are standard transformations for converting a frequency-selective filter from one type to another one both for the continuous systems and the digital ones. Given a LP transfer function H (s with a normalied cut-off frequency unity (., and convert it to a LP filter with a cutoff of w via: w (7. (7. s s. (7.3 where s represents the transformed frequency variable. Since mapped to w w. Therefore, the transformation w w. w, then frequency range w is 7.
s w s. (7.4 w transforms a LP filter to a new LP filter with a cutoff frequency filter classes as shown in the table below. Filter Type Low Pass High Pass Band Pass Band Stop Transformation s w w s w ( s w, w BW w s s w.( w BW w s, w. There are similar transformations for other w w. BW w w Similarly, the discrete-time case is handled in terms of -transforms. Given a LP filter with a cutoff frequency we want to obtain another one with a cutoff frequency., By using the form: α α or equivalently e j we have: exp[ j.tan ( ( α Sin } α ( α. os α α (7.5 (7.6 7.3
the transformation maps the unit circle in the -plane into a unit circle in the given by: plane. The required α is Sin[( / ] α (7.7 Sin[( / ] Transformations are tabulated below: Assume that is the desired cutoff frequency for LP/HP filters and upper frequencies for the BP/BS filters., Filter Type Transformation Associated Formulas Low Pass High Pass Band Pass Band Stop ( α α α α α. k k k k k α. k k k α. k k k k α. k k Sin[( α Sin[( Sin[( α Sin[( os[( α os[( k ot[( os[( α os[( k Tan[( / ] / ] are the desired lower and / ] / ] / ] / ] / ]. Tan / ] / ] / ]. Tan 7.4
7.5 7.3 Butterworth Filters The Butterworth filter class is an infinite impulse response filter. Let us recall the governing difference equation of IIR systems: N l M k k l k n x b l n y a n y ] [. ] [. ] [ and N l l l M k k k a b D N X Y H.. ( ( ( ( ( (7.8 They have no passband ripple and the magnitude square for order N is described by: N w w w H ( / ( (7.9
Magnitude is a monotonically decreasing function of w. It has a -3. db at the normalied frequency of., which is also known as the 3 db bandwidth. Butterworth is called a maximally flat approximation to ideal low-pass filters. The filter transfer function is obtained from: H( s. H( s s jw H( w (7. ( jw s N N [ ] [ ] j j It is easy to see that the poles of H (s are given by the roots of: σ k s [ ] j N e j( k j(k N / N for k,,, L,N (7. s k e skσ k jwk for k,,, L,N (7. k N k k N k os( Sin(. and w k Sin( os( (7.3 N N N N For instance, Butterworth filter for N3 has poles on the unit circle: j / 3 j / 3 j3 / 3 j s e ; s e ; s e e 4 j4 / 3 s e ; 5 j5 / 3 j6 / 3 6 s e ; s e 7.6
To get a stable transfer function we MUST chose the poles of H (s in the LH plane, which results in: H ( s j / 3 j j4 / 3 ( s e ( s e ( s e ( s s ( s The coefficients of this third order Butterworth filter is given by a table: Butterworth Filter oefficients for orders through 8 Order a a a 3 a 4 a 5 a 6 a 7 a 8 3 4.63 3.4.63 5 3.36 5.36 5.36 3.36 6 3.864 7.464 9.4 7.464 3.864 7 4.494.3 4.66 4.66.3 4.494 8 5.6 3.8.88 5.69.88 3.8 5.6 To obtain a particular filter with a 3dB cutoff frequency at corresponding magnitude characteristic is then expressed by: w, we replace s in H (s with a s / w.the H( s N ( w / w with the two constraints: H ( w P δ and H ( w S δ w P N We must satisfy: ( ( w δ w S N and ( ( w δ δ( δ Log ( δ ( δ To results in the order of the filter: N Int[ [{ }] Log ( w P / w (7.4 S 7.7 δ
Design Steps:. Determine equation N from (7.4, which must be the nearest integer.. Determine w from the expressions of constraints. 3. For the computed N determine the denominator polynomial of normalied H (s from the table. 4. Find the unnormalied transfer function by replacing s in H (s with s / w, which will be a unity gain filter. 5. Adjust the gain of the filter by the desired amplification factor, if needed. Example 7.: Design a low-pass Butterworth filter to have an attenuation no more than. db for w rad / s and at least 5 db for w 5 rad / s. Log ( δ δ.87 and Log ( δ 5 δ. 778 These result at N.645 N 3. From the table we have: 3 H ( s /( s s s and the second constraint yields w 86.8 rad / s. 3 3 H ( s (86.8 /[ s * (86.8. s * (86.8. s (86.8 When implemented using matlab we have: 3 ] 7.8
Example 7.: An electro-cardiogram produces a voltage proportional to the heartbeat potentials. The doctor uses the plots after the raw data is filtered by an experimentally determined filter with the following impulse response: 3 t 43 t 93t h( t 568. e. e [485os76t 668Sin76t] e [83os85t 55Sin85t] An analysis yields a 5 th Order Butterworth filter with a cutoff frequency of 47.75 H and unity gain. % Example 7. 5-th Butterworth filter for electro-cardiogram plots. [n,d]butter(5,*pi*47.75,'s'; for i:sie(n,-; n(i; end; pmap(n,d; [r,p,k]residue(n,d delta.**pi*47.75 w:delta:*delta; hfreqs(n,d,w; magabs(h; plot(w,mag r [.e *; -.446.76i; -.446 -.76i; -.47-3.348i; -.47 3.348i; 5.6837] p [.e *; -.97.8534i; -.97 -.8534i; -.47.7635i; -.47 -.7635i; -3.] k [ ] 7.9
7.4 hebychev Filters The hebychev filter class si based on hebychev osine polynomials: os( N. os w w N ( w (7.5 osh( N. osh w w > and we can use the following recursion to generate higher-order terms: N ( w. w. N ( w N ( w; ( w ; ( w w (7.6 The resulting filter has a low-pass characteric or order N: H( s (7.7 ε N ( w The magnitude characteristics: H ( s has ripples between and / ε and for large values of w, stop-band region: H ( w / ε. N ( w ; (7.8 Attenuation (loss loss. Log ε. Log N ( w (7.9 for large w : loss. Log ε 6( N. N. Log w (7. 7.
Design Steps:. From the passband specification determine equation ε from (7.8, which must be the nearest integer.. Using the stop-band specification and (7. determine N. 3. Let us introduce a new parameter: β. Sinh ( (7. N ε 4. The poles of H (s are: s σ jw for k,,, L, N (7. k k k k k σ k Sin(.. Sinh( β and wk os(.. osh( β (7.3 N N which are located on an ellipse in the s-plane with an equation: σ k wk (7.4 Sinh ( β osh ( β 7.
Example 7.3: onsider a hebychev filter with attenuation not more than. db for least db for w 5 rads/ s. Let us normalie the parameters: w P. and w S 5... Log ε.59 ε. Log.59 6( N. Log 5 N [.9] s / ± j/ wp s, 545.3 ± j89.9 wp H ( s ( s 545.3 (89.9 w rads/ s and at Finally, an approximation to the ideal low-pass filter can be made in terms of Jacobi elliptic sine functions, which results in a smaller order or a sharper roll-off for a given order. The cost of this improvement is the presence of ripples in both the passband and stopband and stability issues. 7.
Example 7.4: 7 th Order Butterworth, hebychev I and Elliptic Filters % Example 7.4 Seventh Order IIR filters % Filter design functions [nb,db]butter(7,,'s'; [nc,dc]cheby(7,3,,'s'; [ne,de]ellip(7,.5,,.5,'s'; %Pole-ero maps pmap(nb,db; figure; pmap(nc,dc; figure; pmap(ne,de; figure; % Magnitude and phase computations w-6:.:6 hbfreqs(nb,db,w; hcfreqs(nc,dc,w; hefreqs(ne,de,w; magbabs(hb; magcabs(hc; mageabs(he; phasebangle(hb; phasecangle(hc; phaseeangle(he; % Plotting functions plot(w,magb,'r',w,magc,'g',w,mage,'b'; figure; plot(w,phaseb,'r',w,phasec,'g',w,phasee,'b'; end; 7.3
7.5 Impulse Invariant Design of Digital IIR Filters The digital versions of the previous set of IIR filters are obtained by equating the impulse responses at the sampling instances: h[ n] ha ( nt (7.5 and the digital frequency variable is related to its analog counterpart via: 7.4
w.t (7.6 Design Steps:. From the specified pass-band and stop-band cutoff frequencies: P, S and 7.6 find their analog counterparts.. Determine the analog transfer function H a (s as it was done in Sections 7.3 or 7.4. 3. Expand H a (s in partial fractions and obtain -transform of each term from a s-transform to -transform conversion tables. 4. ombine the terms to obtain H (. Example 7.5: Let us re-visit the filtering problem of Example 7.. Using w 836. 8 and H (s from that exercise and partial fraction expansion: 3 (86.8 H( s 3 3 [ s *(86.8. s *(86.8. s (86.8 86.8 86.8* ( s 43.4.5* (86.8 s 86.8 ( s 43.4 (448. ( s 43.4 (448. From the conversion table, we have get the transfer function in -domain and for H ( 86.8*[ e 43.4T 86.8*[.433. e 43.4T. e. os(448.t e T. { os(448.t ZSin(448.T } 43.4T.973. ].374..59 86.8TT which can be amplitude normalied and implemented in terms of canonical building blocks. ms These tables can be found in R and other mathematical tables or in many texts including Soliman & Srinath, ontinuous and Discrete Signals and Systems, nd Edition, Prentice-Hall, 998 The table has been included as a courtesy of the publishers. 7.5
Example 7.6: Let us design a Butterworth LP filter with specifications: Passband amplitude to be within. db for frequencies below. rads/ s and the stopband magnitude to be less than - db for.4 rads/ s or above. Assume unity gain at D.. 7.6
P.; S. 4 implies:. Log H (. H (.. H (.4 H (.4. Log For impulse-invariance design we have the equivalent analog filter specifications for. H a(. and H a(.4 This results fro a Butterworth filter:. N..4 N H a ( jw ( and ( N ( w/ w w w Solution yields: N [.978] and w.785 rads / s.56 H( s ( s / w *( s / w s.* s.56 The corresponding -transfer function:.5854 H (.5.36 w T for T. 7.7
7.6 Digital FIR Filters Digital finite-impulse response filters are also known as non-recursive filters are the most practical filters with absolute stability and no feedback. anonical form of these filters are feedforward structures and consist of delay, multiply and accumulators and written by a difference equation of the form: x[n] y[n] h[] h[] h[] h[ N ] N N h[ N ] y [ n] x[ n k]. h[ n] h[ n k]. x[ n] (7.7 k k They have linear phase provided we have symmetrical coefficients: h[ n] h[ N n] (7.8 Their frequency responses are obtained from the term-by-term DTFT operation. However, filters of sie odd and even exhibit different characteristics. For N : even N N / N H ( h[ n]. e h[ n]. e h[ n]. e (7.9 n jn n jn n N / 7.8 jn
Replace n by N n in the second sum and substitute (7.8: H( N / n Similarly, for N : odd N / n h[ n]. e jn N / n h[ n]. os( ( n h[ n]. e N. e j( N n N j 7.9 N j (7.3a N ( N 3 / N h ( h(. h[ n]. os( ( n.. e (7.3b n In both cases, the term in braces is real, so that the phase of H ( is given by the complex exponential at N the end, which exhibit a linear phase shift or equivalently a delay of samples. Given a desired frequency response H d (, such as an ideal low-pass filter symmetric about the origin, the corresponding impulse response h d [n] is symmetric about n. The most general procedure for obtaining FIR filter of length N is to obtain a finite sequence with a finite-length window sequence: w [n]. If h d [n] is symmetric then it has linear phase but the system is non-causal. N ausal impulse response is obtained by shifting the sequence to the right by samples. Design Procedure:. Obtain H d ( from h d [n] via DFT.. Multiply h d [n] by the window function w [n].. 3. Find the impulse response of the digital filter: h[ n] hd [ n ( N / ]. w[ n] (7.3 4. Determine H ( via -transform or alternatively find the -transform H ( of the sequence h d [ n]. w[ n] : H ( ( N /. H ( (7.3
7.6 Design of Windowed FIR Filters Depending upon the selection of a specific window function, one gets different filtering behavior.. Rectangular window filter: n N w R [ n] (7.33 Otherwise. Bartlett window filter: n / N n N w B [ n] [n / N ] ( N / n N (7.4 Otherwise 3. Hanning window filter:.5 *[ os(n. w Han [ n] 4. Hamming window filter: /( N ] n N Otherwise 7. (7.4
.54.46 * os(n. w Ham [ n] 5. Blackman window filter: /( N n N 7. Otherwise.4.5 * os(n. /( N.8 * os(4n. /( N w Bl [ n] 6. Kaiser window filter: w K I [ n] N N ( α[( ( n N I [ α( ] / ] n N Otherwise n N Otherwise (7.4 (7.43 (7.44 where I ( is the modified ero-order Bessel function of the first kind usually studied with FM modulation. x Example 7.7: Let us design a 9-point LP FIR filter with a cutoff frequency.. j. n Sin(.n. hd [ n] e d (7.45 n. For a 9-point window, we evaluate h d [n] for 4 n 4 :.47.37.475.588.588.475.37.47 Rectangular: h d [ n] {,,,,,,,, }.47 4.37 3.475.588.588 H ( 4.47 8.37 7.475 H ( H ( ( ( ( Similarly, for a 9-point Hamming window filter (7.4 results in a sequence:.475.37 3.47 6.588 3 5 4 ( 4
7. {.8,.5,.54,.865,,.865,.54,.5,.8} ] [ n w 4 5 3 6 7 8 4 4 3 3 4 (.58 (.57 (.68 (. (. (..68.57.58.58.57.68. ( }.,.68,.57,.58,,.58,.57,.68,. { ] [ ]. [ H H H w n n h d The frequency responses clearly indicate differences in behavior. 9-point Rectangular Window LP Filter 9-point Hamming Window LP Filter
Example 7.8: Let us design a differentiator (Hilbert Transformer, which cannot be implemented in the analog domain. Hilbert transformer is used for obtaining single-side band (SSB communication signal to generate signals that are in phase quadrature to a sinusoidal input. The ideal differentiator: H ( w jw (7.46 Hilbert transformer: H ( w jsgn( w (7.47 Desired response in the frequency-domain: H d ( w H( w ws / w ws / (7.48 H d ( H( T w for some sampling period T. Expand the desired spectrum in a Fourier series since it was periodic: jn d hd [ n] e n jn d [ n] H d (. e H (. (7.49 h d If H d ( is purely real, the impulse response exhibits even symmetry; hd [ n] hd [ n]. If H ( is purely imaginary, the impulse response exhibits odd symmetry; h [ n] h [ n]. d 7.3 d d (7.5 If the input to a Hilbert transformer is x a ( t os ( w t then we get the output y a ( t Sin ( w t. The impulse response of this transformer is given by: n even jn hd [ n] j. Sgn(. e. d (7.5 n odd n For a rectangular window of length 5 the impulse sequence from (7.5 becomes: h d [ n] {,,,,,,,,,,,,,, } 7 5 3 3 5 7 4 6 8 4 H ( [ ] 7 5 3 3 5 7 Frequency response of this rectangular and similarly Hamming window versions of 5 tap filter are displayed.
7.4