MAXIMALLY FLAT FIR FILTERS

Similar documents
FIR Filter Design: Part II

3. Z Transform. Recall that the Fourier transform (FT) of a DT signal xn [ ] is ( ) [ ] = In order for the FT to exist in the finite magnitude sense,

ECE-S352 Introduction to Digital Signal Processing Lecture 3A Direct Solution of Difference Equations

The z-transform. 7.1 Introduction. 7.2 The z-transform Derivation of the z-transform: x[n] = z n LTI system, h[n] z = re j

ADVANCED DIGITAL SIGNAL PROCESSING

COMM 602: Digital Signal Processing

Zeros of Polynomials

Chapter 7: The z-transform. Chih-Wei Liu

PROBLEM SET 5 SOLUTIONS 126 = , 37 = , 15 = , 7 = 7 1.

1 Generating functions for balls in boxes

Olli Simula T / Chapter 1 3. Olli Simula T / Chapter 1 5

Frequency Domain Filtering

Properties and Tests of Zeros of Polynomial Functions

Ch3 Discrete Time Fourier Transform

6.3 Testing Series With Positive Terms

Z - Transform. It offers the techniques for digital filter design and frequency analysis of digital signals.

3.2 Properties of Division 3.3 Zeros of Polynomials 3.4 Complex and Rational Zeros of Polynomials

FIR Filters. Lecture #7 Chapter 5. BME 310 Biomedical Computing - J.Schesser

NICK DUFRESNE. 1 1 p(x). To determine some formulas for the generating function of the Schröder numbers, r(x) = a(x) =

Discrete-Time Systems, LTI Systems, and Discrete-Time Convolution

Polynomial Functions and Their Graphs

Complex Numbers Solutions

Frequency Response of FIR Filters

Math 2784 (or 2794W) University of Connecticut

The Discrete Fourier Transform

Ma 530 Introduction to Power Series

Finite-length Discrete Transforms. Chapter 5, Sections

Chapter 7 z-transform

Filter banks. Separately, the lowpass and highpass filters are not invertible. removes the highest frequency 1/ 2and

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

Physics 116A Solutions to Homework Set #9 Winter 2012

Math 155 (Lecture 3)

Q-BINOMIALS AND THE GREATEST COMMON DIVISOR. Keith R. Slavin 8474 SW Chevy Place, Beaverton, Oregon 97008, USA.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science. BACKGROUND EXAM September 30, 2004.

CALCULATION OF FIBONACCI VECTORS

Quantum Computing Lecture 7. Quantum Factoring

Inverse Matrix. A meaning that matrix B is an inverse of matrix A.

AH Checklist (Unit 3) AH Checklist (Unit 3) Matrices

CHAPTER 5. Theory and Solution Using Matrix Techniques

Polynomial Multiplication and Fast Fourier Transform

The multiplicative structure of finite field and a construction of LRC

Lesson 10: Limits and Continuity

TEACHER CERTIFICATION STUDY GUIDE

(a) (b) All real numbers. (c) All real numbers. (d) None. to show the. (a) 3. (b) [ 7, 1) (c) ( 7, 1) (d) At x = 7. (a) (b)

Lecture 3. Digital Signal Processing. Chapter 3. z-transforms. Mikael Swartling Nedelko Grbic Bengt Mandersson. rev. 2016

Unit 4: Polynomial and Rational Functions

Chapter 8. DFT : The Discrete Fourier Transform

FFTs in Graphics and Vision. The Fast Fourier Transform

Signals & Systems Chapter3

Fall 2011, EE123 Digital Signal Processing

Linear Regression Demystified

REVISION SHEET FP1 (MEI) ALGEBRA. Identities In mathematics, an identity is a statement which is true for all values of the variables it contains.

Signal Processing in Mechatronics. Lecture 3, Convolution, Fourier Series and Fourier Transform

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science. Fall Problem Set 11 Solutions.

62. Power series Definition 16. (Power series) Given a sequence {c n }, the series. c n x n = c 0 + c 1 x + c 2 x 2 + c 3 x 3 +

2D DSP Basics: 2D Systems

ENGI Series Page 6-01

EE Midterm Test 1 - Solutions

REVISION SHEET FP1 (MEI) ALGEBRA. Identities In mathematics, an identity is a statement which is true for all values of the variables it contains.

