Maximally Flat Lowpass Digital Differentiators Ivan W. Selesnick August 3, 00 Electrical Engineering, Polytechnic University 6 Metrotech Center, Brooklyn, NY 0 selesi@taco.poly.edu tel: 78 60-36 fax: 78 60-3906 Abstract This paper describes the design of Type III and Type IV linear-phase FIR lowpass digital differentiators according to the maximally flat criterion. We introduce a two-term recursive formula that enables the simple stable computation of the impulse response coefficients. The same recursive formula is valid for both Type III and Type IV solutions. Revised manuscript submitted to IEEE Transactions on Circuits and Systems II: Analog and Digital Signal Processing. Original manuscript submitted February 6, 00. Manuscript received This work was supported in part by the NSF under CAREER grant CCR-9875.
List of Figures Type IV maximally flat lowpass differentiators..................... Type III maximally flat lowpass differentiators..................... List of Tables Numerical values of the weights c(n) for 0 K 3, 0 n 0............ 0
Introduction This paper describes the design of linear-phase FIR lowpass digital differentiators according to the maximally flat criterion. We introduce a two-term recursive formula that enables the simple stable computation of the impulse response coefficients. The same recursive formula is valid for both Type III and Type IV solutions. To avoid the undesirable amplification of noise in digital differentiation, lowpass differentiators can be used in place of full-band ones. They find application, for example, in bar code readers [6]. Maximally flat digital full-band differentiators have been described by several authors [3, 7, 8, 9, ] where the approximation is accurate at a single point, usually ω = 0, π/, or π. When the input signal lies in a known frequency band centered around the frequency ω o, it is desirable to use a differentiator which is maximally flat at ω o rather than at ω = 0. Solutions of that type have been introduced in [, 0,, ]. The design of lowpass differentiators can be performed with least squares, the Remez algorithm [8] and other methods [3, 3, ]; however, the design of maximally flat lowpass differentiators has not been previously addressed. The frequency response of the ideal (full-band) digital differentiator is H F B (e jω ) = j ω, ω < π. () The maximally flat FIR approximation to the ideal differentiator satisfies the derivative constraints, H(e jω ) = 0, ω = 0 () d dω H(ejω ) =, ω = 0 (3) d k dω k H(ejω ) = 0, ω = 0, k B () where B is the number of free parameters. Notice that the approximation is performed at a single frequency point ω = 0. Kumar and Dutta Roy described how the solution can be obtained from the maximally flat lowpass FIR filter [9]. The frequency response of the ideal lowpass digital differentiator is H LP (e jω j ω ω < ω c ) = 0 ω c < ω < π where ω c is the cutoff frequency. This paper describes the maximally flat linear-phase FIR approx- (5) 3
imation, which satisfies the constraints H(e jω ) = 0, ω = 0 (6) d dω H(ejω ) =, ω = 0 (7) d k dω k H(ejω ) = 0, ω = 0, k L (8) d k dω k H(ejω ) = 0, ω = π, 0 k M. (9) In this case, it is not a single point approximation problem and the solution can not be obtained directly from the maximally flat lowpass filter. Type III and Type IV linear-phase FIR solutions to this problem are derived in Section and Section 3 respectively. As in [], the method used in this paper is based on power series expansion. To compute the impulse response coefficients in a simple way, Section gives a two-term recursive formula which is valid for both Type III and IV solutions. This recursive formula was obtained using the algorithms of [5] for automatic hypergeometric-type sum simplification. A Matlab program to compute the maximally flat differentiator based on the two-term recurrence is available from the author. The derivation of the maximally flat lowpass differentiator below uses the transformation of variables used, for example, by Herrmann in the derivation of maximally flat lowpass Type I FIR filters [6]. Similar to [], the expression obtained in (58) below for the transfer function can be used as the basis of a structure for an efficient implementation of the filter. Type IV Solution The derivation of the solution will depend on a transformation that maps polynomials on the real interval [0, ] to polynomials on the upper half of the unit circle. Let P (x) be a polynomial, P (x) = p 0 + p x + p x + + p n x n. (0) If we define ( ) z + z H(z) = P, () then H(z) will be a Type I transfer function and its frequency response is given by ( H(e jω ) = P ) cos(ω). ()
Now, note that a type IV transfer function H (z) can always be written as H (z) = ( z ) H(z). (3) (This is because a Type IV transfer function always has a zero at z =. See [3, 7], for example, for a description of the four types of FIR linear-phase digital filter.) The frequency response of H (z) is given by where Note that even though the term e j ω H (e jω ) = ( e jω ) H(e jω ) () ( = j e j ω ω ) sin H(e jω ) (5) = j e j ω ( cos(ω) P ) cos(ω) (6) ( = j e j ω P ) cos(ω) (7) P (x) := x P (x). (8) appears in the expression for H (e jω ) no fractional delay element is needed for the implementation of this digital filter. (H(z) is a Type I transfer function which requires no fractional delays, and (3) does not introduce any fractional delay.) Our goal is to design P (x) so that H (e jω ) approximates the ideal lowpass differentiator. That means it is desired that ( P ) cos(ω) ω for ω 0 0 for ω π. (9) Equivalently, or in terms of P (x), arccos( x) for x 0 P (x) 0 for x arccos( x) for x 0 P (x) x 0 for x. (0) () These approximation condition can be written as P (x) = A(x) ( x) M () 5
and arccos( x) x P (x) = B(x) x L+ (3) where M, and L + are the degrees of tangency at x = and x = 0. The parameters M and L are the parameters that define the solution. A(x) and B(x) are power series in x. Adding () and (3), we get Solving for A(x) we get, arccos( x) x = B(x) x L+ + A(x) ( x) M. () A(x) = Let the Taylor series of the first term be given by: ( ) arccos( x) ( x) M B(x) x L+. (5) x arccos( x) = ( x) M x c(n) x n. (6) Note that the polynomial A(x) of minimal degree which satisfies (5) will be of degree L. (Suppose the degree of A(x) were less than L, then it would be impossible to choose a power series B(x) so that the right-hand side of (5) has the same degree as the left-hand side.) With A(x) being minimal degree, we have A(x) = L c(n) x n, (7) and P (x) = ( x) M L c(n) x n, (8) H (z) = ( z ) H(z) (9) = ( ) z + z ( z ) P (30) = ( ) z + + z M ( L ( ) z + z n z ) c(n). (3) Note that () the degree of P (x) is M + L, () the degree of H (z) is M + L +. That makes h (n) an impulse response of length M + L +. We need only find the Taylor series coefficients c(n). To this end, we define A (x) := ( x) M = c (n) x n (3) 6
where and where A (x) := ( ) M + n c (n) = n c (n) = arccos( x) x = n + n! (33) c (n) x n (3) ( ) n which is derived in the Appendix. Then A(x) = A (x) A (x) and c(n) = (35) n c (k) c (n k). (36) In Section, we give a recursive formula for computing the coefficients c(n). k=0 3 Type III Solution Note that a type III transfer function H 3 (z) can always be written as H 3 (z) = ( z ) ( + z ) H(z) (37) where H(z) is a Type I transfer function. (This is because a Type III transfer function always has a zero at z = and z =.) The frequency response of H 3 (z) is given by ( H 3 (e jω ) = j e j ω ω ) ( sin e j ω ω ) cos H(e jω ) (38) = j e jω cos(ω) + ( cos(ω) P ) cos(ω) (39) ( = j e j ω P3 ) cos(ω) (0) where P 3 (x) := x x P (x). () To design P (x) so that H 3 (e jω ) approximates the ideal lowpass differentiator, we ask that ( P 3 ) cos(ω) ω for ω 0 0 for ω π. () 7
Equivalently, or in terms of P (x), arccos( x) for x 0 P 3 (x) 0 for x arccos( x) for x 0 P (x) x x 0 for x. (3) () These approximation condition can be written as and P (x) = A(x) ( x) M (5) arccos( x) x x P (x) = B(x) x L+ (6) where M, and L + are the degrees of tangency at x = and x = 0. Adding (5) and (6), we get arccos( x) x x = B(x) x L+ + A(x) ( x) M. (7) As above, the polynomial A(x) of minimal degree which satisfies (7) will be of degree L. Solving for A(x) of minimal degree L we get A(x) = L c(n) x n (8) where c(n) are the coefficients in the Taylor series of Then arccos( x) x ( x) M+ = c(n) x n. (9) H 3 (z) = ( z ) ( + z ) H(z) (50) = ( ) z + z ( z ) ( + z ) P (5) = ( ) z + + z ( z ) ( + z M L ( ) z + z n ) c(n). (5) 8
Note that () P (x) is of degree M + L again, and () H 3 (z) is of degree M + L +. That makes h 3 (n) an impulse response of length M + L + 3. To determine c(n), define A (x) as A (x) := ( x) M+ = c (n) x n (53) where ( M + c (n) = + n ) n (5) and define A (x) as in (3). Then A(x) = A (x) A (x) and c(n) = n k=0 c (k) c (n k). The coefficients c (n) are the same for Type III and Type IV solutions, while c (n) has a different form. To evaluate the binomial coefficient for fractional values of the upper entry, we can use the Gamma function Γ, ( M + c (n) = + n ) n = Γ(M + + n) Γ(M + (55) ) Γ(n + ). The Gamma function also satisfies Γ(α + ) = α Γ(α), so we can write a recursive equation for evaluating c (n), In Section we unify the Type III and Type IV solutions. c (n) = n (M + n /) c (n ). (56) Combined Formula Let K denote the number of zeros a transfer function has at z =. A Type IV transfer function always has an even number of zeros at z = ; for the solution given in Section 3 we have K = M. On the other hand, a Type III transfer function always has an odd number of zeros at z = ; for the solution given in Section we have K = M +. In terms of K, the coefficients c (n) in (33) and (5) are given by the same formula, namely, ( ) K/ + n c (n) =. (57) n A causal maximally flat lowpass differentiator with linear phase is given by ( ) ( ) z + z K L H(z) = z L c(n) ( ) z + z n (58) 9
Table : Numerical values of the weights c(n) for 0 K 3, 0 n 0. c(n) n K = 0 K = K = K = 3 0.0000.0000.0000.0000 0.3333.3333.3333 3.3333 0.500.0667.833.000 3 0.0893 0.93.576 5.33 0.0608 0.87.633 6.70 5 0.07 0.7388.678 6.8658 6 0.037 0.680.78 7.578 7 0.079 0.6365.708 8.83 8 0.03 0.599.7639 8.783 9 0.095 0.5675.783 9.3509 0 0.068 0.505.800 9.89 with n c(n) = c (k) c (n k) (59) k=0 where c (n) is given by (57) and c (n) is given by (35). Using the algorithms given in [5] we can find the following two-term recursive formula for computing the coefficients c(n). c(n) = (8n + Kn 0n K + 3) c(n ) (n + K 3) c(n ) n (n + ) (60) for n with c(0) =, and c() = K + /3. The formula in (58) with the recursion for c(n) in (60) generates both Type III and Type IV solutions. When K is even we obtain a Type IV transfer function, when K is odd we obtain a Type III transfer function. In either case, the length of the impulse response is N = K + L +. Table gives numerical values for c(n) for several values of K and n. Notice that c(n) does not depend on L; rather L determines how many values of c(n) are needed in (58). As noted in [], this means that extra blocks can be added in a modular fashion to improve the frequency response. See [] for a discussion of implementation issues and block diagrams. 0
N = 30; K = 0::, L = (N K)/ 0.8 K=0 H(e jω ) /π 0.6 0. 0. K= 0 6 8 K= 0 0 0. 0. 0.6 0.8 ω/π Figure : Type IV maximally flat lowpass differentiators. To illustrate the maximally flat lowpass differentiator, Figure shows the frequency response for a family of Type IV lowpass differentiators of length N = 30, where K is varied from 0 to in increments of, and where L = (N K)/. The bandwidth of the frequency response depends on the relative values of K and L. When K = 0 we obtain a full band differentiator. Similarly Figure shows the frequency response for a family of Type III lowpass differentiators of length N = 3, where K is varied from to 5 in increments of, and where L = (N K)/. 5 Conclusion This paper describes the design of lowpass linear-phase FIR digital differentiators according to the maximally flat criterion. The solutions can not be obtained from a lowpass filter as in the case of a full-band differentiator. The algorithms for automatic sum simplification described in [5] were used to obtain a simple two-term recurrence relation for computing the coefficients of the impulse response. The equations (58) and (60) contain the main result. There are several possible extensions to the problem described in this paper. For example, the extension of the recursive formulas to the case where the maximally flat approximation to the ideal differentiator is performed not at ω = 0 but at another frequency ω o. For the full-band
N = 3; K = ::5, L = (N K)/ 0.8 H(e jω ) /π 0.6 0. 0. K=5 7 3 8 5 K= 0 0 0. 0. 0.6 0.8 ω/π Figure : Type III maximally flat lowpass differentiators. differentiator, solutions are given in [,, ]. This type of solution is relevant when the signal is centered around a known frequency (as in radar using Doppler tracking []). Another remaining question is the existence of low-complexity structures for maximally flat differentiators, of the kind described in [, ] by Samadi, Nishihara, and Iwakura for maximally flat lowpass filters. Those structures are multiplierless and have a regular structure. Another extension of the approach described in this paper is the design of second (and higher) order differentiators as in [0] where the desired frequency response is ω, etc. For applications where a variable fractional sample delay is required, an extension along the lines of [5] will be of interest.
A Derivation of c (n) To find c (n) in (3), note that arccos( x) A (x) x x = x x A (x) = x (6) (6) so A (x) satisfies the differential equation A (x) x + A (x) = Substituting the Taylor series for A (x) into this differential equation gives Now note that where c (n) (n + ) xn = x = x. (63) x. (6) g(n) x n (65) g(n) = n! ( ) n and where (a) n is the Pochhammer function, or rising factorial, defined as (66) Then we can write (a) n = (a) (a + ) (a + n ). (67) }{{} n terms c (n) (n + ) xn = g(n) x n. (68) Therefore, matching like powers in (68), we get c (n) = g(n) n + / (69) or c (n) = n + n! ( ). (70) n 3
References [] J. Le Bihan. Maximally linear FIR digital differentiators. J. Circuits, Syst., Signal Processing, (5):633 637, 995. [] J. Le Bihan. Coefficients of FIR digital differentiators and Hilbert transformers for midband frequencies. IEEE Trans. on Circuits and Systems II, 3(3):7 7, March 996. [3] B. Carlsson. Maximum flat digital differentiator. Electron. Lett., 7:675 677, April 99. [] IEEE DSP Committee, editor. Selected Papers In Digital Signal Processing,II. IEEE Press, 976. [5] E. Hermanowicz and M. Rojewski. Design of FIR first order digital differentiators of variable fractional sample delay using maximally flat error criterion. Electron. Lett., 30():7 8, 6 January 99. [6] O. Herrmann. On the approximation problem in nonrecursive digital filter design. IEEE Trans. on Circuit Theory, 8(3): 3, May 97. Also in [9]. [7] I. R. Khan and R. Ohba. New design of full band differentiators based on Taylor series. IEE Proc.-Vis. Image Signal Process, 6():85 89, August 999. [8] B. Kumar and S. C. Dutta Roy. Coefficients of maximally linear, FIR digital differentiators for low frequencies. Electron. Lett., (9):563 565, 8 April 988. [9] B. Kumar and S. C. Dutta Roy. Design of digital differentiators for low frequencies. Proc. IEEE, 76(3):87 89, March 988. [0] B. Kumar and S. C. Dutta Roy. Design of efficient FIR digital differentiators and Hilbert transformers for midband frequency ranges. Int. J. Circuit Theory Appl., 7:83 88, 989. [] B. Kumar and S. C. Dutta Roy. Maximally linear FIR digital differentiators for midband frequencies. Int. J. Circuit Theory Appl., 7: 7, 989. [] B. Kumar, S. C. Dutta Roy, and H. Shah. On the design of FIR digital differentiators which are maximally linear at the frequency π/p, p {positive integers}. IEEE Trans. on Signal Processing, 0(9):33 338, September 99. [3] T. W. Parks and C. S. Burrus. Digital Filter Design. John Wiley and Sons, 987.
[] S.-C. Pei and P.-H. Wang. Closed-form design of maximally flat FIR Hilbert transformers, differentiators, and fractional delayers by power series expansion. IEEE Trans. on Circuits and Systems I, 8():389 389, April 00. [5] M. Petkovšek, H. S. Wilf, and D. Zeilberger. A=B. A K Peters, 996. [6] W. Preuss. Symbol Technologies, NY. Personal communication, 000. [7] L. R. Rabiner and B. Gold. Theory and Application of Digital Signal Processing. Prentice Hall, Englewood Cliffs, NJ, 975. [8] L. R. Rabiner, J. H. McClellan, and T. W. Parks. FIR digital filter design techniques using weighted Chebyshev approximation. Proc. IEEE, 63():595 60, April 975. Also in []. [9] L. R. Rabiner and C. M. Rader, editors. Digital Signal Processing. IEEE Press, 97. [0] M. R. R. Reddy, S. C. Dutta Roy, and B. Kumar. Design of efficient second and higher degree FIR digital differentiators for midband frequencies. IEE Proceedings, Part G, 38():9 33, February 99. [] S. Samadi, T. Cooklev, A. Nishihara, and N. Fujii. Multiplierless structure for maximally flat linear phase FIR filters. Electron. Lett., 9():8 85, Jan 993. [] S. Samadi, A. Nishihara, and H. Iwakura. Universal maximally flat lowpass FIR systems. IEEE Trans. on Signal Processing, 8(7):956 96, July 000. [3] H. W. Schüssler and P. Steffen. Some advanced topics in filter design. In J. S. Lim and A. V. Oppenheim, editors, Advanced Topics in Signal Processing, chapter 8, pages 6 9. Prentice Hall, 988. [] I. W. Selesnick and C. S. Burrus. Exchange algorithms for the design of linear phase FIR filters and differentiators having flat monotonic passbands and equiripple stopbands. IEEE Trans. on Circuits and Systems II, 3(9):67 675, September 996. 5