Hossein Sameti Department of Computer Engineering Sharif University of Technology Definition of generalized linear-phase (GLP): H () H m ()e j ( ) Let’s focus on Type I FIR filter: 0, N 2L 1(odd ), h(n) h( N n 1), ( L ) • It can be shown that L H m ( ) a(n) cos(n) G( ) n0 a(0) h( L) a ( n ) 2 h ( L n ) n 0 H ( ) G ( )e j (L+1) unknown parameters a(n) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 2 1 1 1 1 2 2 • Given 0 p s s , p , 1 , 2 determine coefficients of G(ω) (i.e. a(n)) such that L is minimized (minimum length of the filter). Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 3 L H m ( ) a(n) cos(n) G( ) n0 G(ω) is a continuous function of ω and is as many times differentiable as we want. How many local extrema (min/max) does G(ω) have in the range [0, ] ? In order to answer the above question, we have to write cos(ωn) as a sum of powers of cos(ω). cos(2) 2 cos2 () 1 cos(3) cos(2 ) cos(2) cos sin(2) sin cos(3) 4 cos3 3 cos cos(n ) : sum of powers of cos(ω) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 4 n cos(n ) i (cos ) i i 0 L H m ( ) a(n) cos(n) G( ) n0 L n n 0 L i 0 i G( ) a(n)[ i (cos ) ] G ( ) (n)(cos ) n n 0 dG( ) 0 d Find extrema L (n)n(cos ) n 0 n 1 (sin ) 0 L (sin ) (n)n(cos ) n 1 0 n 0 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 5 L (sin ) (n)n(cos ) n 1 0 n 0 cos x sin 0 0 or L (n)n(cos ) n 1 0 n 0 Polynomial of degree L-1 Maximum of L-1 real zeros Max. total number of real zeros: L+1 Conclusion: The maximum number of real zeros for dGd( ) (derivative of the frequency response of type I FIR filter) is N 1 L+1, where L 2 (N is the number of taps). Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 6 1 1 1 1 2 2 0 p s Problem A • Given s , p , 1 , 2 determine coefficients of G(ω) (i.e. a(n)) such that L is minimized (minimum length of the filter). Problem A Problem B Problem C Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 7 1 • Given s , p , L, K 2 determine coefficients of G(ω) (i.e. a(n)) such that 2 is minimized. s , p , 1 , 2 1 Compute K 2 Guess L Algorithm B Increase L by 1 a' (n), 2' 2' 2 ? ' 2 2 Decrease L by 1 2' 2 Yes Stop! 8 Define F as a union of closed intervals in [0, ] I2 I1 0 I1:[0, p ] p s I 2:[s , ] F I1 I 2 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 9 E ( ) W ( )[G( ) D( )] where 1 W ( ) K 1 I1 W is a positive weighting function I2 L G ( ) a (n) cos(n) n 0 1 I1 D( ) 0 I 2 Desired frequency response Find a(n) to minimize Max E ( ) F F I1 I 2 (same assumption as Problem B) 10 We start by showing that Max E ( ) 2 F E ( ) W ( )[G( ) D( )] E ( ) [G( ) D( )] W ( ) E ( ) G( ) D( ) W ( ) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 11 F I1 I 2 By definition: Max E ( ) F E ( ) I2 I1 p s Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 12 1 By definition: W ( ) K 1 E ( ) W ( ) Max E ( ) I1 F I2 K K p s Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 13 E ( ) G( ) D( ) W ( ) 1 I1 D( ) 0 I 2 G( ) 1 K 1 K p s Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 14 G( ) in Problem C 1 K K 1 2 2 1 K p 1 1 G( ) in Problem B 1 1 2 2 s p s 15 Conclusion: Problem B: Find a(n) such that 2 is minimized. Problem C: Find a(n) such that is minimized. Problem B= Problem C Problem A= Problem C We now try to solve Problem C. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 16 Assumptions: F: union of closed intervals G(x) to be a polynomial of order L: L G ( x) ak x k k 0 D = Desired function that is continuous in F. 1 I1 D( ) W= positive function 0 I 2 1 E ( x) W ( x)[ D( x) G ( x)] I1 W ( ) K I2 E max E ( x ) 1 xF 17 The necessary and sufficient conditions for G(x) to be unique Lth order polynomial that minimizes E is that E(x) exhibits at least L+2 alternations, i.e., there are at least L+2 values of x such that x1 x2 ... xL 2 𝑬 𝒙𝒊 = −𝑬 𝒙𝒊+𝟏 = E (x ) + 𝑬 − for a polynomial of degree 4 E E E E E Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology E 18 • Recall G(ω) can have at most L+1 local extrema. • According to the alternation theorem, G(ω) should have at least L+2 alternations(local extrema) in F. Contradiction!? F I1 I 2 I1 I2 19 Ex: Polynomial of degree 7 • s , p can also be alternation frequencies, although they are not local extrema. •G(ω) can have at most L+3 local extrema in F. F I1 I 2 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 20 According to the alternation theorem, we have at least L+2 alternations. According to our current argument, we have at most L+3 local extrema. Conclusion: we have either L+2 or L+3 alternations in F for the optimal case. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 21 Extra-ripple case Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 22 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 23 For Type I low-pass filters, alternations always occur at s , p If not, we potentially lose two alternations. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 24 Equi-ripple except possibly at 0, Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 25 For optimal type I low-pass filters, alternations always occur at s , p If not, two alternations are lost and the filter is no longer optimal. Filter will be equi-ripple except possibly at 0, Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 26 1 • Given s , p , L, K determine coefficients of G(ω) (i.e. a(n)) 2 such that 2 is minimized. At alternation frequencies, we have: 𝑬 𝝎𝒊 + = 𝜹𝟐 − E (i ) E (i 1 ) i 1,2,..., L 2 i 1,2,..., L 1 E ( ) W ( )[ D( ) G( )] W (i )[ D(i ) G (i )] (1) i 1 2 (1) i 1 2 G (i ) D (i ) i 1,2,..., L 2 W (i ) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 27 L ( Eq.1) G (i ) a (n) cos(i n) n 0 (1)i 1 2 ( Eq.2) G (i ) D(i ) W (i ) Equating Eq.1 and Eq.2 (1)i 1 2 D(i ) a(n) cos(i n) W (i ) n 0 L i 1,2,..., L 2 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 28 (1)i 1 2 D(i ) i 1,2,..., L 2 a(n) cos(i n) W (i ) n 0 L i 1 a(0) cos(1.0) a(1) cos(1.1) a(2) cos(1.2) .... a( L) cos(1.L) (1)11 2 D(1 ) W (1 ) i 2 a(0) cos(2 .0) a(1) cos(2 .1) a(2) cos(2 .2) .... a( L) cos(2 .L) (1) 2 1 2 D ( 2 ) W ( 2 ) i L 2 a(0) cos( L2 .0) a(1) cos(L2 .1) a(2) cos(2 .2) .... a( L) cos(L2 .L) (1) L 21 2 D( L 2 ) W ( L 2 ) 29 é cos w .0 ( 1 ) cos (w1.1) cos(w1.2) ê ê cos (w .0) cos (w 2 .1) cos (w 2 .2) 2 ê ê ê ê ê cos (w L+2 .0) cos (w L+2 .1) cos (w L+2 .2) êë (1)11 2 W (1 ) (1) 21 2 W ( 2 ) (1) L 21 2 W ( L 2 ) D(1 ) D( ) 2 D( L 2 ) cos(w1.L) ù ú cos (w 2 .L ) ú ú ú ú ú cos (w L+2 .L ) ú úû a ( 0) a (1) a ( L) L+2 linear equations and L+2 unknowns AX B Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 30 a(n) L 1 unknowns 2 1 unknown i L 2 equations L 2 unknowns Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 31 a (n), 2 i It can be shown that if i 's are known, then 2 can be derived using the following formulae: L2 bk D( k ) 2 k 1 L 2 b (1) k 1 k k 1 W ( k ) L2 1 bk i 1 cos k cos i ik Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 32 𝐺(𝜔) is an Lth-order trigonometric polynomial. We can interpolate a trigonometric polynomial through L+1 of the L+2 known values of 𝐸 𝜔𝑖 or G 𝜔𝑖 . Using Lagrange interpolation formulae we can find the frequency response as: G ( ) Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 33 Now 𝐺 𝜔 is available at any desired frequency, without the need to solve the set of equations for the coefficients of 𝑎 𝑛 . If 𝐸 𝜔 ≤ 𝛿2 for all 𝜔 in the passband and stopband, then the optimum approximation has been found. Otherwise, we must find a new set of extremal frequencies. Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 34 35 Next alternation frequency Original alternation frequency Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 36 App. estimate of L: 10 log( 1 2 ) 13 M 2L 2.324 s p App. Length of Kaiser filter: N 1 • Example: p 0.4 , s 0.6 A8 2 .2 A 20 log10 1 0.01, 2 0.001 • Optimal filter: N 2L 1 27 • Kaiser filter: N 38 Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 37 p 0.4 , s 0.6 1 0.01, 2 0.001 K 10, M 26 Does it meet the specs? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 38 Increase the length of the filter by 1. p 0.4 , s 0.6 1 0.01, 2 0.001 K 10, M 27 Does it meet the specs? Hossein Sameti, Dept. of Computer Eng., Sharif University of Technology 39