Digital Signal Processing Moslem Amiri, Václav Přenosil Masaryk University Understanding Digital Signal Processing, Third Edition, Richard Lyons (0-13-261480-4) © Pearson Education, 2011. Finite Impulse Response Filters 2 Introduction  Filtering  Filtering is the processing of a time-domain signal resulting in some change in that signal’s original spectral content  The change is usually the reduction, or filtering out, of some unwanted input spectral components  That is, filters allow certain frequencies to pass while attenuating other frequencies  Digital filter in Fig. 5-1(b)  Can be a software program in a computer, a programmable hardware processor, or a dedicated integrated circuit 3 Introduction 4 An Introduction to FIR Filters  FIR filter  Given a finite duration of nonzero input values, an FIR filter will always have a finite duration of nonzero output values  If FIR filter’s input is a sequence of all zeros, filter’s output will be all zeros  FIR filters use addition to calculate their outputs  Averaging is a kind of FIR filter 5 An Introduction to FIR Filters  Averaging example  We’re counting the number of cars that pass over a bridge every minute, and every minute we’ll calculate average number of cars/minute over the last five minutes Minute index No. of cars/minute over the last minute No. of cars/minute averaged over the last five minutes 1 10 - 2 22 - 3 24 - 4 42 - 5 37 27 6 77 40.4 7 89 53.8 8 22 53.4 9 63 57.6 10 9 52 6 An Introduction to FIR Filters 7 An Introduction to FIR Filters  Fig. 5-2  Sudden changes in input sequence of cars/minute are flattened out by averager  Since sudden transitions in a time sequence represent high-frequency components, averager is behaving like a lowpass filter  Averager is an FIR filter  No previous averager output value is used to determine a current output value; only input values are used to calculate output values  In addition, when input goes to zero, averager’s output approaches and settles to a value of zero 8 An Introduction to FIR Filters ∑−= =+−+−+−+−= ++++= n nk ave ave kxnxnxnxnxnxny xxxxxy 4 )( 5 1 )]()1()2()3()4([ 5 1 )( )]5()4()3()2()1([ 5 1 )5( 9 An Introduction to FIR Filters  Fig. 5-3  Referred to as filter structure  Is a physical depiction of how to calculate averaging filter outputs with the input sequence of values shifted, in order, from left to right along the top of filter as new output calculations are performed  Delay elements, called unit delays, merely indicate a shift register arrangement where input sample values are temporarily stored during an output calculation 10 An Introduction to FIR Filters 11 An Introduction to FIR Filters  Fig. 5-4  In (a), each of the first five input values is multiplied by 1/5, and the five products are summed to give the fifth filter output value  To calculate sixth output value, input sequence is right-shifted, discarding the first input value of 10, and the sixth input value, 77, is accepted on left  The filter’s structure using this shifting process is called a transversal filter  Because we tap off five separate input sample values to calculate an output value, the structure is called a 5-tap tapped-delay line FIR filter ∑−= =+−+−+−+−= n nk ave kxnxnxnxnxnxny 4 )( 5 1 )( 5 1 )1( 5 1 )2( 5 1 )3( 5 1 )4( 5 1 )( 12 Convolution in FIR Filters  Averaging filter convolution  Convolution equation  We can graphically depict this equation’s calculations as shown in Fig. 5-5  Input samples: x(0), x(1), x(2), …  Filter coefficients: h(0) through h(4)  In above equation, we use factor of 1/5 as filter coefficients multiplied by averaging filter’s input samples  Time order of inputs in Fig. 5-5 is reversed ∑−= =+−+−+−+−= n nk ave kxnxnxnxnxnxny 4 )( 5 1 )( 5 1 )1( 5 1 )2( 5 1 )3( 5 1 )4( 5 1 )( 13 Convolution in FIR Filters 14 Convolution in FIR Filters  FIR filter’s y(n)th output  For a general M-tap FIR filter, nth output is  This is convolution equation as it applies to digital FIR filters ∑= = −= +−+−+−+−= → +−+−+−+−= 4 0 )( tscoefficienfilter )()( )()0()1()1()2()2()3()3()4()4()( )( 5 1 )1( 5 1 )2( 5 1 )3( 5 1 )4( 5 1 )( k kh knxkh nxhnxhnxhnxhnxhny nxnxnxnxnxny ∑ − = −= 1 0 )()()( M k knxkhny 15 Convolution in FIR Filters  Impulse response of a filter  Filter’s output time-domain sequence when input is a single unity-valued sample (impulse) preceded and followed by zero-valued samples  Fig. 5-6  FIR filter’s impulse response is identical to the five filter coefficient values  For this reason, the terms FIR filter coefficients and impulse response are synonymous  Because there are a finite number of coefficients, impulse response will be finite in time duration  Finite impulse response, FIR 16 Convolution in FIR Filters 17 Convolution in FIR Filters  Process of convolution, as it applies to FIR filters  Two sequences resulting from h(k)*x(n) and H(m)·X(m) are Fourier transform pairs  Convolution in time domain is equivalent to multiplication in frequency domain )()()()()( IDFT DFT mXmHnxkhny ⋅  ←  → ∗= 18 Convolution in FIR Filters 19 Convolution in FIR Filters H(m) is sin(x)/x function 20 Convolution in FIR Filters Conversion of discrete frequency axis in Fig. 5-8 to continuous m = N/2 = 32 = folding frequency = fs/2 ideal lowpass filter poor lowpass filter 21 Convolution in FIR Filters initial four output samples (transient response) are not exactly sinusoidal: the no. of filter unitdelay elements = 4 averaging filter attenuates higherfrequency inputs further output is a sinewave of same frequency as input filter’s coefficients are symmetrical  input/output delay = half the no. of unit-delay elements = 2 samples (no dependence on frequency) 22 Convolution in FIR Filters Averager attenuates higher-frequency portion of input spectrum 23 Convolution in FIR Filters  Summary, so far  FIR filters perform time-domain convolution by summing the products of the shifted input samples and a sequence of filter coefficients  An FIR filter’s output sequence is equal to convolution of input sequence and a filter’s impulse response (coefficients)  An FIR filter’s frequency response is DFT of filter’s impulse response  An FIR filter’s output spectrum is product of input spectrum and filter’s frequency response  Convolution in time domain and multiplication in frequency domain are Fourier transform pairs 24 Convolution in FIR Filters 25 Convolution in FIR Filters  Fig. 5-12  Different sets of coefficients give us different frequency magnitude responses  A sudden change in values of coefficient sequence, such as 0.2 to 0 transition in the first coefficient set, causes ripples, or sidelobes, in frequency response  If we minimize suddenness of changes in coefficient values, such as the third set of coefficients in (a), we reduce sidelobe ripples in frequency response  However, reducing sidelobes results in increasing main lobe width of lowpass filter 26 Convolution in FIR Filters  We can have a filter with more than 5 taps  But input signal sample shifting, multiplications by constant coefficients, and summation are all there is to it 27 Lowpass FIR Filter Design  Design of a lowpass FIR filter  Design procedure starts with determination of a desired frequency response followed by calculating filter coefficients that will give us that response  There are two predominant techniques used to design FIR filters  1) window method  2) optimum method 28 Lowpass FIR Filter Design  Window design method  Begins with our deciding what frequency response we want for our lowpass filter  We can start by considering a continuous lowpass filter, and simulating that filter with a digital filter  We define the continuous frequency response H(f) to be ideal, i.e., a lowpass filter with unity gain at low frequencies and zero gain (infinite attenuation) beyond some cutoff frequency, as shown in Fig. 5-14(a)  Representing this H(f) response by a discrete frequency response is the same—with one difference: discrete frequency-domain representations are always periodic with the period being fs 29 Lowpass FIR Filter Design 30 Lowpass FIR Filter Design  Window design method  We have two ways to determine lowpass filter’s time-domain coefficients  The first way is algebraic  1. Develop an expression for discrete frequency response H(m)  2. Apply that expression to inverse DFT equation to get time domain h(k)  3. Evaluate that h(k) expression as a function of time index k  The second method is to define individual frequency-domain samples representing H(m) and then have a software routine perform inverse DFT of those samples, giving FIR filter coefficients 31 Lowpass FIR Filter Design  Window design method  In either method, we need only define the periodic H(m) over a single period of fs Hz  Defining H(m) in Fig. 5-14(b) over frequency span −fs/2 to fs/2 is the easiest form to analyze algebraically  Defining H(m) over frequency span 0 to fs is the best representation if we use inverse DFT to obtain filter’s coefficients 32 Lowpass FIR Filter Design  Algebraic method  We can define an arbitrary discrete frequency response H(m) using N samples to cover −fs/2 to fs/2 and establish K unity-valued samples for the passband of lowpass filter as shown in Fig. 5-15  A great deal of algebraic manipulation is required here that digital filter designers avoid performing IDFT algebraically )/sin( )/sin(1 )( )( 1 )( 2/ 1)2/( /2 Nk NKk N kh emH N kh N Nm Nkmj π π π ⋅= = ∑ +−= 33 Lowpass FIR Filter Design 34 Lowpass FIR Filter Design  Software IDFT method of FIR filter design 35 Lowpass FIR Filter Design  Software IDFT method of FIR filter design  Using a 32-point inverse FFT to implement a 32point inverse DFT of H(m) sequence in Fig. 5- 17(c), we get 32 h(k) values from k = −15 to k = 16 in Fig. 5-18(a)  Because we want final 31-tap h(k) filter coefficients to be symmetrical with their peak value in center of coefficient sample set, we drop k = 16 sample and shift k index to left from Fig. 5- 18(a), giving us the desired sin(x)/x form of h(k) as shown in Fig. 5-18(b)  This shift of index k will not change frequency magnitude response of FIR filter 36 Lowpass FIR Filter Design 37 Lowpass FIR Filter Design the more h(k) terms we use as filter coefficients, the closer we’ll approximate our ideal lowpass filter response 38 Lowpass FIR Filter Design  Why are passband ripples in lowpass FIR filter response in Fig. 5-19  Replacing h(k) and x(n) with h∞(k) and w(k)  h∞(k) represents an infinitely long sin(x)/x sequence of ideal lowpass FIR filter coefficients  w(k) represents a window sequence that we use to truncate sin(x)/x terms )()()()( )()()()( IDFT DFT IDFT DFT mXmHnxkh mXmHnxkh ∗  ←  → ⋅ ⋅  ←  → ∗ )()()()( IDFT DFT mWmHkwkh ∗  ←  → ⋅ ∞∞ 39 Lowpass FIR Filter Design length of w(k) is the no. of coefficients, or taps, we intend to use to implement our lowpass FIR filter 40 Lowpass FIR Filter Design FIR filter’s true frequency response is H(m) = H∞(m) * W(m) we can view a particular sample value of H(m) = H∞(m) * W(m) convolution as being sum of products of H∞(m) and W(m) for a particular frequency shift of W(m) unity for all of H∞(m)  a particular H(m) value is sum of W(m) samples that overlap H∞(m) rectangle with a W(m) frequency shift of 0 Hz, sum of W(m) samples that overlap H∞(m) rectangle is the value of H(m) at 0 Hz sum of positive and negative W(m) samples under H∞(m) rectangle varies as W(m) is shifted  ripples in passband peak of W(m)’s main lobe is outside H∞(m) rectangle  H(m)’s passband begins to roll off as W(m) shift continues, ripples in H(m) beyond the positive cutoff frequency ripples in H(m) are caused by sidelobes of W(m) 41 Lowpass FIR Filter Design  How many sin(x)/x coefficients do we have to use (or how wide must w(k) be) to get nice sharp falling edges and no ripples in H(m) passband?  As long as w(k) is a finite number of unity values (i.e., a rectangular window of finite width), there will be sidelobe ripples in W(m), and this will induce passband ripples in final H(m) frequency response 42 Lowpass FIR Filter Design we can make filter’s transition region narrower using additional h(k) filter coefficients, but we cannot eliminate passband ripple a wider w(k) does not even reduce peak-to-peak ripple magnitudes, as long as w(k) has sudden discontinuities 43 Lowpass FIR Filter Design  Gibbs’s phenomenon  The ripple is known as Gibbs’s phenomenon, which manifests itself anytime a function (w(k) in this case) with an instantaneous discontinuity is represented by a Fourier series  No finite set of sinusoids will be able to change fast enough to be exactly equal to an instantaneous discontinuity  No matter how wide w(k) window is, W(m) will always have sidelobe ripples 44 Lowpass FIR Filter Design  Windows used in FIR filter design  We can minimize FIR passband ripple with window functions the same way we minimized DFT leakage  Window FIR design method is the technique of reducing w(k)’s discontinuities by using window functions other than rectangular window 45 Lowpass FIR Filter Design 1,...,2,1,0for 1 4 cos08.0 1 2 cos5.042.0)( :functionindowBlackman w −=       − +      − −= Nk N k N k kw ππ smoothly tapered h(k) coefficients passband ripples are greatly reduced the price we paid for reduced passband ripple is a wider H(m) transition region we can get a steeper filter response rolloff by increasing the no. of taps in FIR filter (we should use a 63-coefficient Blackman window for a 63-tap FIR filter) 46 Lowpass FIR Filter Design greatly reduced sidelobe levels of Blackman window Blackman window’s main lobe is almost three times as wide as rectangular window’s main lobe 47 Lowpass FIR Filter Design  Summary of window method of FIR filter design  We pick a window function and multiply it by sin(x)/x values from h∞(k) to get our final h(k) filter coefficients 48 Lowpass FIR Filter Design  Window functions with more control over their frequency responses  There are two window functions with more flexibility in trading off the window’s main lobe width and sidelobe levels  Chebyshev and Kaiser window functions 49 Lowpass FIR Filter Design [ ] ∑= − − − ⋅ = −=−=                 − − = =      = ⋅                   ⋅⋅ = 24 0 2 2 2 1 1 1 )!(4 )( usingedapproximatbecanaluesfunction vBesselorder-zeroth)(where 2/)1(and1,...,2,1,0for )( 1 )( :dowKaiser win ,...,2,1,0and)10(cosh 1 coshwhere )(coshcosh coscoscos ofDFTinversepoint-the)( :windowChebyshev q q q o o o o q x xI xI NpNk I p pk I kw Nm N N N m N Nkw β β α α π α γ γ and β control parameters give us control over Chebyshev and Kaiser windows’ main lobe widths and sidelobe levels 50 Lowpass FIR Filter Design unlike the constant sidelobe peak levels of Chebyshev window, Kaiser window’s sidelobes decrease with increased frequency Kaiser sidelobes are higher than Chebyshev window’s sidelobes near main lobe 51 Lowpass FIR Filter Design Selecting different values for γ enables us to adjust sidelobe levels and see what effect those values have on main lobe width Chebyshev window function’s stopband attenuation, in dB AttenCheb = -20 γ 52 Lowpass FIR Filter Design 53 Lowpass FIR Filter Design  Chebyshev or Kaiser, which is the best?  Depends on the application  Digital filter designers typically experiment with various values of γ and β for Chebyshev and Kaiser windows to get the optimum WdB(m) for a particular application  Blackman window’s very low sidelobe levels outweigh its wide main lobe in many applications 54 Bandpass FIR Filter Design  Bandpass FIR filter design  Window method of lowpass FIR filter design can be used as the first step  Let’s say we want a 31-tap FIR filter with the frequency response shown in Fig. 5-22(a), but instead of being centered about zero Hz, we want filter’s passband to be centered about fs/4 Hz  If we define a lowpass FIR filter’s coefficients as hlp(k), to find hbp(k) coefficients of a bandpass FIR filter, we can shift Hlp(m)’s frequency response by multiplying hlp(k) lowpass coefficients by a sinusoid of fs/4 Hz (sshift(k)) 55 Bandpass FIR Filter Design actual magnitude of |Hbp(m)| is half that of the original |Hlp(m)| because half the values in hbp(k) are zero when sshift(k) corresponds exactly to fs/4 when we design an N-tap bandpass FIR filter centered at a frequency of fs/4 Hz, we only need to perform N/2 multiplications for each filter output sample hlp(k) lowpass coefficients have not been multiplied by any window function. In practice, we’d use an hlp(k) that has been windowed to reduce passband ripple If we wanted to center bandpass filter’s response at some frequency other than fs/4, we need to modify sshift(k) to represent sampled values of a sinusoid whose frequency is equal to the desired bandpass center frequency 56 Highpass FIR Filter Design  Highpass FIR filter design  We can use the bandpass FIR filter design technique to design a highpass FIR filter  To obtain coefficients for a highpass filter, we need only modify the shifting sequence sshift(k) to make it represent a sampled sinusoid whose frequency is fs/2  hhp(k) = hlp(k) . sshift(k) = hlp(k) . (1,-1,1,-1,etc.) 57 Highpass FIR Filter Design hhp(k) is merely hlp(k) with the sign changed for every other coefficient |Hhp(m)| response has the same amplitude as the original |Hlp(m)| hlp(k) lowpass coefficients have not been modified by any window function. In practice, we’d use a windowed hlp(k) to reduce passband ripple 58 Parks-McClellan Exchange FIR Filter Design Method  Parks-McClellan FIR filter design method  Also called Remez Exchange, or Optimal method  A popular technique used to design highperformance FIR filters to use this method, we have to visualize a desired frequency response Hd(m): we have to establish desired fpass, fstop, δp and δs 59 Parks-McClellan Exchange FIR Filter Design Method  Parks-McClellan FIR filter design method  Passband and stopband ripples, in decibels, are related to δp and δs by  Next, we apply these parameters to a software routine that generates the filter’s N time-domain h(k) coefficients where N is the minimum number of filter taps to achieve the desired filter response )(log20rippleStopband )1(log20ripplePassband 10 10 s p δ δ ⋅−= +⋅= 60 Parks-McClellan Exchange FIR Filter Design Method some software Parks-McClellan routines assume that we want δp and δs to be as small as possible and require us only to define the desired values of Hd(m) response as shown by solid black dots filter designer has the option to define some of Hd(m) values in transition band, and software calculates remaining undefined Hd(m) transition band values 61 Parks-McClellan Exchange FIR Filter Design Method the three filters have roughly the same stopband sidelobe levels, near main lobe, but ParksMcClellan filter has the more desirable (steeper) transition band roll-off 62 Half-band FIR Filters  Half-band FIR filter  Very useful in signal decimation and interpolation applications  Its frequency magnitude response is symmetrical about fs/4 point  fpass + fstop = fs/2  When filter has an odd number of taps, filter’s timedomain impulse response has every other filter coefficient being zero, except center coefficient  This enables us to avoid approximately half the number of multiplications when implementing this filter  For an N-tap half-band FIR filter, we’ll only need to perform (N + 1)/2 + 1 multiplications per output sample 63 Half-band FIR Filters coefficients for a 31-tap half-band filter where Δf is defined to be approximately fs/32 using ParksMcClellan FIR filter design method alternating h(k) coefficients are zero, so we perform 17 multiplications per output sample instead of the expected 31 multiplications h(1) and h(5) multipliers are absent 64 Half-band FIR Filters  Half-band FIR filter  To build linear-phase N-tap half-band FIR filters, having alternating zero-valued coefficients, N + 1 must be an integer multiple of four  If this restriction is not met, e.g. when N = 9, the first and last coefficients will both be equal to zero and can be discarded, yielding a 7-tap half-band filter  When designing a half-band filter, assuming that the modeled filter has a passband gain of unity, ensure that filter has a gain of 0.5 (−6 dB) at fs/4  Numerical computation errors yield alternate filter coefficients that are not exactly zero-valued  force those values to zero 65 Phase Response of FIR Filters the 25 h(k) sequence is padded with 103 zeros to take a 128point DFT, resulting in H(m) sample values at m = 17, H(m) experiences a polarity change of its real part while its imaginary part remains negative—this induces a true phaseangle discontinuity (in Fig. 5-35(c)) that really is a constituent of H(m) at m = 17. Additional phase discontinuities occur each time the real part of H(m) reverses polarity 66 Phase Response of FIR Filters software adds 360° to any negative angles in the range of −180° > ø ≥ −360° one of the dominant features of FIR filters is their linear phase response. Hø(m) is linear over the passband of H(m) 67 Phase Response of FIR Filters  Group delay  G = −dø/df  For FIR filters, group delay is slope of Hø(m) response curve  When group delay is constant, as it is over passband of all FIR filters having symmetrical coefficients, all frequency components of filter input signal are delayed by an equal amount of time G before they reach filter’s output  Crucial in communications signals  For amplitude modulation (AM) signals, constant group delay preserves time waveform shape of signal’s modulation envelope  Important because modulation portion of an AM signal contains signal’s information 68 Phase Response of FIR Filters  Group delay  Over passband frequency range for a linearphase, S-tap FIR filter, group delay is  D = S−1 is the number of unit-delay elements  ts is sample period (1/fs)  Eliminating ts factor changes its dimensions to samples  Passband phase-angle resolution  N = the number of points in DFT seconds 2 stD G ⋅ = N G  360⋅− =∆φ 69 Phase Response of FIR Filters 128-point DFT was used to obtain frequency responses in Figs. 5-34 and 5- 35; we could use N = 32-point or N = 64point DFTs phase-angle resolution is much finer here S = 25-tap filter in Fig. 5-34(a)  G = 12  Δø = −12 · 360°/32 = −135° S = 25-tap filter in Fig. 5-34(a)  G = 12  Δø = −12 · 360°/128 = −33.75° 70 Phase Response of FIR Filters  For FIR filters, output phase shift (in degrees) for passband frequency f = mfs/N, is  Relationship between phase responses in Fig. 5- 36 considering the phase delay associated with frequency of fs/32 N Gm mNfmH s  360 )/(delayphase ⋅⋅− =∆⋅== φφ DFT size, N Index m Hø(mfs / N) 32 1 −135° 64 2 −135° 128 4 −135° 71 Analyzing FIR Filters  Analyzing tapped-delay line, nonrecursive FIR filters  Means determining FIR filter’s frequency response based on known filter coefficients  Two ways to analyze  Using continuous-time Fourier algebra  Using discrete Fourier transform 72 Analyzing FIR Filters  Algebraic analysis of FIR filters  Uses DTFT equation  DTFT of an FIR filter having N coefficients (impulse response) represented by h(k), where k = 0, 1, 2, ..., N−1  H(ω) is an (N−1)th-order polynomial  ω is continuous and ranges from 0 to 2π rad/samp, corresponding to a continuous-time frequency range of 0 to fs Hz ∑ ∞ −∞= − = n jn enxX ω ω )()( ωωωω ω ω )1(20 1 0 )1(...)2()1()0( )()( −−−−− − = − −++++= = ∑ Njjjj N k jk eNheheheh ekhH 73 Analyzing FIR Filters  Example  A 4-tap FIR filter whose coefficients are h(k) = [0.2, 0.4, 0.4, 0.2]  Magnitude and phase (Hø(ω) = arctangent of ratio of imaginary part over real part of H(ω)) are plotted in Fig. 5-46 )]3sin(2.0)2sin(4.0)sin(4.0[ )3cos(2.0)2cos(4.0)cos(4.02.0 2.04.04.02.0 )3()2()1()0()()( 32order-3rdcomplex 320 3 0 ωωω ωωω ω ωωω ωωωωω ++− +++= +++= → +++== −−− −−−− = − ∑ j eee ehehehehekhH jjj jjjj k jk 74 Analyzing FIR Filters 75 Analyzing FIR Filters  DFT analysis of FIR filters  The most convenient way to determine an FIR filter’s frequency response is to perform DFT of filter’s coefficients ∑ − = − = 1 0 /2 )()( N k Nkmj ekhmH π 76 Analyzing FIR Filters We need more |H(m)| frequency-domain information. That is, we need improved frequency resolution. 77 Analyzing FIR Filters a finer-granularity version of H(m) obtained by zero padding h(k) coefficients circular white dots correspond to square dots in Fig. 5-47(b) 78 Analyzing FIR Filters  A filter’s complex H(m) frequency response sequence         = = − )( )( tan)( )()( 1 )( mH mH mH emHmH real imag mHj φ φ 79 Analyzing FIR Filters  FIR filter (constant) group delay  A filter has a linear phase response over its passband and will induce no phase distortion in its output signals  ω is continuous and ranges from −π to π radians/sample, corresponding to a continuous-time frequency range of −fs/2 to fs/2 Hz  Hø(ω) in radians ω in radians/sample G(ω) are time measured in samples samples )( )( )()()( )( ω ω ωωω φωφ d dH GeHH Hj − =→= 80 Analyzing FIR Filters 81 Analyzing FIR Filters  FIR filter group delay  Example: complex-valued frequency response of a K-tap moving average filter is  For symmetrical-coefficient FIR filters samples2 )( )2( )( )( )( 22/)15()( )2/sin( )2/sin( )( 5, 5, filteraveragemovingtap-5=K aofdelaygroup 5, filteraveragemovingtap-5=K aofresponsephase 2/)1( = −− = − = → −=−−= → = = = = −− ω ω ω ω ω ωωω ω ω ω φ φ ω d d d dH G H K eH K Kma K Kj ma seconds 22 samples 2 seconds samples s s f DDt G D G == =D = the no. of unitdelay elements in filter’s delay line 82 Analyzing FIR Filters  FIR filter group delay  In general, group delay of a tapped-delay line FIR digital filter, whose impulse response is symmetric, is  If a tapped-delay line (FIR) network has an antisymmetrical impulse response, it also has a linear phase response and its group delay is also described by above equation  Antisymmetrical impulse response: h(k)=−h(N−k−1) where 0≤k≤(N−1)/2 when N is odd and 0≤k≤(N/2)−1 when N is even samples 2 1lengthresponseimpulse samples − =G 83 Analyzing FIR Filters samples 2 samples D G = fractional delay 84 Analyzing FIR Filters  FIR filter passband gain  Passband gain is filter’s passband magnitude response level around which the passband ripple fluctuates  In practice we design filters to have very small passband ripple, so a lowpass filter’s passband gain is roughly equal to its DC gain (gain at 0 Hz)  DC gain is sum of filter’s impulse response sequence, i.e., sum of FIR filter’s coefficients  Most commercial FIR filter design software packages compute filter coefficients such that their passband gain is unity 85 Analyzing FIR Filters passband gain equals unity here 86 Analyzing FIR Filters  Estimating the number of FIR filter taps  How do we estimate the number of filter taps (coefficients), N, that can satisfy a given frequency magnitude response of an FIR filter?  A simple expression proposed by Prof. Fred Harris for N, for passband ripple values near 0.1 dB, is  Atten = desired stopband attenuation measured in dB  fpass and fstop are frequencies normalized to fs sample rate in Hz E.g., fpass = 0.2 means that continuous-time frequency of fpass is 0.2fs Hz )(22 passstop FIR ff Atten N − ≈ 87 Analyzing FIR Filters 8.21 )1000/2501000/350(22 48 )(22 25.035.0 FIR dB48attenstopband Hz350= Hz250= Hz1000= Assuming passstop FIR = − ≈ → − ≈ =  N ff Atten N stop pass s f f f the lowpass filter can be built using a 22-tap FIR filter