Solution of Linear Constant-Coefficient Difference Equations

11. FINITE FIELDS. Example 1: The following tables define addition and multiplication for a field of order 4.

C. Complex Numbers. x 6x + 2 = 0. This equation was known to have three real roots, given by simple combinations of the expressions

Introduction to Signals and Systems, Part V: Lecture Summary

Section 11.8: Power Series

( ) (( ) ) ANSWERS TO EXERCISES IN APPENDIX B. Section B.1 VECTORS AND SETS. Exercise B.1-1: Convex sets. are convex, , hence. and. (a) Let.

Math 312 Lecture Notes One Dimensional Maps

CHAPTER I: Vector Spaces

MAS160: Signals, Systems & Information for Media Technology. Problem Set 5. DUE: November 3, (a) Plot of u[n] (b) Plot of x[n]=(0.

Chapter 9 - CD companion 1. A Generic Implementation; The Common-Merge Amplifier. 1 τ is. ω ch. τ io

Generating Functions. 1 Operations on generating functions

Time-Domain Representations of LTI Systems

Lecture Overview. 2 Permutations and Combinations. n(n 1) (n (k 1)) = n(n 1) (n k + 1) =

Digital signal processing: Lecture 5. z-transformation - I. Produced by Qiangfu Zhao (Since 1995), All rights reserved

Chapter 4 : Laplace Transform

CALCULUS BASIC SUMMER REVIEW

(b) What is the probability that a particle reaches the upper boundary n before the lower boundary m?

Definition of z-transform.

FIR Filter Design: Part I

Lecture 3: Divide and Conquer: Fast Fourier Transform

Algorithms and Data Structures 2014 Exercises and Solutions Week 13

CHAPTER 10 INFINITE SEQUENCES AND SERIES

The z-transform can be used to obtain compact transform-domain representations of signals and systems. It

2.004 Dynamics and Control II Spring 2008

w (1) ˆx w (1) x (1) /ρ and w (2) ˆx w (2) x (2) /ρ.

Apply change-of-basis formula to rewrite x as a linear combination of eigenvectors v j.

We are mainly going to be concerned with power series in x, such as. (x)} converges - that is, lims N n

Chapter 4. Fourier Series

