9. Finite Impulse Response Filters and the Z-transform We are going to have two lectures on filters you can find much more material in Bob Crosson s notes. In the first lecture we will focus on some of the theory underlying convolution filters, which are also known as finite impulse response (FIR) filters. In the second lecture, we will discuss the practical aspects of filtering. Filtering in the time domain In Lecture 3 on Linear Systems and Convolution, we introduced the idea of linear systems or linear filters. We can write the filtering operation in the time domain symbolically in terms of an operator L as x(t)! [ L]! y(t) or y(t) = L[ x(t) ] (9-1) We can characterize a filter by measuring its response to a delta function! ( t) " [ L] " g( t) (9-2) The response of the filter to any other input is a convolution of the input and the impulse response of the filter x t ( )! [ L]! g( t) * x( t) (9-3) If we extend this to the discrete domain we get the same result. If we define a discrete delta function as! k =1 k = 0 (9-4) = 0 k! 0 then! k " L " g k (9-5) and the output y k for input sequence x k is given by a discrete convolution N!1 y k = " g l x k!l (9-6) l=0 A filter of the type g k that is applied by a convolution is termed a finite impulse response filter. Z-transform To understand how filters work we will introduce the Z-transform. If we consider a sequence b j = [b 0, b 1, b N-1 ] where samples with negative indices are zero and the index 0 corresponds to time zeros, then the Z transform of b j is given by Z! " b j # $ = B( z) = b 0 z0 z 1 + b 2 z 2 +... + b N%1 z N%1 where z is a complex number. If we set N%1 ( ) = & b k z j (9-7) z = exp(! 2"ik ), k = 0, 1,..., N! 1 (9-8) N j=0 9-1
in equation 9-7, the Z transform gives the components of the discrete Fourier transform of the time series b k. Fourier transforms are just a special case of the Z transform in which z is constrained to sit on the unit circle in the complex plane at uniformly spaced points. As one might expect the properties of the Z transform are analogous to the Fourier transform and there are two that are particularly important for our applications. First multiplication of a Z transform by z (equivalent to multiplying a DFT by exp(-2!ik/n)) results in a time delay of one sample. Second convolution in the time domain is equivalent to multiplication in the Z transform domain Z! " c j * d j # $ = C( z).d( z) (9-9) We can demonstrate this with a simple example. If the time domain c j = [ 1 2 3], d j = [ 2 5] 1 2 3 (9-10) c j * d j = = [ 2 9 16 15] 5 2 In the Z transform domain C( z) = 1+ 2z + 3z, C( z) = 2 + 5z C( z).d( z) = ( 1! 2) + ( 2! 2 + 1! 5)z + ( 3! 2 + 2! 5)z 2 + ( 3! 5)z 3 (9-11) = 2 + 9z + 16z 2 + 15z 3 which gives the same result. Frequency Response As we showed in lecture 3, an alternative to characterizing a filter by measuring its impulse response in the time domain, we could also characterize its response by inputting a harmonic waves at different frequencies and characterizing its frequency response or transfer function. In the digital domain we can write " exp i2!kj % # $ N & ' ( [ L] ( y j (9-12) We know we can relate k and j to the frequency and time respectively by f = k, N!t t = j!t (9-13) By defining f ' = k N, t ' = j (9-14) we obtain a dimensionless frequency that has a periodicity of 1 and a Nyquist frequency of 0.5, and a dimensionless time which has a sample interval of unity. Equation (9-12) becomes exp( i2! f 't ') " L " y t ' (9-15) For convenience we will drop the primes. We will consider 3 filters in both the frequency and the z domain 9-2
1. Consider a very simple scaling filter (convolution with a single element filter b 0 ). Equation (9-12) gives exp( i2! ft) " [ b 0 ] " b 0 exp( i2! ft) (9-16) The filter response is the output over the input and is given by Filter Transfer Function = output = G( f ) X ( f ) = G( f ) (9-17) input X ( f ) Clearly for the scaling filter we can write G( f ) = b 0 (9-18) The scaling filter has a flat frequency response. We can generalize this filter to an arbitrary input x t! b 0 [ ]! y t In the Z-domain Y z ( ) = b 0 X ( z) to yield a transfer function (or response) ( ) = Y ( z) X ( z) = b 0 B z 2. Now consider a unit delay filter (convolution with a filter [0 b 1 ]) exp i2! ft $% &' (9-19) ( ) " [ b 1 z] " b 1 exp i2! f ( t # 1) From equation (9-17) we get G( f ) = b 1 exp (!i2" f ) (9-20) The amplitude (or magnitude) spectrum is G(f ) = b 1 and the phase spectrum -2!f. The function acts to retard the phase by 2!f. The convention for filters is to use the phase lag spectrum (the negative of the phase spectrum) which is for this filter is " ( f ) = 2!f. As we are already aware from our work with the Fourier transform, one applies a delay or lag in the time domain by applying a linear adjustment to phase in the frequency domain. Again, we can generalize this filter to an arbitrary input x t! b 1 z [ ]! y t (9-21) In the Z-domain this gives Y ( z) = b 1 zx z which yields a transfer function (or response) B z ( ) (9-22) ( ) = Y ( z) X ( z) = b 1z (9-23) 3. Finally consider a two-element filter with [b 0 b 1 ]. Applying this filter to a harmonic filter gives exp i2! ft $% &' (9-24) ( ) " b 0 z [ ] " b 0 exp[ i2! ft] exp i2! f t # 1 The frequency response is 9-3 ( )
G( f ) = b 0 exp (!i2" f ) = #$ b 0 cos( 2" f )%&! i b (9-25) #$ 1 sin( 2" f )%& We can generalize this filter to an arbitrary input x t! [ b 0 z]! y t (9-26) In the Z-domain Y ( z) = [ b 0 z] X ( z) (9-27) to yield a transfer function (or response) ( ) = Y ( z) X ( z) = b 0 z (9-28) B z The amplitude spectrum is given by the magnitude of G( f ) ( ) ( ) G( f ) = "# b 0 cos 2! f $% 2 + "# b 1 sin 2! f $% 2 ( ) = b 0 2 2 + 2b 0 b 1 cos 2! f The amplitude spectrum has two interesting properties. (9-29) First we can see that the two element filters [b 0 b 1 ] and [b 1 b 0 ] have the same amplitude a set of filters with the same amplitude response is termed a suite. Second we can see that if b 0 b 1 > 0, that is if b 0 and b 1 have the same sign then G(0) > G(0.5) which means the amplitude response at zero frequency is higher than at the Nyquist frequency. We have a low pass filter. Conversely, if b 0 b 1 < 0, that is if b 0 and b 1 have opposite signs, then G(0) < G(0.5) which means the amplitude response at zero frequency is lower than at the Nyquist frequency. We have a high pass filter. The phase lag spectrum is given by $ b!( f ) = tan "1 1 sin( 2# f ) ' & ) (9-30) % b 0 cos( 2# f )( Now if b 0 > b 1, it is clear that the denominator of equation (9-30) does not change sign. For -0.5 > f > 0.5, -!/2 < "(f ) <!/2 and if we look at the phase over a large interval it will remain bounded between these limits. However, if b 0 < b 1, the denominator of equation will change sign and the expression in square brackets will go to infinity. For -0.5 > f > 0.5, "(f ) will vary between! and! and when viewed over a larger frequency interval it will be unbounded (once the 2! jumps are removed at the Nyquist frequency and its periodic repetition) For this reason a two element filter with b 0 > b 1 is known as minimum phase while a two element filter with b 0 < b 1 is known as maximum phase. An alternate way to write the filter response given by equation (9-28) is in terms of its root # B z ( ) = b 0 z = k b (! " z) k b = "b 1 ;! = " b 0 b 1 (9-31) 9-4
We can immediately see that for a value of z = #, the filter gives a response of zero. If the magnitude # >1 the filter is minimum phase while if # <1 it is maximum phase. Filters with more than two elements can be constructed by convolving together two element filters. If all the component two-element filters are minimum phase then the resulting filter will be minimum phase and the phase will be bounded. If all the component two-element filters are maximum phase then the resulting filter will be maximum phase and the phase will be unbounded. If some of the two element component filters are minimum phase and others are maximum phase, the resulting filter is termed mixed-phase. Unlike a two-element filter, the magnitude of the successive elements in a minimum phase filter does not decay monotonically but it does have the fastest build up of partial energy of the filter suite. That is the quantity M E partial = " b 2 j, 0! M < N (9-32) j =o is a maximum for the minimum phase filter. For this reason minimum phase filters are also known as minimum delay filters. Maximum phase filters have the slowest build up of partial energy in a filter suite and are therefore are known as maximum delay. For most applications, it is preferable to use either a minimum phase filter or a mixed-phase filter with a linear phase response (i.e., a constant delay for all frequencies). 9-5
1.5 Figure 9.1 Minimum Phase, b = [1 0.5] Amplitude 1.4 1.3 1.2 1.1 1 0.9 0.8 0.7 0.5 0.4 Phase Lag, radians 0.2 0 0.2 0.4 0.8 Frequency
1.5 Figure 9.2 Minimum Phase, b = [1 0.5] Amplitude 1.4 1.3 1.2 1.1 1 0.9 0.8 0.7 0.5 0.4 Phase Lag, radians 0.2 0 0.2 0.4 0.8 Frequency
1.5 Figure 9.3 Maximum Phase, b = [0.5 1] Amplitude 1.4 1.3 1.2 1.1 1 0.9 0.8 0.7 0.5 0 1 Phase Lag, radians 2 3 4 5 6 7 Frequency