Digital Signal Processing IIR Filter IIR Filter Design by Approximation of Derivatives Analogue filters having rational transfer function H(s) can be described by the linear constant coefficient differential equation. One of the simplest methods for converting an analog filter into a digital filter is to approximate the differential equation by an equivalent difference equation. This approach is often used to solve a linear constant coefficient differential equation numerically on a digital computer. For the derivative dy(t)/dt at a time t = nT we substitute the backward difference [y[n]-y[n-1)]/T. Thus dy ( t ) dt t nT y (n ) y (n 1) T (1) Where T represents the sampling interval and y(n) = y(nT). The analogue differentiator with output dy(t)/dt has the system function H(s) = s, while the digital system that produces the output [y(n)y(n-1)]/T has the transfer function H(s) = (1 – z-1)/T. Consequently, the frequency domain equivalent is: 1 z 1 s T (2) The second derivative d2y(t)/dt2 is replaced by the second difference which is given by d 2 y(t ) y(n) 2y(n 1) y(n 2) 2 dt T2 (3) In the frequency domain, (3) is equivalent to 1 1 2z z s T2 2 2 1 z T 1 2 (4) It is easy to generalize equation (2) and (4) as sk 1 z 1 T k (5) Implications: From (2) we have z 1 1 sT (6) If we substitute s = jw in (6), we have 1 1 wT z j 2 2 1 jwT 1 w T 1 w 2T2 (7) As w varies from - to + , the corresponding locus of points in the z-plane is a circle of radius ½ and with centre at z =1/2, as shown in the figure given on the next slide. jw s-plane 1/2 The above figure shows that the mapping in (7) takes points in the LHP of s into corresponding points inside this circle (i.e. circle with radius ½ and the points in RHP plane in s are mapped into points outside this circle. Consequently, this mapping has the desirable property that a stable analog filter is Transformed into a stable digital filter. However, the possible location of the poles of the digital filter are confined to relatively small frequencies and, thus, the mapping is restricted to low-pass and band-pass filters having relatively small resonant frequencies. Example1: Convert the analogue bandpass filter with system function given below into a digital IIR filter by use of the backward difference for the derivative. H(s) 1 s 0.12 9 Solution: substituting s = (1-z-1)/T yields H( z ) 1 1 z T 1 2 0.1 9 Bilinear Method) Transformation (Tustin’s This is the most widely used transformation which is suitable for the design of low-pass, high-pass, band-pass and band-stop filters. In the Bilinear Transformation (BLT) method, the basic operation required to convert an analogue filter is to replace s as follows: sk z 1 , z 1 k = 1 or 2/T (8) To investigate the characteristics transformation, let z = rejwT s = + jw’ Now rejwT 1 z 1 z 1 rejwT 1 sk of the bilinear k r2 1 2r si nwT k j 2 2 1 r 2r cos wT 1 r 2r cos wT Consequently, k r 2 1 1 r 2 2 r cos wT wT w' k 1r22rsin 2r cos wT (9) (10) Note that if r < 1, <0, and if r > 1, > 0. Consequently, the LHP in s maps into the inside of the unit circle in the z-plane and the RHP in s maps into the outside of the unit circle. When r = 1, then = 0 and w' k 1sincoswTwT k tan wT2 (11) 2 1 w ' or w tan k T (12) The relationship between the frequency variables in the two domains is illustrated in the following figure: 20 18 16 14 w’ 12 10 8 6 4 2 00 0.5 1 1.5 2 2.5 3 w 3.5 From the figure we observe that the mapping between w and w’ is almost linear for small values of w, but becomes non-linear for larger values of w, leading to a distortion (or warping) of the digital frequency response. This effect is normally compensated for by pre-warping the the analog filter before applying the bilinear transformation. To compensate for the effect, we pre-warp one or more critical frequencies before applying the BLT. For example, for a low-pass filter, we often pre-warp the cutoff or bandedge frequency as follows: w pT w k tan 2 ' p where wp = specified cutoff frequency w’p = prewarped cutoff frequency k = 1 or 2/T T = sampling period. (13) Summary of the BLT method of coefficient calculation: For standard, frequency selective IIR filters, the steps for using the BLT method may be summarized as follows: 1. Use the digital filter specifications to find a suitable normalized, prototype, analogue lowpass filter, H(s). 2. Determine and prewarp the bandedge or critical frequencies of the desired filter. 3. Denormalize the analog prototype filter by replacing s in the transfer function H(s), using one of the following transformations, depending on the type of filter required: s s s w 'p lowpass to lowpass (14) lowpass to highpass (15) lowpass to bandpass (16) lowpass to bandstop (17) w 'p s s 2 w 02 s Ws Ws s 2 s w 02 where W w'p2 w'p1 and w02 w'p2w'p1 4. Apply the BLT to obtain the desired digital filter transfer function. Example 1:Design a digital low-pass filter to approximate the following transfer function: 1 H (s ) 2 s 2s 1 Using the BLT method obtain the transfer function, H(z), of the digital filter, assuming a 3 dB cutoff frequency of 150 Hz and a sampling frequency of 1.28kHz. Solution: wp = 2150 rad/sec, T = 1/Fs = 1/1280, giving a prewarped critical frequency of w’p = tan(wpT/2) = 0.3857. The frequency scaled analog filter is given by H' s 1 s / w ' 2 p 2sw 1 ' p w 'p s 2 2sw'p 1 0.1488 2 s 0.5455 s 0.1488 Applying the BLT gives H( z ) H' (s) s z1 z 1 0.0878z 2 0.1756z 0.0878 z 2 1.0048z 0.3561 0.08781 2z 1 z 2 1 1.0048z 1 0.3561z 2 Example 2: The normalized transfer function of a simple, analog lowpass, filter given by H (s ) 1 s1 Starting from the s-plane, determine, using the BLT method, the transfer function of an equivalent discrete time high-pass filter. Assume a sampling frequency of 150 Hz and a cutoff frequency of 30 Hz. Solution: The cut-off frequency of the digital filter is wp = 230 rad/sec. The cut-off frequency, after prewarping is w’p = tan(wpT/2). With T = 1/150, w’p = tan(/5) = 0.7265. Using the low to high-pass transformation of equation (15), the denormalized analog transfer function is obtained as H( z ) H' (s) w'p s s s s 0.7265 The z-transfer function is obtained by applying the BLT: Hz H' (s) s z1 z 1 z 1 / z 1 0.13671 z 1 z 1 / z 1 0.7265 1 0.1584z 1 Example 3: A discrete time bandpass filter with Butterworth characteristics meeting the specifications given below is required. Obtain the coefficients of the filter using the BLT method. passband 200 – 300 Hz sampling frequency 2 kHz filter order 2 Solution: A first-order normalized analog low-pass filter is required (since the frequency band transformation for for bandpass filters – equation (16) – will double the filter order. Thus 1 H (s ) s1 The prewarped critical frequencies are: w p 1T 2 200 tan w 'p1 tan 0.3249 2 2000 2 w p 2T 2 300 ' w p 2 tan tan 2 2000 0.5095 2 w 02 w 'p1w 'p 2 0.1655 W w 'p 2 w 'p1 0.1846 Using the lowpass-to-bandpass transformation, equation (16), we have H' (s) H(s) 1 s2 w02 s Ws Ws s2 w 2 2 2 0 s Ws w 0 Ws 1 Applying the BLT gives H( z ) H' s s z1 z 1 1 z 2 0.1367 1 1.2362z 1 0.7265z 2