1 1 2 = show that: over variables x and y. [2 marks] Write down necessary conditions involving first and second-order partial derivatives for ( x0, y

Complex Analysis Spring 2001 Homework I Solution

Exponential Moving Average Pieter P

Algebra II Notes Unit Seven: Powers, Roots, and Radicals

x c the remainder is Pc ().

Exam. Notes: A single A4 sheet of paper (double sided; hand-written or computer typed)

6.003 Homework #3 Solutions

Polynomials with Rational Roots that Differ by a Non-zero Constant. Generalities

SEQUENCES AND SERIES

Linear Programming and the Simplex Method

SNAP Centre Workshop. Basic Algebraic Manipulation

Infinite Series and Improper Integrals

Lemma Let f(x) K[x] be a separable polynomial of degree n. Then the Galois group is a subgroup of S n, the permutations of the roots.

Transcription:

MAXIMALLY FLAT FIR FILTERS This sectio describes a family of maximally flat symmetric FIR filters first itroduced by Herrma [2]. The desig of these filters is particularly simple due to the availability of closed form solutios. I additio, they ca be implemeted efficietly usig certai hardware architectures. The derivatio of the maximally flat filters by Herrma begis with a trasformatio of the problem usig a chage of variables. A CHANGE OF VARIABLES The followig chage of variables is used to covert a Type I liearphase trasfer fuctio H(z) ito a polyomial P (x). The values of P (x) for real values of x betwee ad will give the values of H(z) for complex values of z o the uit circle. To describe the chage of variables we begi with a polyomial P (x) of degree M. P (x) = p + p x + p 2 x 2 + + p M x M = M m= p m x m The chage of variables, used to obtai a Type I FIR filter, is give by, x = z + 2 z. () I. Selesick EL 73 Lecture Notes

Usig this trasformatio, we obtai the followig trasfer fuctio H(z). ( ) z + 2 z H(z) = P (2) M ( ) z + 2 z m = p m (3) The filter will be a Type I FIR filter. The symmetric impulse respose h() will be of legth N = 2M + ; h() will be supported o M M. For example, if the H(z) = 32 ad P (x) = 2 9 x + 3 x 2 6 x 3 () ( 3 z 3 + 8 z 2 + 3 z + 6 + 3 z + 8 z 2 + 3 z 3). h() = {3, 8, 3, 6, 3, 8, 3} 32 where 6 represets h(). The followig Matlab program x2z coverts the polyomial coefficiets p to filter coefficiets h(). The program is based directly o equatio (3). fuctio h = x2z(p) N = legth(p); h = p(); g = ; for k = 2:N g = cov(g,[- 2 -]/); h = [ h ] + p(k)*g; This program assumes that the coefficiets of the polyomial P (x) are ordered i icreasig powers (this is cotrary to the Matlab covetio for polyomials). I. Selesick EL 73 Lecture Notes 2 (5)

>> p = [2-9 3-6]; >> h = x2z(p); >> h*32 as = 3 8 3 6 3 8 3 The frequecy respose of the filter H(z) ca be directly related to P (x) by otig the followig idetity. z + 2 z = z=e jω 2 (ejω + e jω ) = 2 2 cos(ω) Now the frequecy respose of the filter is give by evaluatig P (x) appropriately. H f (ω) := H(e jω ) ( = P 2 ) 2 cos(ω) Therefore, the frequecy respose of the filter obtaied via (2) is similar to the graph of P (x). The oly differece is a warpig of the idepet variable, give by, x = 2 2 cos(ω). (6) This warpig is show i the followig figure for ω π. I. Selesick EL 73 Lecture Notes 3

.8.5.5 cos(ω).6..2.25π.5π.75π π ω Note that x ad ω have the correspodig values: ω x ω = x = ω = π x = For the polyomial P i (), the graph of P (x) ad the frequecy respose H f (ω) are show i the followig figure. 2.5 P(x).5.5..2.3..5.6.7.8.9 x 2.5 H f (ω).5.5..2.3..5.6.7.8.9 ω/π Notice that the frequecy warpig is most proouced ear the poits of the iterval [, ]. I. Selesick EL 73 Lecture Notes

We ca also trasform ay Type I FIR filter ito a polyomial, by reversig the procedure. performs the reverse trasformatio. fuctio p = z2x(h) N = legth(h); M = (N-)/2; P = []; g = ; for k = :M g = cov(g,[- 2 -]/); for k = :M [q,r] = decov(h,g); p(m+-k) = q; h = r(2:-); g = decov(g,[- 2 -]/); The followig Matlab program z2x We ca illustrate that the programs z2x ad x2z are iverses of oe aother as i the followig example. >> % check that z2x(x2z(p)) gives p >> p = [35 9 3 3 3]; >> z2x(x2z(p)) as = 35 9 3 3 3 >> % check that x2z(z2x(h)) gives h >> h = [-3 25-93 2-93 25-3]; >> x2z(z2x(h)) as = -3 25-93 2-93 25-3 I. Selesick EL 73 Lecture Notes 5

MAXIMALLY FLAT TYPE I FIR FILTERS A maximally flat Type I FIR filter is a filter of miimal legth satisfyig the costraits: H f () = (7) d i H f (ω) dω i =, i =,..., 2L + (8) ω= d i H f (ω) dω i =, i =,..., 2K (9) ω=π Note that the odd derivatives of H f (ω) are automatically zero at ω = ad ω = π for Type I filters. These derivative costraits represet a set of liear equatios for the filter coefficiets h(). By usig the trasformatio x = 2 2 cos(ω) the problem of obtaiig the solutio is simplified. Istead of fidig h(), we ca istead fid a polyomial P (x) which ca be coverted ito a Type I FIR filter. I this case, the problem is to fid a polyomial P (x) of miimal degree satisfyig the costraits: P () = () P (i) () =, i =,..., L () P (i) () =, i =,..., K (2) Equivaletly, P (x) ca be factored as ad P (x) ca be factored as P (x) = A(x) ( x) K (3) P (x) = B(x) x L+. () I. Selesick EL 73 Lecture Notes 6

Combiig (3) ad (), we have = A(x) ( x) K + B(x) x L+. (5) Oe method for obtaiig the polyomials A(x) ad B(x) of miimal degree is to use the exted Euclidea algorithm for polyomial GCDs. From the Euclidea algorithm, it is kow that the degrees of A(x) ad B(x) are L ad K respectively. Therefore, the degree of P (x) is L + K. Aother method to obtai A(x) ad B(x) is to rewrite (5) as A(x) = B(x) xl+ ( x) K. ad to the write /( x) K as a Taylor series aroud x = We the have ( x) = K c x. A(x) = ( B(x) x L+) c x. Because the degree of A(x) is L, it must be give by A(x) = L c x. A formula for the costats c is give by the biomial theorem. The biomial theorem states that (a + b) K = where the biomial coefficiet is defied as ( ) K K! = (K )!! ( ) K a K b (6) I. Selesick EL 73 Lecture Notes 7

for K, Z. If K is egative, we ca still use the biomial theorem, but we eed to kow how to ext biomial coefficiets to egative values of K. The followig idetity specifies how biomial coefficiets ca be evaluated whe the upper etry is egative []. ( ) ( ) K K + = ( ) Usig this idetity i (6) we get (a + b) = ( ) K a K b K = ( ) ( K + b ( ) a K a Settig a = ad b = x, we get a expressio for /( x) K. ( x) = ( ) K + ( ) ( x) (7) K = ( ) K + x. (8) Therefore, ad A(x) = L ( ) K + x P (x) = ( x) K ) L ( ) K + x. (9) Usig the chage of variables (), we obtai the trasfer fuctio ( ) z + 2 + z K L ( ) ( ) K + z + 2 z H(z) =. I. Selesick EL 73 Lecture Notes 8

Notice that we ever determied B(x). It was ot eeded. With the idetities, z + 2 + z ( ω ) 2 = cos z=e jω 2 z + 2 z ( ω ) 2, = si z=e jω 2 the frequecy respose H(e jω ) ca be writte as ( ( ω )) 2K L ( ) K + ( ( ω )) 2 H(e jω ) = cos si. 2 2 The followig pseudo program computes the impulse respose h(). Q(z) H(z) for from to L ( ) z + 2 z Q(z) Q(z) ( ) K + H(z) H(z) + Q(z) for k from to K H(z) H(z) ( ) z + 2 + z If we call c = ( ) K+, we ca ote that the ratio c /c is give by c (K + )! ( )! (K )! = = K +. (2) c! (K )! (K + 2)! I. Selesick EL 73 Lecture Notes 9

Therefore, the pseudo program ca be modified to iclude the biomial coefficiet computatio, as follows. Q(z) H(z) c for from to L Q(z) Q(z) c c (K + )/ ( ) z + 2 z H(z) H(z) + c Q(z) for k from to K H(z) H(z) ( ) z + 2 + z The followig Matlab program maxflati implemets the pseudo program. The vector h is the impulse respose of the filter. fuctio h = maxflati(k,l) h = ; q = ; c = ; for = :L q = cov(q,[- 2 -]/); c = c*(k-+)/; h = [ h ] + c*q; for k = :K h = cov(h,[ 2 ]/); I. Selesick EL 73 Lecture Notes

Example Whe K = 3, L = 5, the impulse respose h(), frequecy respose magitude H f (ω), ad zero diagram are as show. Notice that exactly 2L zeros that cotribute to the shape of the passbad, ad exactly 2K zeros are located at z =..7 MAXIMALLY FLAT TYPE I FIR FILTER.6.5..3.2.. 2 6 8 2 6.2.8.6..2..2.3..5.6.7.8.9 ZERO DIAGRAM 2 6 2 2 2 6 I. Selesick EL 73 Lecture Notes

Geeral Stopbads The procedure used to obtai maximally flat passbads ca be modified to iclude zeros located at poits other tha z =. For example, suppose it is desired that H f (ω s ) = where the ω s is a specified frequecy i the stopbad. The resultig filter will be maximally flat i the passbad, but ot i the stopbad. We ca agai costruct a polyomial P (x) which ca the be coverted ito a Type I FIR filter. Modifyig the costraits o P (x), we have where P (x) = A(x) ( x) K (x s x) x s = 2 2 cos ω s ad A(x) is a polyomial (of degree L) to be determied. before, the derivative costraits at x = ca be icluded by the coditio that P (x) factors as Combiig, we have or P (x) = B(x) x L+. = A(x) ( x) K (x s x) + B(x) x L+ A(x) = B(x) xl+ ( x) K (x s x). If we kow the Taylor series of /[( x) K (x s x)] aroud x =, ( x) K (x s x) = f x, I. Selesick EL 73 Lecture Notes 2 As

the we ca write, as before, A(x) = ( B(x) x L+) = f x B(x) x L+ f x f x. Because we kow that the polyomial A(x) if of degree L, ad because the secod term cotais terms of powers greater tha L oly, A(x) must be give by ad P (x) is give by A(x) = L f x (2) P (x) = ( x) K (x s x) L f x. To fid the Taylor series expasio of /[( x) K (x s x)] we ca use ad to write ( x) = ( ) K + 2 c K x, c = x s x = ( d x, d = ( x) K x s ) + x s x = c i x i d j x j i= j= [ ] = c m d m= } {{ } f x I. Selesick EL 73 Lecture Notes 3

Therefore, we ca fid the coefficiets f by covolvig c ad d, f = c d. I (2) we oly eed f for L. To compute f over this rage, we must compute c, d for L also. The covolutio of those two fiite-legth sequeces will be of legth 2L +. The values f are obtaied by trucatio dow to legth L +. Example The followig Matlab program implemets this procedure where we use K = 3, L = 5 as i the previous example. frequecy ω s is take to be ω s =.7 π here. K = 3; L = 5; ws =.7*pi; xs = /2 - cos(ws)/2; = :L; c = biom(k+-2,); d = (/xs).^(+); f = cov(c,d); a = f(:l+); k = :K-; p = cov(a,biom(k-,k).*(-).^k); p = cov(p,[xs -]); h = x2z(p); The The followig figures illustrate the results. It ca be see that there are 2(K ) zeros at z = ad 2L zeros correspodig to the passbad. I. Selesick EL 73 Lecture Notes

.6 TYPE I FIR FILTER (MAXIMALLY FLAT PASSBAND).5..3.2.. 2 6 8 2 6.2.8.6..2..2.3..5.6.7.8.9 ZERO DIAGRAM 2 2 3 2 2 3 5 6 This procedure is quite geeral. It calls oly for the Taylor series expasio of a certai fuctio (associated with the stopbad). The program biom, for computig biomial coefficiets, is give at the of these otes. I. Selesick EL 73 Lecture Notes 5

Ad Geeral Passbads I additio to specified zeros i the stopbad, it may be desired that a flat filter have poits of uity gai i the passbad, at frequecies other tha ω =. For example, we might wat H f (ω) to have a double root at a frequecy ω p. I this case we ca write the coditio as P (x) = B(x) x L (x p x) 2 where x p = 2 2 cos ω p. I this coditio, we have reduced the degree of flatess at x = correspodigly. Placig a zero at x s as i the previous sectio, we have agai P (x) = A(x) ( x) K (x s ). Combiig, we have = A(x) ( x) K (x s ) + B(x) x L (x p x) 2. The procedure described before will ot work here, so lets compute A(x) ad B(x) together by solvig a liear system of equatios. Defiig, R(x) := ( x) K (x s ) (22) S(x) := x L (x p x) 2, (23) we have: = A(x) R(x) + B(x) S(x). I. Selesick EL 73 Lecture Notes 6

We ca write this i terms of matrices as r s.... r a.... s. =... +... r K. a L s L+.... r K... s L+ }{{}}{{}}{{} e R S or [ R S ] [ ] a = e. b b. b K This is a square system of equatios, so we ca solve for A(x) ad B(x) directly. Example The followig Matlab program implemets this procedure, with ω p =.5π ad ω s =.75π, K = 3 ad L = 5. The resultig filter is show i the figure. K = 3; L = 5; wp =.5*pi; ws =.75*pi; xp = /2 - cos(wp)/2; xs = /2 - cos(ws)/2; r = cov(biom(k-,:k).*(-).^(:k),[xs -]); r = r(:k+); s = [zeros(,l-) xp^2-2*xp ]; R = covmtx(r,l+); S = covmtx(s,k); V = [R S]; T = V\[; zeros(l+k,)]; a = T(:L+) ; b = T(L+2:L+K+) ; I. Selesick EL 73 Lecture Notes 7

p = cov(a,r); h = x2z(p);.8 TYPE I FIR FILTER.6..2.2 2 6 8 2 6.2.8.6..2..2.3..5.6.7.8.9 ZERO DIAGRAM.5.5.5.5 3 2 2 3 5 I. Selesick EL 73 Lecture Notes 8

MAXIMALLY FLAT TYPE II FIR FILTERS As we have see, if H (z) is a Type I trasfer fuctio, the H f (ω) ca be writte as H f (ω) = P where P (x) is a polyomial, ( 2 ) 2 cos(ω) P (x) = p + p x + + p M x M. A Type II trasfer fuctio H 2 (z) ca always be writte as H 2 (z) = 2 ( + z ) H (z) where H (z) is a Type I trasfer fuctio. Note that H f 2 (ω) = 2 ( + e jω ) H f (ω) = 2 e jω/2 ( e jω/2 + e jω/2 ) H f (ω) = e jω/2 cos(ω/2) H f (ω) = e jω/2 2 + 2 cos(ω) Hf (ω). (Note double agle formula.) Now if we defie P 2 (x) as P 2 (x) := x P (x) = x ( p + p x + + p M x M) the ( P 2 2 ) 2 cos(ω) = 2 + ( 2 cos(ω) P 2 ) 2 cos(ω) = 2 + 2 cos(ω) Hf (ω) = e jω/2 H f 2 (ω) I. Selesick EL 73 Lecture Notes 9

Therefore, where H f 2 (ω) = e jω/2 x P (x) (2) x = 2 2 cos(ω). Therefore, to obtai a maximally flat Type II FIR filter H 2 (z) we ca first obtai a polyomial P (x) such that P 2 (x) = x P (x) is maximally flat, ad the covert P (x) to H (z) ad set H 2 (z) = 2 ( + z ) H (z). I this case, the problem is to fid a polyomial P (x) of degree L + K satisfyig the costraits, P 2 () = (25) P (i) 2 () =, i =,..., L (26) P (i) 2 () =, i =,..., K (27) where P 2 (x) = x P (x). Equivaletly, P 2 (x) ca be factored as P 2 (x) = A(x) x ( x) K ad P 2 (x) ca be factored as P 2 (x) = B(x) x L+, where A(x) is a polyomial of degree L. Combiig the coditios, we have = A(x) x ( x) K + B(x) x L+ or A(x) = B(x) xl+. ( x) K+ 2 I. Selesick EL 73 Lecture Notes 2

If we write /( x) K+ 2 as a Taylor series aroud x =, the we have ( x) K+ 2 = c x A(x) = ( B(x) x L+) c x = L c x + higher terms. Sice A(x) is of degree L, we have ad A(x) = L c x P (x) = ( x) K L c x. It oly remais to fid the values c i the Taylor expasio of /( x) K+ 2. We ca use the equatio (8) agai, with K + 2 i place of K, ( x) K+ 2 = ( K + 2 + ) x. The we have P 2 (x) = x ( x) K ( K + 2 + ) x ad H 2 (z) = 2 (+z ) ( ) z + 2 + z K L ( K + 2 + ) ( ) z + 2 z. I. Selesick EL 73 Lecture Notes 2

To evaluate the biomial coefficiet for fractioal values of the upper etry, we ca use the Gamma fuctio Γ. The Gamma fuctio iterpolates the factorial fuctio o the itegers, Γ( + ) =! for Z, so we have ( K + 2 + ) = Γ(K + 2 + ) Γ(K + 2 ) Γ( + ). The Gamma fuctio also satisfies Γ(α + ) = α Γ(α), so if we defie c() := ( K+ 2 + ) the we ca write the ratio c()/c( ) as c() c( ) = Γ(K + 2 + ) Γ(K + 2 Γ(K + 2 ) Γ( + ) ) Γ() Γ(K + 2 + ) = K + 2 +. Also ote that c() = (usig the Taylor series rule for c()). With the rule c() = K + 2 c( ) (28) for > we ca the compute the values c() which are eeded. The followig pseudo program computes H 2 (z). Note the similarity with the pseudo program for the desig of maximally flat Type I I. Selesick EL 73 Lecture Notes 22

filters. Q(z) H 2 (z) c for from to L Q(z) Q(z) ( ) z + 2 z c c (K + /2)/ H 2 (z) H 2 (z) + c Q(z) for k from to K H 2 (z) H 2 (z) H 2 (z) 2 ( + z ) H 2 (z) ( ) z + 2 + z The followig Matlab program maxflatii implemets the pseudo program. The vector h is the impulse respose of the filter. fuctio h = maxflatii(k,l) h = ; q = ; c = ; for = :L q = cov(q,[- 2 -]/); c = c*(k-/2+)/; h = [ h ] + c*q; for k = :K h = cov(h,[ 2 ]/); h = cov(h,[ ]/2) I. Selesick EL 73 Lecture Notes 23

Example Whe K = 3, L = 5, the impulse respose h(), frequecy respose magitude H f 2 (ω), ad zero diagram are as show. Notice that exactly 2L zeros that cotribute to the shape of the passbad, ad exactly 2K + zeros are located at z =..6 MAXIMALLY FLAT TYPE II FIR FILTER.5..3.2.. 2 6 8 2 6 8.2.8.6..2..2.3..5.6.7.8.9 ZERO DIAGRAM 2 7 2 2 2 6 I. Selesick EL 73 Lecture Notes 2

A PROGRAM FOR BOTH TYPE I AND TYPE II FILTERS Notice that the programs maxflati ad maxflatii are very similar. With a slight modificatio, a sigle program ca be writte to hadle both Type I ad Type II filters. Let us deote the umber of zeros at z = by Z π. The maximally flat Type I FIR filter described above has Z π = 2K zeros at z =. That is, K = Z π /2. Therefore, the rule (2) for computig the values c() ca be writte as c() = K + c() = Z π/2 + c( ) c( ). (29) O the other had, the maximally flat Type II FIR filter has Z π = 2K + zeros at z =. That is, K = Z π /2 /2. Therefore, the rule (28) for computig the values c() ca be writte as c() = K + /2 c() = Z π/2 + c( ) c( ). (3) Because equatios (29) ad (3) are the same whe the parameter Z π is used, the two programs maxflati ad maxflatii ca be combied ito a sigle program. The followig program symflat hadles both Type-I ad Type-II maximally flat FIR filters. I. Selesick EL 73 Lecture Notes 25

fuctio h = symflat(zpi,l) % Maximally flat FIR filter (Type-I ad II) % ) Zpi zeros at z=- % 2) 2L zeros away from z=- % 3) legth(h) = Zpi+2L+ % ) If Zp = 2L+2, the h is halfbad h = ; q = ; c = ; for = :L q = cov(q,[- 2 -]/); c = c*(zpi/2-+)/; h = [ h ] + c*q; for k = :Zpi h = cov(h,[ ]/2); I. Selesick EL 73 Lecture Notes 26

