Digital Signal Processing II Lecture : FIR & IIR Filter Design Marc Moonen Dept EE/ESAT, KULeuven marcmoonen@esatuleuvenbe wwwesatuleuvenbe/sc/ DSP-II p
PART-I : Filter Design/Realiation Step- : efine filter specs pass-ban, stop-ban, optimiation criterion, Step- : erive optimal transfer function FIR or IIR esign Lecture- Step-3 : filter realiation bloc scheme/flow graph irect form realiations, lattice realiations, Lecture-3 Step-4 : filter implementation software/harware finite wor-length issues, question: implemente filter esigne filter? Lecture-4 DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
Lecture- : FIR & IIR Filter Design FIR filters Linear-phase FIR filters FIR esign by optimiation Weighte least-squares esign, Minimax esign FIR esign in practice `Winows, Equiripple esign, Software Matlab, IIR filters Poles an Zeros IIR esign by optimiation Weighte least-squares esign, Minimax esign IIR esign in practice Analog IIR esign : Butterworth/Chebyshev/elliptic Analog->igital : impulse invariant, bilinear transform, Software Matlab DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 3
FIR Filters FIR filter finite impulse response filter B H b b b Also nown as `moving average filters MA poles at the origin hence guarantee stability eros eros of B, `all ero filters correspons to ifference equation y[ ] b u [ ] b u [ ] b u [ ] impulse response h[ ] b, h[] b,, h[ ] b, h[ ], DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 4
Linear Phase FIR Filters on-causal ero-phase filters : example: symmetric impulse response h[-l], h[-],h[],h[],,h[l] h[]h[-], L frequency response is H e jx e cos x L L j j e h[ ] e cos L jx L ie real-value ero-phase transfer function DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 5
Linear Phase FIR Filters Causal linear-phase filters non-causal ero-phase elay example: symmetric impulse response & even h[],h[],,h[] L even h[]h[-], L frequency response is H L j j jl e h[ ] e e cos ie causal implementation of ero-phase filter, by introucing group elay L e j e jl DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 6
e Linear Phase FIR Filters Type- Type- Type-3 Type-4 Leven Lo Leven Lo symmetric symmetric anti-symmetric anti-symmetric h[]h[-] h[]h[-] h[]-h[-] h[]-h[-] j / L cos e j / cos L cos j / sin L j / e sin cos ero at π ero at, π ero at LP/HP/BP LP/BP BP HP je L cos j PS: `moulating Type- with,-,,-, gives Type-4 LP->HP PS: `moulating Type-4 with,-,,-, gives Type- HP->LP PS: `moulating Type- with,-,,-, gives Type- LP<->HP PS: `moulating Type-3 with,-,,-, gives Type-3 BP<->BP PS: IIR filters can EVER have linear-phase property! proof see literature DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 7
Ex: Low-pass Filter Specification δ P 8 Passban Ripple P S 6 Passban Cutoff -> <- Stopban Cutoff 4 Stopban Ripple δ S 5 5 5 3 DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 8
DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 9 FIR Filter Design by Optimiation I Weighte Least Squares Design : select one of the basic forms that yiel linear phase eg Type- specify esire frequency response LP,HP,BP, optimiation criterion is where is a weighting function cos / / A e e e H j L j j / j A e H 444 4 3 444 4,,,,,, min min L L L F j A A W H e H W π π π π W
FIR Filter Design by Optimiation this is equivalent to min x F,, L 64447 4448 T T { x Q x x p µ } [ ] W c c W A `Quaratic Optimiation problem x c T Q p T π π µ x OPT Q p T L c [ cos cos L ] DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
FIR Filter Design by Optimiation Example: Low-pass esign A, < A, π S P pass - ban stop - ban 8 6 4 Passban Ripple Passban Cutoff -> <- Stopban Cutoff Stopban Ripple optimiation function is ie F P π 5 5 5 3,, L A γ A 44 443 S 443 4 pass - ban stop - ban W, < W γ, π P S DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
FIR Filter Design by Optimiation a simpler problem is obtaine by replacing the F by where the wi s are a set of n selecte sample frequencies This leas to an equivalent `iscretie quaratic optimiation function: T T T F,, L W i c i : A i x Q x x p µ i L T Q W i c i c i, p W i A i c i, µ i W A,, L i i A i i F : simple - - - : unpreictable behavior in between sample freqs x OPT Q p i Compare to p DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
FIR Filter Design by Optimiation This is often supplemente with aitional constraints, eg for pass-ban an stop-ban ripple control : A P, i δ, P for pass - ban freqs P,, P,, δ P is pass - ban ripple A S, i δ, S for stop - ban freqs S,, S,, δ S is stop - ban ripple The resulting optimiation problem is : minimie : quaratic function F x A T,, [ ] subject to P P pass-ban constraints A S x b x b stop-ban constraints `Quaratic Programming problem S L DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 3 L
DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 4 FIR Filter Design by Optimiation II `Minimax Design : select one of the basic forms that yiel linear phase eg Type- specify esire frequency response LP,HP,BP, optimiation criterion is where is a weighting function cos / / A e e e H j L j j / j A e H max min max min,,,, π π j A A W H e H W L L W
FIR Filter Design by Optimiation this is equivalent to min Ignore this slie subject to W with c T x T c [ L] [ cos cos L ] the constraint is equivalent to a so-calle `semi-efiniteness constraint where D> enotes that the matrix is positive semi-efinite x δ T x A δ for π T δ W c x A D T W c x A DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 5
Filter Design by Optimiation a realistic way to implement these constraints, is to impose the constraints only on a set of sample frequencies : Ignore this slie min x δ subject to D : D : : D m ie a `Semi-Definite Programming SDP problem, for which efficient interior-point algorithms an software are available DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 6
FIR Filter Design by Optimiation Conclusion: I weighte least squares esign II minimax esign provie general `framewor, proceures to translate filter esign problems into stanar optimiation problems In practice an in textboos: emphasis on specific a-hoc proceures : - filter esign base on `winows - equiripple esign DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 7
DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 8 FIR Filter Design using `Winows Example : Low-pass filter esign ieal low-pass filter is hence ieal time-omain impulse response is truncate h[] to samples : a group elay to turn into causal filter < < π p C C H < < e e H h c c j j sin ] [ α π π π < < otherwise / / ] [ ] [ h h π
FIR Filter Design using `Winows Example : Low-pass filter esign continue PS : it can be shown that the filter obtaine by such time-omain truncation is also obtaine by using a weighte least-squares esign proceure with the given H, an weighting function truncation correspons to applying a `rectangular winow : h[ ] h [ ] w[ ] w[ ] / < < otherwise : simple proceure also for HP,BP, - - - : truncation in time-omain results in `Gibbs effect in frequency omain, ie large ripple in pass-ban an stop-ban at ban ege iscontinuity, which cannot be reuce by increasing the filter orer / W DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 9
FIR Filter Design using `Winows Remey : apply winows other than rectangular winow: time-omain multiplication with a winow function w[] correspons to frequency omain convolution with W : h[ ] h [ ] w[ ] H H * W caniate winows : Han, Hamming, Blacman, Kaiser, see textboos, see DSP-I winow choice/esign trae-off between sie-lobe levels efine pea pass-/stop-ban ripple an with main-lobe efines transition banwith DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
FIR Equiripple Design Starting point is minimax criterion, eg min max π W A A min,, max,, L L π Base on theory of Chebyshev approximation an the `alternation theorem, which roughly states that the optimal s are such that the `max maximum weighte approximation error is obtaine at L extremal frequencies E max E E for i,, L π i that hence will exhibit the same maximum ripple `equiripple Iterative proceure for computing extremal frequencies, etc Reme exchange algorithm, Pars-McClellan algorithm Very flexible, etc, available in many software pacages Details omitte here see textboos DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
FIR Filter Design Software FIR Filter esign abunantly available in commercial software Matlab: bfirn,wn,type,winow, winowe linear-phase FIR esign, n is filter orer, Wn efines ban-eges, type is `high,`stop, bfirn,f,m,winow, winowe FIR esign base on inverse Fourier transform with frequency points f an corresponing magnitue response m bremen,f,m, equiripple linear-phase FIR esign with Pars- McClellan Reme exchange algorithm See exercise sessions DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p
DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 3 IIR filters Rational transfer function : poles eros of A, eros eros of B infinitely long impulse response stable iff poles lie insie the unit circle correspons to ifference equation also nown as `ARMA autoregressive-moving average a a b b b a a b b b A B H ] [ ] [ ] [ ] [ ] [ ] [ u b u b u b y a y a y 4444 4 3 4444 4 44444 4 3 44444 4 ' ` ' ` ] [ ] [ ] [ ] [ ] [ ] [ AR MA y a y a u b u b u b y
IIR Filter Design low-orer filters can prouce sharp frequency response low computational cost - - - esign more ifficult stability shoul be chece/guarantee phase response not easily controlle eg no linear-phase IIR filters coefficient sensitivity, quantiation noise, etc can be a problem see Lecture-4 DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 4
IIR filters Frequency response versus pole-ero location : cfr frequency response is -transform evaluate on the unit circle Example- : pole pole Low-pass filter poles at 8 ± j yquist freq - Im DC Re pole near unit-circle introuces `pea in frequency response hence pass-ban can be set by pole placement DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 5
IIR filters Frequency response versus pole-ero location : Example- : Low-pass filter pole pole poles at 8 ± j yquist freq eros at 75 ± 66 j ero DC ero near or on unit-circle introuces `ip or transmision ero in freq response hence stop-ban can be emphasie by ero placement DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 6
IIR Filter Design by Optimiation I Weighte Least Squares Design : IIR filter transfer function is B b b H A a specify esire frequency response LP,HP,BP, H optimiation criterion is min π b,, b,,, a a j W H e H π 44444 444443 F b b a,, b,, a where W is a weighting function stability constraint :, a A, DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 7
IIR Filter Design by Optimiation II `Minimax Design : IIR filter transfer function is B b b H A a specify esire frequency response LP,HP,BP, H optimiation criterion is W b a where is a weighting function stability constraint : A, j minb,,,,, max b a a π W H e H DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 8
IIR Filter Design by Optimiation These optimiation problems are significantly more complex than those for the FIR esign case : Problem-: presence of enominator polynomial leas to non-linear non-quaratic optimiation A possible proceure `Steiglit-McBrie consists in iteratively,, minimiing F b W,,, b A,, a, W,, a, π W π B e j H A e j which leas to iterative Quaratic Programming, etc similar for minimax DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 9
IIR Filter Design by Optimiation These optimiation problems are significantly more complex than those for the FIR esign case : Problem-: stability constraint eros of a high-orer polynomial are relate to the polynomial s coefficients in a highly non-linear manner Solutions base on alternative stability constraints, that eg are affine functions of the filter coefficients, etc Topic of ongoing research, etails omitte here DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 3
IIR Filter Design by Optimiation Conclusion: I weighte least squares esign II minimax esign provie general `framewor, proceures to translate filter esign problems into ``stanar optimiation problems In practice an in textboos: emphasis on specific a-hoc proceures : - IIR filter esign base analog filter esign s-omain esign an analog->igital conversion - IIR filter esign by moeling irect -omain esign Pae approximation, Prony, etc, not aresse here DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 3
Analog IIR Filter Design Commonly use analog filters : Lowpass Butterworth filters - all-pole filters H characterie by a specific G s G j H s H s s H j magnitue response G: filter orer - poles of GsHsH-s are equally space on circle of raius c c c poles of Hs 4 poles of H-s - Then Hjw is foun to be monotonic in pass-ban & stop-ban, with `maximum flat response, ie - erivatives are ero at, c DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 3
DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 33 Analog IIR Filter Design Commonly use analog filters : Lowpass Chebyshev filters type-i all-pole filters characterie by magnitue response filter orer is relate to passban ripple are Chebyshev polynomials: c T j H j G s H s H s G ε ε T x x T x x T x T x x T x x T x T
Analog IIR Filter Design Commonly use analog filters : Lowpass Chebyshev filters type-i All-pole filters, poles of HsH-s are on ellipse in s-plane Equiripple in the pass-ban Monotone in the stop-ban Lowpass Chebyshev filters type-ii Pole-ero filters base on Chebyshev polynomials Monotone in the pass-ban Equiripple in the stop-ban Lowpass Elliptic Cauer filters Pole-ero filters base on Jacobian elliptic functions Equiripple in the pass-ban an stop-ban hence yiel smallest-orer for given set of specs H j ε U c DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 34
Analog IIR Filter Design Frequency Transformations : Principle : prototype low-pass filter eg cut-off frequency ra/sec is transforme to properly scale low-pass, high-pass, banpass, ban-stop, filter s example: replacing s by moves cut-off frequency to C C C example: replacing s by turns LP into HP, with cut-off frequency s C example: replacing s by turns LP into BP etc s s DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 35
Analog -> Digital Principle : esign analog filter LP/HP/BP/, an then convert it to a igital filter Conversion methos: - convert ifferential equation into ifference equation - convert continuous-time impulse response into iscrete-time impulse response - convert transfer function Hs into transfer function H Requirement: the left-half plane of the s-plane shoul map into the insie of the unit circle in the -plane, so that a stable analog filter is converte into a stable igital filter DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 36
Conversion methos: Analog -> Digital I convert ifferential equation into ifference equation : -in a ifference equation, a erivative y/t is replace by a `bacwar ifference yt-yt-t/ty[]-y[-]/t, where Tsampling interval -similarly, a secon erivative, etc -eventually etails omitte, this correspons to replacing s by -//T in Has analog transfer function : H H a s Ignore this slie s-plane jw -plane -stable analog filters are mappe into stable igital filters, but pole location for igital filter confine to only a small region o only for LP or BP s j T s s DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 37
Conversion methos: Ignore this slie Analog -> Digital II convert continuous-time impulse response into iscrete-time impulse response : -given continuous-time impulse response hat, iscrete-time impulse response is h[ ] h T where Tsampling interval a -eventually etails omitte this correspons to a many-to-one mapping st e s-plane jw -plane j s s ± jπ / T -aliasing! if continuous-time response has significant frequency content above the yquist frequency DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 38
Analog -> Digital Conversion methos: III convert continuous-time system transfer function into iscrete-time system transfer function : Bilinear Transform -mapping that transforms whole! jw-axis of the s-plane into unit circle in the -plane only once, ie that avois aliasing of the frequency components H H a s s T s-plane jw s s j -plane j e -for low-frequencies, this is an approximation of -for high frequencies : significant frequency compression `warping sometimes pre-compensate by `pre-warping st DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 39
IIR Filter Design Software IIR filter esign consierably more complicate than FIR esign stability, phase response, etc Fortunately IIR Filter esign abunantly available in commercial software Matlab: [b,a]butter/cheby/cheby/ellipn,,wn, IIR LP/HP/BP/BS esign base on analog prototypes, pre-warping, bilinear transform, immeiately gives H oef! analog prototypes, transforms, can also be calle iniviually filter orer estimation tool etc See exercise sessions DSP-II Version 8-9 Lecture- FIR/IIR Filter Design p 4