Department of Computer Eng. Sharif University of Technology Discrete-time signal processing Chapter 7: FILTER DESIGN TECHNIQUES Content and Figures are from Discrete-Time Signal Processing, 2e by Oppenheim, Shafer and Buck, ©1999-2000 Prentice Hall Inc. Filter Design Techniques DSP • Filter: – Any discrete-time system that modifies certain frequencies • Frequency-selective filters pass only certain frequency components and totally reject all others • Filter Design Steps: – Specification • Problem or application specific – Approximation of specification with a discrete-time system • Our focus is to go from spec to discrete-time system – Implementation • Realization of discrete-time systems depends on target technology • Desired filter is generally implemented with digital computation – It is used to filter a sampled and digitized continuous-time signal Chapter 7: Filter Design Techniques 1 DSP Filter Design Techniques • We have already studied the use of discrete-time systems to implement a continuous-time system – If our specifications are given in continuous time we can use: xc(t) C/D xn H(ej) yn D/C yr(t) H e j H c j / T – It can be noted that the specifications for filters are typically given in frequency domain Chapter 7: Filter Design Techniques 2 Filter Specifications DSP • Specifications – Passband 0.99 H eff j 1.01 0 2 2000 – Stopband H eff j 0.001 • Parameters 2 3000 1 0.01 2 0.001 p 2 2000 • Specs in dB s 2 3000 – Ideal passband gain =20log(1) = 0 dB – Max passband gain = 20log(1.01) = 0.086dB – Max stopband gain = 20log(0.001) = -60 dB Chapter 7: Filter Design Techniques 3 Discrete Signal Processing 7.1 Discrete-Time IIR Filter Design from Continuous-Time Filters Chapter 7: Filter Design Techniques 4 7.1.1 Filter Design by Impulse Invariance DSP • Remember impulse invariance – Mapping a continuous-time impulse response to discrete-time – Mapping a continuous-time frequency response to discrete-time h n Td hc nTd H e j 2 Hc j j Td k Td k • If the continuous-time filter is bandlimited to H c j 0 H e j / Td Hc j Td • In this design procedure: – Start with discrete-time spec in terms of (Td has no role in the process) – Go to continuous-time = /T and design continuous-time filter – Use impulse invariance to map it back to discrete-time = T • Works best for practical filters due to possible aliasing Chapter 7: Filter Design Techniques 5 DSP Impulse Invariance of System Functions • Develop impulse invariance relation between system functions • Partial fraction expansion of transfer function of continuous-time N filter: A Hc s k 1 • Corresponding impulse response: k s sk N s t Ak e k hc t k 1 0 t0 t0 • Impulse response of discrete-time filter: N h n Td hc nTd Td Ak e k 1 N sk nTd u n Td Ak e sk Td k 1 u n n • System function: N Td Ak sk Td 1 z k 1 1 e H z • Pole s=sk in s-plane transforms into a pole at e s T in the z-plane k d Chapter 7: Filter Design Techniques 6 DSP Example • Impulse invariance applied to Butterworth 0.89125 H e j 1 H e j 0.17783 0 0.2 0.3 • Since sampling rate Td cancels out we can assume Td=1 • Map spec to continuous time 0.89125 H j 1 H j 0.17783 0 0.2 0.3 • Butterworth filter is monotonic so spec will be satisfied if Hc j0.2 0.89125 and Hc j0.3 0.17783 Hc j 2 1 1 j / jc 2N • Determine N and c to satisfy these conditions Chapter 7: Filter Design Techniques 7 DSP Example Cont’d • Satisfy both constrains 0.2 1 c 2N 1 0.89125 2 and 0.3 1 c 2N 1 0.17783 2 • Solve these equations to get N 5.8858 6 and 0.70474 c • N must be an integer so we round it up to meet the spec • Poles of transfer function sk 1 1/12 jc c e j /12 2k 11 • The transfer function H s for k 0,1,...,11 0.12093 s 2 0.364s 0.4945 s 2 0.9945s 0.4945 s 2 1.3585s 0.4945 • Mapping to z-domain 0.2871 0.4466 z 1 2.1428 1.1455 z 1 H z 1 1.2971z 1 0.6949 z 2 1 1.0691z 1 0.3699 z 2 1.8557 0.6303z 1 1 0.9972 z 1 0.257 z 2 Chapter 7: Filter Design Techniques 8 Example Cont’d Chapter 7: Filter Design Techniques DSP 9 Filter Design by Bilinear Transformation DSP • Avoids the aliasing problem of impulse invariance • Maps the entire s-plane onto the unit-circle in the z-plane – Nonlinear transformation – Frequency response subject to warping • Bilinear transformation 2 s Td • Transformed system function 1 z 1 1 1 z 2 H z Hc Td 1 z 1 1 1 z • Again Td cancels out so we can ignore it • We can solve the transformation for z as 1 Td / 2 s 1 Td / 2 jTd / 2 s j z 1 Td / 2 s 1 Td / 2 jTd / 2 • Maps the left-half s-plane into the inside of the unit-circle in z – Stable in one domain would stay in the other Chapter 7: Filter Design Techniques 10 DSP Bilinear Transformation • On the unit circle the transform becomes 1 jTd / 2 z e j 1 jTd / 2 • To derive the relation between and 2 s Td 1 e j j 1 e 2 j Td 2e j / 2 j sin / 2 2 j tan j / 2 2 e cos / 2 T 2 d • Which yields 2 tan Td 2 or Td 2 2arctan Chapter 7: Filter Design Techniques 11 Bilinear Transformation Chapter 7: Filter Design Techniques DSP 12 DSP Example • Bilinear transform applied to Butterworth 0.89125 H e j 1 H e j 0.17783 0 0.2 0.3 • Apply bilinear transformation to specifications 2 0.2 0.89125 H j 1 0 tan Td 2 0.3 tan Td 2 H j 0.17783 2 • We can assume Td=1 and apply the specifications to H c j 2 • To get 2 tan 0.1 1 c 2N 1 0.89125 2 1 1 / c 2N 2 tan 0.15 and 1 c Chapter 7: Filter Design Techniques 2N 1 0.17783 2 13 DSP Example Cont’d • Solve N and c 2 2 1 1 log 1 1 0.17783 0.89125 N 5.305 6 2log tan 0.15 tan 0.1 c 0.766 • The resulting transfer function has the following poles sk 1 1/12 jc c e j /12 2k 11 for k 0,1,...,11 • Resulting in Hc s 0.20238 s 2 0.3996s 0.5871 s 2 1.0836s 0.5871 s 2 1.4802 s 0.5871 • Applying the bilinear transform yields H z 0.0007378 1 z 1 1.2686 z 1 1 6 0.7051z 2 1 1.0106 z 1 0.3583 z 2 1 0.9044 z 1 1 0.2155 z 2 Chapter 7: Filter Design Techniques 14 DSP Example Cont’d Chapter 7: Filter Design Techniques 15 DSP 7.2 Design of FIR Filters By Windowing Chapter 7: Filter Design Techniques 16 DSP Filter Design by Windowing • Simplest way of designing FIR filters • Method is all discrete-time no continuous-time involved • Start with ideal frequency response h ne Hd e j d jn n 1 j jn hd n H e e d d 2 • Choose ideal frequency response as desired response • Most ideal impulse responses are of infinite length • The easiest way to obtain a causal FIR filter from ideal is hd n 0 n M hn else 0 • More generally hn hd nwn where 1 0 n M wn else 0 Chapter 7: Filter Design Techniques 17 DSP Windowing in Frequency Domain • Windowed frequency response H e j 1 2 H d e j W e j d • The windowed version is smeared version of desired response • If w[n]=1 for all n, then W(ej) is pulse train with 2 period Chapter 7: Filter Design Techniques 18 Properties of Windows DSP • Prefer windows that concentrate around DC in frequency – Less smearing, closer approximation • Prefer window that has minimal span in time – Less coefficient in designed filter, computationally efficient • So we want concentration in time and in frequency – Contradictory requirements • Example: Rectangular window e W e j M n 0 e j M / 2 j n 1 e j M 1 1 e j sin M 1 / 2 sin / 2 Chapter 7: Filter Design Techniques 19 Rectangular Window DSP • Narrowest main lobe – 4/(M+1) – Sharpest transitions at discontinuities in frequency • Large side lobes – -13 dB – Large oscillation around discontinuities • Simplest window possible 1 0 n M w n else 0 Chapter 7: Filter Design Techniques 20 Bartlett (Triangular) Window DSP • Medium main lobe – 8/M • Side lobes – -25 dB • Hamming window performs better • Simple equation 2n / M w n 2 2n / M 0 0 n M /2 M /2 n M else Chapter 7: Filter Design Techniques 21 Hanning Window DSP • Medium main lobe – 8/M • Side lobes – -31 dB • Hamming window performs better • Same complexity as Hamming 1 2 n 1 cos 0 n M w n 2 M 0 else Chapter 7: Filter Design Techniques 22 Hamming Window DSP • Medium main lobe – 8/M • Good side lobes – -41 dB • Simpler than Blackman 2 n 0.54 0.46 cos 0nM w n M 0 else Chapter 7: Filter Design Techniques 23 Blackman Window DSP • Large main lobe – 12/M • Very good side lobes – -57 dB • Complex equation 2 n 0.42 0.5cos M 0nM w n 4 n 0.08cos M 0 else Chapter 7: Filter Design Techniques 24 Incorporation of Generalized Linear Phase DSP • Windows are designed with linear phase in mind – Symmetric around M/2 w M n 0 n M w n 0 else • So their Fourier transform are of the form W e j We e j e j M / 2 where We e j is a real and even • Will keep symmetry properties of the desired impulse response • Assume symmetric desired response H d e j H e e j e j M / 2 • With symmetric window Ae e j 1 2 j j H e W e d e e – Periodic convolution of real functions Chapter 7: Filter Design Techniques 26 Linear-Phase Lowpass filter DSP • Desired frequency response H lp e j j M / 2 c e c 0 • Corresponding impulse response hlp n sin c n M / 2 n M / 2 • Desired response is even symmetric, use symmetric window h n sin c n M / 2 n M / 2 w n Chapter 7: Filter Design Techniques 27 Kaiser Window Filter Design Method DSP • Parameterized equation forming a set of windows – Parameter to change mainlobe width and side-lobe area trade-off 2 I0 1 n M / 2 M/2 wn I0 0 0nM else – I0(.) represents zerothorder modified Bessel function of 1st kind Chapter 7: Filter Design Techniques 28 Determining Kaiser Window Parameters DSP • Given filter specifications Kaiser developed empirical equations – Given the peak approximation error or in dB as A=-20log10 – and transition band width s p • The shape parameter should be 0.1102 A 8.7 A 50 0.4 0.5842 A 21 0.07886 A 21 21 A 50 0 A 21 • The filter order M is determined approximately by M A8 2.285 Chapter 7: Filter Design Techniques 29 Example: Kaiser Window Design of a Lowpass Filter DSP p 0.4 , s 0.6 , 1 0.01, 2 0.001 • Specifications • Window design methods assume min(1 , 2 ) 0.001 • Determine cut-off frequency – Due to the symmetry we can choose it to be c 0.5 • Compute s p 0.2 A 20log10 60 • And Kaiser window parameters 5.653 M 37 • Then the impulse response is given as 2 n 18.5 I 0 5.653 1 sin 0.5 n 18.5 18.5 h n n 18.5 I 0 5.653 0 Chapter 7: Filter Design Techniques 0nM else 30 DSP Example Cont’d Approximation Error 1 Ae (e j ) 0 p , E A ( ) j 0 A ( e ) s . e Chapter 7: Filter Design Techniques 31 General Frequency Selective Filters DSP • A general multiband impulse response can be written as N mb hmb n Gk Gk 1 k 1 sin k n M / 2 n M / 2 • Window methods can be applied to multiband filters • Example multiband frequency response – Special cases of • Bandpass • Highpass • Bandstop Chapter 7: Filter Design Techniques 32 DSP 7.4 Optimum Approximation of FIR Filters Chapter 7: Filter Design Techniques 33 DSP Optimum Filter Design • Filter design by windows is simple but not optimal – Like to design filters with minimal length • Optimality Criterion – Window design with rectangular filter is optimal in one sense • Minimizes the mean-squared approximation error to desired response • But causes large error around discontinuities hd n 0 n M h n else 0 1 2 2 H e H e j j d 2 d – Alternative criteria can give better results • Minimax: Minimize maximum error • Frequency-weighted error • Most popular method: Parks-McClellan Algorithm – Reformulates filter design problem as function approximation Chapter 7: Filter Design Techniques 34 DSP Function Approximation • Consider the design of type I FIR filter – Assume zero-phase for simplicity – Can delay by sufficient amount to make causal h ne he n he n Ae e – Assume L=M/2 an integer j L e jn n L h 0 2h ncosn Ae e j L e e n 1 • After delaying the resulting impulse response hn he n M / 2 hM n H e j A e e j e jM / 2 • Example approximation mask – Low-pass filter Chapter 7: Filter Design Techniques 35 DSP Polynomial Approximation • Using Chebyshev polynomials cos n Tn cos where Tn x cos n cos 1 x • Express the following as aL sum of powers L k Ae e j he 0 2he n cos n ak cos n 1 • Can also be represented as P x Ae e j x cos k 0 L where P x ak x k • Parks and McClellan fix p, s, and L k 0 – Convert filter design to an approximation problem • The approximation error is defined as E W H d e j Ae e j – – – – W() is the weighting function Hd(ej) is the desired frequency response Both defined only over the passpand and stopband Transition bands are unconstrained Chapter 7: Filter Design Techniques 36 Lowpass Filter Approximation DSP • The weighting function for lowpass filter is 2 W 1 1 0 p s • This choice will force the error to = 2 in both bands • Criterion used is minmax min max E he n:0 nL F • F is the set of frequencies the approximations is made over Chapter 7: Filter Design Techniques 37 DSP Alternation Theorem • Fp denote the closed subset – consisting of the disjoint union of closed subsets of the real axis x • • • • r The following is an order polynomial P x ak x k k 0 Dp(x) denotes given desired function that is continuous on Fp Wp(x) is a positive function that is continuous on Fp The weighted error is given as rth E p x Wp x D p x P x • The maximum error is defined as E max E p x xFp • A necessary and sufficient condition that P(x) be the unique rth order polynomial that minimizes E is that Ep(x) exhibit at least (r+2) alternations • There must be at least (r+2) values xi in Fp such that x1<x2<…<xr+2 E p xi E p xi 1 E for i 1,2,...,(r 2) Chapter 7: Filter Design Techniques 38 DSP Example Not alternations • Examine polynomials P(x) • that approximate 1 for 1 x 0.1 0 for 0.1 x 1 • Fifth order polynomials shown • Which satisfy the theorem? Not alternations Chapter 7: Filter Design Techniques 39 DSP Optimal Type I Lowpass Filters • In this case the P(x) polynomial is the cosine polynomial L P cos ak cos k k 0 • The desired lowpass filter frequency response (x=cos) 1 cos p 1 Dp cos 0 1 cos s • The weighting function is given as 1/ K Wp cos 1 cos p 1 1 cos s • The approximation error is given as E p cos Wp cos Dp cos P cos Chapter 7: Filter Design Techniques 40 Typical Example Lowpass Filter Approximation DSP • 7th order approximation Chapter 7: Filter Design Techniques 41 Properties of Type I Lowpass Filters DSP • Maximum possible number of alternations of the error is L+3 • Alternations will always occur at p and s • All points with zero slope inside the passpand and all points with zero slope inside the stopband will correspond to alternations – The filter will be equiripple except possibly at 0 and Chapter 7: Filter Design Techniques 42 Flowchart of Parks-McClellan Algorithm Chapter 7: Filter Design Techniques DSP 43 DSP Butterworth Lowpass Filters • Passband is designed to be maximally flat • The magnitude-squared function is of the form H c j 1 2 1 j / j c sk 1 1/ 2 N Hc s 2 2N jc c e j / 2 N 2 k N 1 1 1 s / j c 2N for k 0,1,...,2N-1 Chapter 7: Filter Design Techniques 44
© Copyright 2026 Paperzz