Appix: A Program for Biomial Coefficiets The followig program for computig the biomial coefficiets ( ) k allows ad k to be scalars or vectors. fuctio a = biom(,k) % % a = biom(,k) % BINOMIAL COEFFICIENTS % % allowable iputs: % : iteger, k : iteger % : iteger vector, k : iteger % : iteger, k : iteger vector % : iteger vector, k : iteger vector (of equal dimesio) % v = ; kv = k; if (legth(v) == ) & (legth(kv) > ) v = v * oes(size(kv)); elseif (legth(v) > ) & (legth(kv) == ) kv = kv * oes(size(v)); a = v; for i = :legth(v) = v(i); k = kv(i); if >= if k >= if >= k c = prod(:)/(prod(:k)*prod(:-k)); else c = ; else c = ; else if k >= c = (-)^k * prod(:k--)/(prod(:k)*prod(:--)); else if >= k I. Selesick EL 73 Lecture Notes 27

c = (-)^(-k)*prod(:-k-)/(prod(:-k)*prod(:--)); else c = ; a(i) = c; I. Selesick EL 73 Lecture Notes 28

REFERENCES REFERENCES Refereces [] R. L. Graham, D. E. Kuth, ad O. Patashik. Cocrete Mathematics: A Foudatio for Computer Sciece. Addiso-Wesley Publishig Co., 99. [2] O. Herrma. O the approximatio problem i orecursive digital filter desig. IEEE Tras. o Circuit Theory, 8(3): 3, May 97. Also i [?]. I. Selesick EL 73 Lecture Notes 29