EE 422G Notes: Chapter 9 Instructor: Zhang Chapter 9 Analysis and Design of Digital Filter 9-1 Introduction What designs have we done in this course? What do we mean by filters here? What do we mean by filters design? Given specifications (requirements) => H(z) Let’s see how we can implement a digital filter (processor) if its H(z) is given? 9-2 Structures of Digital Processors 1. Direct-Form Realization r Y ( z) H ( z) X ( z) L z i 0 m i i 1 k j z j j 1 r m i 0 j 1 y (nT ) Li x(nT iT ) k j y (nT jT ) The function is realized! What’s the issue here? Count how many memory elements we need! Page 9-1 EE 422G Notes: Chapter 9 Instructor: Zhang Can we reduce this number? If we can, what is the concern? r H ( z) Li z i i 0 m 1 k j z i j 1 r 1 Li z i m i 0 1 k j z j H1 ( z ) j 1 H 2 ( z) Y ( z) H ( z) X ( z) H1 ( z) H 2 ( z) X ( z) Denote V ( z) H 2 ( z) X ( z) Y ( z) H1 ( z)V ( z) Implement H2(z) and then H1(z) ? Why H2 is implemented? (1) V ( z) X ( z) k1z 1V ( z) km z mV ( z) (2) (1 k1 z 1 k m z m )V ( z ) X ( z ) V ( z) 1 m 1 k jz X ( z) j j 1 H2 is realized! Can you tell why H1 is realized? What can we see from this realization? Signals at A j and B j : always the same Direct Form II Realization Page 9-2 EE 422G Notes: Chapter 9 Instructor: Zhang 1 0.3z 1 0.6 z 2 0.7 z 3 Example H ( z ) (1 0.2 z 1 )3 1 0.3z 1 0.6 z 2 0.7 z 3 Solution: H ( z ) 1 0.6 z 1 0.12 z 2 0.008 z 3 Important: H(z)=B(z)/A(z) (1) A: 1+…. (2) Coefficients in A: in the feedback channel Page 9-3 EE 422G Notes: Chapter 9 Instructor: Zhang 2. Cascade Realization Factorize 1 0.3z 1 0.6 z 2 0.7 z 3 (1 a1 z 1 )(1 a 2 z 2 )(1 a3 z 3 ) H ( z) 1 0.3 z 1 0.6 z 2 0.7 z 3 1 a1 z 1 1 a 2 z 1 1 a3 z 1 1 1 1 (1 0.2 z 1 ) 3 10 .2 z 10 .2 z 10 .2 z H (1 ) ( z ) H (2) ( z) H ( 3) ( z ) General Form H ( z ) kz M i 1 (1 ai z 1 ) j 1 (1 b j z 1 )(1 b j z 1 ) D D (1 c z 1 ) l 1 (1 d l * z 1 )(1 d l * z 1 ) k 1 k N1 N2 1 2 * * 1 q i z 1 1 (b j b j * ) z 1 b j b j * z 2 1 c k z 1 1 ( d l d l * ) z 1 d l d l * z 2 Apply Direct II for each! 3. Parallel Realization (Simple Poles) D1 D2 M 1 el z 1 1 H ( z ) Ai z i Bk C l 1 C z 1 l 1 (1 d l z 1 )(1 d l * z 1 ) i 0 k 1 k If r m realize the real poles realize the complex congugate poles Example 9-1 (1 z 1 )3 H ( z) 1 1 (1 z 1 )(1 z 1 ) 2 8 cascade and parallel realization! Solution: Page 9-4 EE 422G Notes: Chapter 9 Instructor: Zhang (1) Cascade: 1 z 1 1 z 1 H ( z) (1 z 1 ) 1 1 (1 z 1 ) (1 z 1 ) 2 8 (2) Parallel (1 z 1 )3 ( z 1)3 H ( z) 1 1 1 1 1 1 (1 z )(1 z ) z ( z )( z ) 2 8 2 8 In order to make deg(num)<deg(den) H ( z) ( z 1) 3 1 1 z z 2 ( z )( z ) 2 8 A B C D 2 z z 1/ 2 z 1/ 8 z A lim zH ( z ) z 0 Partial-Fraction Expansion for s z 2 ( z 1)3 (1)3 16 z 2 ( z 1 / 2)( z 1 / 8) z 0 ( 1 )( 1 ) 2 8 Page 9-5 EE 422G Notes: Chapter 9 Instructor: Zhang C lim ( z 1 / 2) H ( z) ( z 1)3 4 lim 2 z 1 / 2 z ( z 1 / 8) z 3 D lim ( z 1 / 8) H ( z) ( z 1)3 343 lim 2 z 1 / 8 z ( z 1 / 2) z 3 z 1 / 2 z 1 / 8 z = anything other than 0, ½, 1/8, 1 B = -112 For example, z=2 H ( z) 13 4 3 15 45 z 4 2 8 A 16 4 4 z2 C 4/3 8 / 9 1 3 / 2 z 2 D 343 / 3 343 8 1 15 / 8 3 15 z 8 A lim H ( z ) lim( B ) z 0 z 0 z lim zH ( z ) lim( A Bz ) z 0 z 0 d (H ( z) z) B z 0 dz 3 d ( z 1) B lim 1 1 z 0 dz ( z )( z ) 2 8 112 lim 4 8 343 8 4 ] 112 45 9 3 15 Example 9-2: System having a complex conjugate pole pair at z ae j B 2[ Transfer function z2 1 H ( z) ( z ae j )( z ae j ) (1 ae j z 1 )(1 ae j z 1 ) z2 1 2 z 2a(cos ) z a 2 1 2a(cos ) z 1 a 2 z 2 H (e j 2r ) 1 1 2a(cos )e j 2r a 2e j 4r How do we calculate the amplitude response | H (e j 2r ) | and H (e j 2r ) ? Page 9-6 EE 422G Notes: Chapter 9 Instructor: Zhang How the distance between the pole and the unit circle influence |H| and H ? How the distance between the pole and the unit circle influence H ? 1 a How the pole angle H and H ? influence See Fig. 9-7 Page 9-7 EE 422G Notes: Chapter 9 Instructor: Zhang Page 9-8 EE 422G Notes: Chapter 9 Instructor: Zhang HW: 9-2(a), 9-11, 9-13, 9-14 Page 9-9 EE 422G Notes: Chapter 9 Instructor: Zhang 9-3 Discrete-Time Integration A method of Discrete-time system Design: Approximate continuous-time system t y (t ) x( )d a simple system Integrator Output 0 system input Discrete-time approximation of this system: discrete-time Integrator 1. Rectangular Integration t t0 t t 0 0 t0 t0 y (t ) x( )d x( )d x( )d y (t 0 ) x( )d change of y from t0 to t : y(t0 , t ) t = nT, t0 = nT- T y (nT ) y (nT T ) nT nT T x( )d y (nT T ) y (nT T , nT ) Constant ( [nT T , nT ]) T small enough => x( ) x(nT T ) nT nT T y(nT) : System output x(nT) : System input , to be integrated x( )d nT nT T x(nT T )d nT x(nT T ) d Constant nT T Tx(nT T ) y (nT ) y (nT T ) Tx (nT T ) A discrete-time integrator: rectangular integrator Y ( z ) z 1Y ( z ) z 1TX ( z ) Y ( z) z 1T H ( z) X ( z ) 1 z 1 Page 9-10 EE 422G Notes: Chapter 9 Instructor: Zhang 2. Trapezoidal Integration Constants nT nT T x( )d nT nT T x(nT T ) x(nT ) d 2 T ( x(nT T ) x(nT )) 2 y (nT ) y (nT T ) T T x(nT ) x(nT T ) 2 2 T or y (nT ) y (nT T ) Tx(nT T ) 2 [ x(nT ) x(nT T )] difference between two dicretetime int egrators Y ( z ) z 1Y ( z ) T T X ( z ) z 1 X ( z ) 2 2 T 1 z 1 H ( z) 2 1 z 1 3. Frequency Characteristics 3.1 Rectangular Integrator Page 9-11 EE 422G Notes: Chapter 9 Instructor: Zhang z 1T H r ( z) 1 z 1 Frequency Response H r (e Or H r (e jT j 2r Te jT Te jT / 2 Te jT / 2 ) 1 e jT e jT / 2 e jT / 2 2 j sin T / 2 Te jr ) 2 j sin r 1 s 2 T / s r T 2r Amplitude Response Ar (r ) T 2 sin r 0r Phase Response r (r ) e jr j r 1 (sin r 0) 2 0r 2 1 2 3.2 Trapezoidal Integrator T 1 z 1 H t ( z) 2 1 z 1 Frequency Response T 1 e j 2r T e jr e jr H t (e ) 2 1 e j 2r 2 e jr e jr T 2 cos r T cos r 2 2 j sin r 2 j sin r T cos r 1 Amplitude: At (r ) 0r 2 sin r 2 j 2r Phase: t (r ) 2 0r 1 2 sin r 0 cos r 0 3.3 Versus Ideal Integrator Ideal (continuous-time ) Integrator Page 9-12 EE 422G Notes: Chapter 9 Instructor: Zhang H ( j ) 1 j 2f 2rf s H (r ) A(r ) 1 j 2rf s 1 2rf s (r ) 2 when T=1 second (Different plots and relationships will result if T is different.) (2r 1) Low Frequency Range T 1 (Frequency of the input is much lower than the sampling frequency: It should be!) Page 9-13 EE 422G Notes: Chapter 9 Instructor: Zhang cos r 1 T 1 1 At (r ) sin r r 2 r 2rf s 1 1 T 1 Ar (r ) sin r r 2r 2rf s High Frequency: Large error (should be) Example 9-4 Differential equation (system) dy x(t ) y (t ) dt Determine a digital equivalent. Solution (1) Block Diagram of the original system (2) An equivalent (3) Transfer Function Derivation T 1 z 1 Y ( z) ( X ( z ) Y ( z )) 2 1 z 1 T 1 z 1 T 1 z 1 1 Y ( z ) X ( z) 1 1 2 2 1 z 1 z Y ( z) T (1 z 1 ) H ( z) Z ( z ) ( T 2) ( T 2) z 1 Design: 9-4 Find Equivalence of a given analog filter (IIR): Including methods in Time Domain and Frequency Domain. 9-5 No analog prototype, from the desired frequency response: FIR 9-6 Computer-Aided Design Page 9-14 EE 422G Notes: Chapter 9 Instructor: Zhang 9-4 Infinite Impulse Response (IIR) Filter Design (Given H(s) Hd(z) ) 9-4A Synthesis in the Time-Domain: Invariant Design 1. Impulse – Invariant Design (1) Design Principle (2) Illustration of Design Mechanism (Not General Case) Assume: (1) Given analog filter (Transfer Function) m Ki i 1 s si H a (s) (a special case) (2) Sampling Period T (sample ha(t) to generate ha(nT)) Derivation: (1) Impulse Response of analog filter m ha (t ) L ( H a ( s)) k i e sit 1 i 1 (2) ha(nT): sampled impulse response of analog filter m m i 1 i 1 ha (nT ) ki e si nT ki (e si T ) n Page 9-15 EE 422G Notes: Chapter 9 Instructor: Zhang (3) z-transform of ha(nT) Sampled impulse response of analog filter m Z (ha (nT )) ha (nT ) z n k i (e siT ) n z n n 0 n 0 i 1 m m i 1 n 0 i 1 k i ( e si T z ) n k i 1 1 e siT z 1 m i 1 ki 1 e siT z 1 (4) Impulse-Invariant Design Principle h(nT ) ha (nT ) Z (h(nT )) Z (ha (nT )) Digital filter is so designed that its impulse response h(nT) equals the sampled impulse response of the analog filter ha(nT) Hence, digital filter must be designed such that m Z (h(nT )) Z (ha (nT )) z-transfer function H (z ) of the digital filter. Of course, the z-transfer function of its impulse response. ki i 1 1 e m ki H ( z) i 1 1 e si T si T z 1 z 1 T 0 (5) TZ (h(nT )) L(ha (t )) z e jT m => H ( z ) T i 1 1 e ki si T (scaling) z 1 (3) Characteristics (1) H ( z ) z e jT H a ( j ) when T 0 frequency response of digital filter (2) T 0 H ( z ) z e jT H a ( j ) (3) Design: Optimized for T = 0 Not for T 0 (practical case) (due to the design principle) Page 9-16 EE 422G Notes: Chapter 9 Instructor: Zhang (4) Realization: Parallel (5) Design Example H a ( s ) 1 s 1 T 2s Solution: m 1, K1 1, s1 1 m Ki 1 2 2 siT 1 1 e 2 z 1 1 e 2 z 1 z i 1 1 e H ( z) T 2. General Time – Invariant Synthesis (1) Design Principle Page 9-17 EE 422G Notes: Chapter 9 Instructor: Zhang (2) Derivation Given: Ha(s) Xa(s) T Find H(z) transfer function of analog filter Lapalce transform of input signal of analog Filter sampling period z-transfer function of digital filter (1) Response of analog filter xa(t) ya (t ) L1[ H a (s) X a (s)] (2) ya(nT) sampled signal of analog filter output ya (nT ) [ L1[ H a (s) X a (s)] t nT (3) z-transform of ya(nT) Z[ ya (nT )] Z{[L1[ H a (s) X a (s)] t nT } (4) Time – invariant Design Principle y(nT ) ya (nT ) Z ( y(nT )) Z[ ya (nT )] Digital filter is so designed that its output equals the sampled output of the analog filter Incorporate the scaling : Z [ y (nT )] G Z [ ya (nT )] H (z) X (z) G T z-transfer function of digital filter T (5) Design Equation H ( z) G Z {[ L1 ( H a ( s ) X a ( s ))] t nT } X ( z) special case X(z)=1, Xa(s) = 1 (impulse) 1 => H ( z ) GZ{[ L ( H a (s))] t nT } (6) Design procedure A: Find L1[ H a (s) X a (s)] ya (t ) (output of analog filter) B: Find ya (nT ) ya (t ) t nT C: Find Z ( ya (nT )) D: H ( z ) GZ ( ya (nT )) Page 9-18 EE 422G Notes: Chapter 9 Example 9-5 H a ( s ) Instructor: Zhang 0.5( s 4) ( s 1)( s 2) Find digital filter H(z) by impulse - invariance. Solution of design: (1) Find L1[ H a (s) X a (s)] ya (t ) X a ( s) 1 H a ( s) 0.5( s 4) 1.5 1 ( s 1)( s 2) s 1 s 2 ya (t ) L1[ H a ( s) X a ( s)] 1.5et e2t (2) Find ya (nT ) ya (t ) t nT ya (nT ) 1.5(eT )n (e2T )n (3) Find Z ( ya (nT )) Z ( ya (nT )) 1.5 1 1 e T z 1 1 e 2T z 1 (4) Find z-transfer function of the digital filter H ( z ) GZ ( ya ( nT )) 1 1.5 G T 1 2T 1 1 e z 1 e z use G = T H ( z) 1.5T T T 1 2T 1 1 e z 1 e z (5) Implementation Page 9-19 EE 422G Notes: Chapter 9 Instructor: Zhang Characteristics (1) Frequency Response equations: analog and digital 0.5( j 4) (1 j )(2 j ) 1.5T T Digital : H (e jT ) 1 eT e jT 1 e 2T e jT Analog : H a ( j ) (2) dc response comparison ( 0 ) 0.5 4 1 1 2 1.5T T Digital: H (e j 0 ) H (1) 1 e T 1 e 2T Analog: H a (0) Varying with T (should be) eT 1 T , e2T 1 2T 1.5T T H (1) 1 1 (1 T ) 1 (1 2T ) 2 T 0 : for example T 0.31416s ( f s 20) 20 eT 0.7304 , e2T 0.5335 H (1) 1.0745 good enough 2 0.31416 sec ond (3) | H a ( j ) | versus | H (e jT ) | : T T 0: 20 Using normalized frequency r f / f s / s | H (e j 2r ) | 0.25488 0.06983 cos 2r 10 2.74925 3.51275 cos 2r 0.77932 cos 4r 16 2 | H a ( j ) 0.5 4 5 2 4 2f 2f s r 2 r T H a (r ) Page 9-20 EE 422G Notes: Chapter 9 Instructor: Zhang (4) H versus H a (5) Gain adjustment when T 0 T 0 => frequency response inequality adjust G => H (e jT ) H a ( j ) at a special for example 0 If G = T = 0.3142 => H (e jT ) | 0 1.0745 If selecting G = T/1.0745 => H (e jT ) | 0 1 Page 9-21 EE 422G Notes: Chapter 9 Instructor: Zhang 3. Step – invariance synthesis 1 1 X ( z) s 1 z 1 G H ( z) Z {[L1[ H a ( s ) X a ( s )]] |t nT } X ( z) 1 H ( z ) G (1 z 1 ) Z {[ L1[ H a ( s )]] |t nT } s 0.5( s 4) Example 9-6 H a ( s ) . Find its step-invariant equivalent. ( s 1)( s 2) X a ( s) Solution of Design 1 0.5( s 4) 1 1.5 0.5 H a ( s) s s( s 1)( s 2) s s 1 s 2 1 ya ( nT ) ya (t ) |t nT L1[ H a ( s )] |t nT 1 1.5e nT 0.5e 2 nT s 1 H ( z ) G (1 z ) Z [ ya ( nT )] 1 1.5 0.5 G (1 z 1 )( 1 z 1 1 e T z 1 1 e 2T z 1 Comparison with impulse-invariant equivalent. Page 9-22 EE 422G Notes: Chapter 9 Instructor: Zhang 9-4B Design in the Frequency Domain --- The Bilinear z-transform 1. Motivation (problem in Time Domain Design) x (t ) X( f ) Xs( f ) xs ( nT ) Cn X ( f n nf s ) Cn X ( f ) [C1 X ( f f s ) [C1 X ( f f s )] Introduced by sampling, undesired! x(t) bandlimited ( X ( f f s / 2) 0) X ( f ) Xs( f ) for | f | fs 2 X ( f ) X s ( f fs ) f for | f | s 2 Consider digital equivalent of an analogy filter Ha(f): H a ( j ) H a ( j 2f ) ) Ha(f): bandlimited => can find a Hd(z) Ha(f): not bandlimited => can not find a Hd(z) Such that H d (e jT ) H a ( ) 2. Proposal: from axis to 1 axis 1 0.5s ( s : given sampling frequency) (s plane to s1 plane) Page 9-23 EE 422G Notes: Chapter 9 Instructor: Zhang Observations: (1) Good accuracy in low frequencies (2) Poor accuracy in high frequencies * (3) 100% Accuracy at 1 a given specific number such that 0.01 s Is it okay to have poor accuracy in high frequencies? Yes! Input is bandlimited! What do we mean by good, poor and 100% accuracy? Assume (1) H a ( ) 1 j 1 (originally given analogy filter) (2) The transform is 0.915244 tan 1 Then, 1 ~ 1 H a ( 1 ) . is a function of 1 . Denote j 0.915 tan 1 1 j 0.915 tan 1 1 Good accuracy: H a ( 0.3) 1 1 1 ~ H a (1 0.3) j 0.3 1 j 0.915 tan( 0.3) 1 j 0.28 1 Poor Accuracy H a ( 1.5) 1 1 1 ~ H a (1 1.5) j1.5 1 j 0.915 tan(1.5) 1 j12.9 1 100% Accuracy (Equal) H a ( 0.5) 1 1 1 ~ H a (1 0.5) j 0.5 1 j 0.915 tan( 0.5) 1 j 0.5 1 Page 9-24 EE 422G Notes: Chapter 9 Instructor: Zhang ~ ~ Is H ( 1 ) bandlimited? That is, can we find a 1 such that H ( 1 ) =0? Yes, 1 / 2 . We have no problem to find a digital equivalent ~ H d (e j T ) H a (1 ) without aliasing! Let’s use ( L ) as a number (for example 0.2) representing any low frequency, ~ Then, because H a ( ( L) 0.2) is a good approximation of H a ( ( L ) 0.2) , 1 H d (e j ( ( L) 0.2 )T ) H a ( ( L ) 0.2) should be a good approximation. A digital filter can thus be designed for an analogy filter H a ( ) which is not bandlimted! Two Step Design Procedure: Given: analogy filter H a (s) ~ (1) Find an bandlimited analogy approximation ( H a (s1 ) ) for H a (s) ~ (2) Design a digital equivalent ( H d ( z )) for the bandlimited filter H a (s1 ) . ~ Because of the relationship between ( H a (1 ) ) for H a ( ) , H d (z ) is also digital equivalent of H a (s) . The overlapping (aliasing) problem is avoided! The designed digital filter can approximate H a ( ) (for 1 and take the same value) at low frequency. 3. axis to 1 axis (s plane to s1 plane) transformation Requirement : 1 s 2 ( s is given sampling frequency.) Proposed transformation : Variable in domain T C tan 1 C tan 1 1 2 2 s 2 Variable in 1 domain Constant Effect of C: We want the transformation map r (for example, r 100rad / s ) to 1 r ( * ) => r C tan rT 2 C r cot rT 2 i.e. when the sampling period T is given, C is the only parameter which determines what will be mapped into 1 axis with the same value. Page 9-25 EE 422G Notes: Chapter 9 Instructor: Zhang c2 Example: H a ( s ) 2 s 2 c s c 2 H a ( j ) c 2 not bandlimited ( c 2 2 ) j 2 c If we want to map 2 100 to 1 2 100 r 200 C 200 cot 200T 2 Hence, for any given T or s 2 H a ( jC tan 1T 2 1 T ) H a (( j 200 cot T 200T ) tan 1 ) 2 2 c 2 ( c C 2 tan 2 2 1T 2 ) j 2C tan 1T is bandlimited as a function of 1 by | 1 | T ~ H a (1 ) H a ( jC tan 1 ) H a ( j ) when 2 Further 2 s 2 c T 1 at low frequencies. ~ H a (1 r 200 ) H a ( j j r j 200 ) Exactly holds! How to select r or sampling frequency s at which 1 ? (1) rT 2 should be small? rT 1 2 1 r 1 or r s , 2 s f s s (The accuracy should be good at low frequencies) why? T (2) When r is given or determined by application, s should be large enough such that r s to ensure the accuracy in the frequency range including r Page 9-26 EE 422G Notes: Chapter 9 When rT 2 Instructor: Zhang 1 : C r 2 2 rT T cot x since 1 x for small x. 4. Design of Digital Filter using bilinear z-transform ~ A procedure: (1) H a ( j ) H a (1 ) (not bandlimited, original analog) or (bandlimited, analog) ~ H a (s) H a (s1 ) ~ (2) H d ( z ) H a ( s1 ) |es1T z (Transfer function of digital filter) replace e s1T by z * Question: Can we directly obtain Hd(z) from Ha(s) ? Yes! (But how?) Bilinear z-transform sin x e jx e jx Preparation : (1) tan x j jx cos x e e jx T (2) C tan 1 2 Hence, C tan 1T 2 C ( j) T j 1 e 2 T j 1 e 2 T j 1 e 2 T j 1 e 2 Replace j by s , j1 by s1 ( s / j js, e s1T / 2 e s1T / 2 js jC s T / 2 e 1 e s1T / 2 e s1T / 2 e s1T / 2 1 e s1T s C s T /2 C e 1 e s1T / 2 1 e s1T 1 js1 ) Page 9-27 EE 422G Notes: Chapter 9 Instructor: Zhang Replace es1T z for digital filter Bilinear z – transformation 1 z 1 sC direct transformation from s to z (bypass s1) 1 z 1 Example c2 H a ( s) 2 s 2 c s c 2 Digital Filter H d ( z) c2 (1 z 1 ) 2 1 z 1 2 C 2 c c 1 2 1 (1 z ) 1 z 2 c 2 (1 z 1 ) 2 2 2 C (1 z 1 ) 2 2 c (1 z 2 ) c (1 z 1 ) 2 C: only undetermined parameter in the digital filter. To determine C: (1) T (s ) (2) r (related to the frequency range of interest) Example 9-7 c2 H a ( s) 2 s 2 c s c 2 c : break frequency Take r c Consider f c 500Hz f s 2000Hz (c 2 500) 1 (T 0.0005sec) fs C determined => Hd(z) determined H d ( z) 0.292893 0.585786 z 1 0.292893 z 2 1 0.171573 z 2 H d (e j 2r ) , | H d (e j 2r ) | , H d (e j 2r ) To compare the frequency response with the original analog filter Ha : f s 4 f c H a ( j ) H a ( j 2f ) H a ( j 2rf s ) H a ( j8rf c ) ( replace s by j8rfc in H a ( s) ) | H a | , H a Page 9-28 EE 422G Notes: Chapter 9 Instructor: Zhang Too low fs => poor accuracy in fc. Page 9-29 EE 422G Notes: Chapter 9 Instructor: Zhang 9-4C Bilinear z-Transform Bandpass Filter 1. Construction Mechanism (1) From an analog low-pass filter Ha(s) s 2 c 2 to analog bandpass filter H a ( ) sb s 2 c 2 i.e., replace s by to form a bandpass filter sb In the low pass filter For example H a ( s ) 1 s 1 1 s 2 c 2 1 sb low-pass band-pass Why? Original low-pass H a ( j ) Low => High Gain High => Low Gain After Replacement 2 c 2 2 c 2 Ha ( ) Ha ( j ) jb b high 2 c 2 2 => high => low gain b b b low 2 c 2 c 2 / b => high => low gain b (2) From analog to digital s 2 c 2 1 z 1 ) by C Replace s in H a ( sb 1 z 1 H d ( z 1 ) for example Page 9-30 EE 422G Notes: Chapter 9 1 s 2 c 2 1 sb Instructor: Zhang 1 C 2 (1 z 1 ) 2 c 2 1 2 (1 z ) 1 1 z 1 b 1 z 1 2. Bilinear z-transform equation Analog Low-pass s digital bandpass filter Bandpass (analog) 2 s2 c s b 1 z 1 2 c C 1 1 z 1 z 1 C 1 b 1 z 2 C 2 (1 z 1 ) 2 c (1 z 1 ) 2 C b (1 z 2 ) 2 Direct Transformation s (in low-pass) C 2 (1 z 1 ) 2 c (1 z 1 ) 2 C b (1 z 2 ) 2 C 2 c C b s (in low-pass) A 2 C 2 c 2 1 1 2 2 z z 2 2 C c 1 z 2 1 Bz 1 z 2 1 z 2 with C 2 c A Cb 2 C 2 c 2 C 2 c 2 B2 3. How to select ( C,c ,b ) for bandpass filter Page 9-31 EE 422G Notes: Chapter 9 Instructor: Zhang (design) Important parameters of bandpass (1) center frequency c (2) u upper critical frequency (3) l low critical frequency Selection of c for bandpass: c ul 2 Design of ( C,c ,b ) We want u C tan uT 2 , Also want l C tan one parameter C => impossible 2 solution c C tan 2 uT tan lT 2 lT 2 2 T T bandwidth b C tan u C tan l 2 2 Hence, A and B can be determined to perform the transform. 4. Convenient design equation A C 2 C 2 tan C 2 (tan 1 tan uT uT 2 uT 2 tan 2 tan tan lT lT 2 lT 2 ) 2 T T tan u tan l 2 2 why no C? Page 9-32 EE 422G Notes: Chapter 9 Instructor: Zhang C 2 C 2 tan uT tan lT 2 2 T T C 2 C 2 tan u tan l 2 2 T T 1 tan u tan l 2 2 2 T T 1 tan u tan l 2 2 B2 T 2 2 T cos( u l ) 2 1 Bz 1 z 2 s A 1 z 2 1 tan x tan y cos( x y ) 1 tan x tan y cos( x y ) In low-pass 1 Example : s cos( u l ) 1 1 z 2 1 Bz 1 z 2 A(1 Bz 1 z 2 ) (1 z 2 ) A 1 z 2 5. In the normalized frequency Reference frequency: sampling frequency f s f ru u u s fs => uT rl 2f u 1 fs ru , l f l s fs lT 2 2 2 A cot (ru rl ) => B 2 cos (ru rl ) cos (ru rl ) 1 Bz 1 z 2 s => A In low-pass 1 z 2 (s ) rl Page 9-33 EE 422G Notes: Chapter 9 Instructor: Zhang Example 9-9 Lowpass H a ( s ) 1 s 1 Transfer function of bandpass digital filter H d ( z) 1 1 Bz 1 z 2 A 1 1 z 2 A and B? Determined by design requirements. f u 1000 Hz sampling frequency fs = 5000Hz f 500 Hz l ru f u / f s 0.2 rl f l / f s 0.1 A cot (0.2 0.1) 3.0776835 cot (0.2 0.1) 1.2360680 cot (0.2 0.1) 1 z 2 H ( z) 4.0776835 3.8042261z 1 2.0776835z 2 H (e j 2r ) , | H (e j 2r ) | , H (e j 2r ) B2 Page 9-34 EE 422G Notes: Chapter 9 Instructor: Zhang 9-5 Design of Finite-Duration Impulse Response (FIR) Digital Filter Direct Design of Digital Filters with no analog prototype. Can we also do this for IIR? Yes! Using computer program in next section. 9-5A A few questions 1. How are the specifications given? By given A( ) and ( ) 2. What is the form of FIR digital filter? y (nT ) h(kT ) x(nT kT ) Difference Equation k (What is T ? sampling period) H ( z ) h(kT ) z k Transfer function k 3. How to select T ? 4. After T is fixed, can we define the normalized frequency r and A(r ) and (r ) ? Yes! Can we then find the desired frequency response H (r ) A(r )e j ( r ) r is not time ? Yes! 5. Why must H( r ) be a periodic function for digital filter? H( r ) = H ( n + r ) ? Why? What is its period? Page 9-35 EE 422G Notes: Chapter 9 Instructor: Zhang 6. Can H( r ) be expressed in Fourier Series ? Yes! How? 0 : sampling frequency? No! See general formula : X ne jn t X n e jn2f t X ne x (t ) 0 0 n 1 Xn T0 n jn T0 : period of x(t ) 2 t T0 n 1 jn0t x ( t ) e dt T0 T0 T0 / 2 T0 / 2 jn x(t )e 2 t T0 dt In our case for H(r): x H H (r ) X n e jn2 r n tr 1/ 2 jn 2 r X n 1 / 2 H (r )e dr T0 1 What does this mean? Every desired frequency response H(r) of digital filter can be expressed into Fourier Series ! Further, the coefficients of the Fourier series can be calculated using H(r)! 9-6B Design principle H (r ) X n Denote n e jn2 r hd (nT ) X n jn 2 r H (r ) hd (nT )e n h (nT ) X 1/ 2 H (r )e jn 2 r dr n d 1/ 2 Consider a filter with transfer function hd (nT ) z n n What’s its frequency response ? h n d (nT )(e j 2 r ) n h n d (nT )e j 2 rn H (r ) given specification of digital filter’s frequency response! Page 9-36 EE 422G Notes: Chapter 9 Instructor: Zhang 9-6 C Design Procedure (1) Given H(r) (2) Find H(r)’s Fourier series H (r ) h (nT )e n j 2 rn d 1/ 2 jn2 r dr where hd (nT ) 1/ 2 H (r )e (3) Designed filter’s transfer function hd (nT ) z n n What’s hd(nT) ? Impulse response! 1 2 Example 9-10: H (r ) (1 cos 2 r ) Solution : (1) Given H (r ) : done (2) Find H (r ) ’s Fourier series 1 H (r ) (1 cos 2r ) hd (nT )e jn2 r 2 n where hd ( nT ) 1 1/ 2 (1 cos 2r )e jn 2r dr 2 1 / 2 n=0 hd (0) n0 1 1/ 2 1 1/ 2 1 1/ 2 1 ( 1 cos 2 r ) dr dr cos 2rdr 2 1 / 2 2 1 / 2 2 1 / 2 2 1 1 / 2 jn 2 r 1 1 / 2 e j 2 r e j 2 r j 2nr hd (nT ) e dr e dr 2 1 / 2 2 1 / 2 2 1 1/ 2 1 1/ 2 e j 2 ( n 1) r dr e j 2 ( n 1) r dr 4 1 / 2 4 1 / 2 1 1/ 2 1 dr 4 1 / 2 4 1 1/ 2 1 hd (T ) dr 4 1 / 2 4 hd (nT ) 0 n 0,1 hd (T ) 1 1 1 H ( r ) hd (nT )e j 2n r e j 2 r e j 2 r 4 2 4 n 1 h (0) 1 , hd (T ) , hd (nT ) 0, | n | 2 d 2 4 Page 9-37 EE 422G Notes: Chapter 9 Instructor: Zhang (3) Digital Filter h n d (nT ) z n hd (T ) z 1 hd (0) hd (T ) z 1 1 1 1 z z 1 4 2 4 9-6D Practical Issues : Infinite number of terms and non-causal (1) H nc ( z ) hd (nT ) z n 2M+1 terms n Truncation => H nc ( z ) M h (nT ) z n M n d ( w (n)h (nT ) z n r d n ) Rectangular window function | n | M | n | M 1 wr (n) 0 Truncation window Effect of Truncation (windowing): Time Domain: Multiplication ( h and w ) Frequency Domain: Convolution M sin (2M 1)r j 2 r wr (e ) e j 2 n r sin r n M (After Truncation: The desired frequency Hr H r wr frequency response of truncated filter ) The effect will be seen in examples! (2) Causal Filters: H c ( z) z M k = n+M H c ( z ) M h n M d (nT ) z n M h n M d (nT ) z ( M n ) 2M hd (kT MT ) z k k 0 Define Lk hd (kT Mt ) Relationship: H c ( z ) H nc ( z ) z H c ( z) 2M Lk z k k 0 M Ac (r ) Anc (r ) j 2r j 2r j 2Mr H ( e ) H ( e ) e Frequency Response c nc c (r ) nc (r ) 2Mr Page 9-38 EE 422G Notes: Chapter 9 Instructor: Zhang Design Examples n 0.54 0.46 cos M Hamming window: wh (n) 0 | n | M | n | M Example 9-11 Design a digital differentiator Step1 : Assign H (r ) H (r ) should be the frequency response of the analog differentiator H(s) = s => Desired H (r ) j | 2 f j 2 f s r f rf s Step2 : Calculate hd(nT) 1/ 2 hd (nT ) 1 / 2 1/ 2 1 / 2 1/ 2 H (r )e j 2 nr dr 1 / 2 1/ 2 H (r )e j 2 nr dr 1 / 2 b udv uv a a b vdu u r , v e j 2 nr a ( j 2 f s r )e j 2 nr dr fs n f s n f s n f s n j 2 nr 1 j 2 nr re e j 2n r 1 / 2 b ( j 2 f s r )e j 2 nr dr 1/ 2 1 / 2 1/ 2 j 2 nre j 2 nr dr rde j 2 nr r 1 / 2 re j 2 nr r 1 / 2 e j 2 nr d (r ) 1 / 2 1/ 2 r 1 / 2 r 1 / 2 1 1 j n f s 1 1 j n e 2 j 2n 2 j 2n e n f fs s e j n e j n e j n e j n 2 2n j 2 n f fs 2 j sin n s 2 cos n 2n j 2n 2 fs n Page 9-39 EE 422G Notes: Chapter 9 Instructor: Zhang 0 fs 2 j fs fs n ( 1 ) sin n (1) n 2 n n j 2n hd (nT ) f s f s sin n f s [n sin n] n n 2 n 2 n0 d [n sin n ] dn f s lim n 0 d n 2 dn f cos n s lim 2 n 0 n f d ( cos n ) / dn s lim 2 n 0 d (n ) / dn fs 2 sin n lim 0 2 n 0 fs ( 1)n i.e., hd (nT ) n 0 n0 n 1 n0 Step 3: Construct nc filter with hamming window (M=7) n 1 n 7 fs f n n H ( z ) (1) wh (n) z s (1) n wh (n) z n n 7 n n 1 n H c ( z ) z 7 H ( z ) Page 9-40 EE 422G Notes: Chapter 9 Instructor: Zhang Example 9-12: Desired low-pass FIR digital filter characteristic | r | 0.15 1 H (r ) 0.15 | r | 0.5 0 hd (nT ) 0.15 e j 2 n r dr 0.15 1 1 (e j 0.3 e j 0.3 ) sin 0.3 n j 2n n d (sin 0.3 n) / d ( n) 0.3 cos 0.3 n lim 0.3 n0 n0 d ( n) / d ( n) 1 hd (0T ) lim hd (0) 0.3 sin 0.3n hd (nT ) n n0 Page 9-41 EE 422G Notes: Chapter 9 Instructor: Zhang 8 NC filter with 17 weight’s window: H NC ( z ) hd (nT ) wh (n) z n , HC z 8 H NC ( z ) n 8 Page 9-42 EE 422G Notes: Chapter 9 Instructor: Zhang Example 9-13 (90o phase shifter) j H (r) j hd (nT ) 0 1 0.5 r 0 1/ 2 1 / 2 0 r 0.5 je j 2 n r dr 0 1 (1 e jn ) ( j )e j 2 n r dr (e jn 1) 2 n 2 n 1 1 cos n 1 (e jn e jn ) 2 n n n n 1 cosn sin n lim 0 n 0 n 0 n 1 n = 0 => hd (0) lim hd (0) 0 1 h ( nT ) [1 ( 1)n ] d n n0 2 n 0 2 => hd ( nT ) n 0 Filter: n odd n 0, n even n odd n even H NC ( z ) 7 h n 7 d (n) wh (n) z n M 7 7 HC z H NC ( z ) Page 9-43 EE 422G Notes: Chapter 9 Instructor: Zhang Fig. 9-32 Amplitude response of digital 90 degree phase shifter 9-6 Computer-Aided Design of Digital Filters 9-6A Command yulewalk for IIR Example 9-14 9-6B Command remez for FIR Example 9-15 Page 9-44 EE 422G Notes: Chapter 9 Instructor: Zhang Chapter 9 Homework 2, 4, 6, 11, 13, 14, 25, 26, 27, 29, 30, 31, 44, 48, 53, 61, 62, 64, 66, 68, 69 Page 9-45