Abstract-In this paper new cosine windows are proposed which allow maximally flat low-pass FIR filter realizations in a multistage-decimation process. In digital ...
IEEE TRANSACTIONS ON INSTRUMENTATION A N D MEASUREMENT, VOL. 41, NO. 3, JUNE 1992
407
Optimized Windows for FIR Filter Design to Perform Maximally Flat Decimation Stages in Signal Conditioning Gregorio Andria, Mario Savino, Member, IEEE, and Amerigo Trotta, Member, tEEE
Abstract-In this paper new cosine windows are proposed which allow maximally flat low-pass FIR filter realizations in a multistage-decimation process. In digital measuring devices this strategy is performed in order to limit the amount of data to the storage capabilities of the processor, in conjunction with filtering the data set available after oversampling to remove digitally the noise power produced by quantization. The consequent increase of the number of e5ective bits improves the dynamic performance of digital instrumentation, especially at lower frequencies.
I. INTRODUCTION significant improvement in terms of maximum fidelty and dynamic range of digitizing measuring devices within a given bandwidth has been brought, during the last years, by applying signal-processing techniques on the raw data derived from the acquisition process. A perspicacious use of a dedicated conditioning block may give the opportunity to achieve a higher overall system accuracy with reference to the behavior at low frequencies. In this band, in fact, the performance is limited primarily by quantization noise [l]. A suitable digital technique which may be implemented in many instances is oversampling, followed by postprocessing the quantized data with multistage decimation and digital low-pass filtering. By making white the quantization noise, the noise power out of the band of interest can be digitally removed, without affecting the input signal. After filtering, an increased number of effective bits is achieved. It may be desirable to provide a straightforward approach to design digital filters for decimators which may offer an acceptable trade-off between computational savings and frequency-response performance. Because of the importance of phase linearity and lower accuracy required for the specification of the coefficients, finite-duration impulse-response (FIR) filters are preferred for this application [2]-[5]. A number of available FIR filter design procedures fit well the overall specifications of multirate systems, even if most of them exhibit a high computation complexity [ 6 ] , [7]. An example is given by the sophisticated technique of equiripple design, based on Che-
A
Manuscript received May 14, 1991; revised January 24, 1992. This is a revised version of a paper presented at IMTC-91. The authors are with the Dipartimento di Elettrotecnica eed Elettronica, Politecnico di Bari, 70125 Bari, Italy. IEEE Log Number 9108036.
byshev approximation, developed in the early 1970’s by Parks and McClellan [8], which involves the Remez exchange algorithm. A much simpler technique, by which it is possible to reach optimal compromises between the width of the transition band and the size of ripples of the designed filters, is that of the Fourier series expansion [9]. The Kaiser window [lo] is the one which, much better than others, specifies a frequency-response trade-off between the peak height of the sidelobe ripples and the energy of the main lobe. The computation of the window samples involves the modified zero-order Bessel functions so that the processing time is lengthened. In this paper new cosine windows readily implementable in a direct manner are proposed, the coefficients of which have been computed through a simple optimization procedure, in order to minimize the sidelobe ripples. Complying with this frequency-response specification is of primary importance in designing digital filters for a multistage decimation system, as the overall passband ripple of the composite digital signal-conditioning block requires more severe constraints on the individual filters in the cascade to assure a high level of accuracy after decimation. 11. DIGITALPOSTPROCESSING A N D EFFECTIVE BITS
A . Instrument Architecture
It is a common practice, in digital instrumentation, to provide a suitable front end which performs the signal conditioning required to scale and filter the analog input signal, so that it can be digitized by the analog-to-digital converter (ADC), without suffering from bias due to aliasing. The analog antialiasing filter technology used allows bandwidths fairly close to the theoretical Nyquist limit (half the sampling frequency). The requirements of the cascaded ADC are set by the bandwidth and dynamic range specifications of the instrument. Improving dynamic range and accuracy implies a higher resolution of the ADC, i.e., increasing the number of bits used to represent the samples in digital form. Quantizing noise is the result of the finite resolution of the ADC. It may be thought of as broadband noise, so that its limitation of dynamic performance is more serious at lower input frequencies. A careful use of digital signal-processing techniques allows a significant improvement of the signal-tonoise ratio (SNR) instrument performances. This can be
0018-9456/92$03.00 0 1992 IEEE
408
IEEE TRANSACTIONS ON INSTRUMENTATION A N D MEASUREMENT, VOL. 41, NO. 3, JUNE 1992
achieved through a postprocessing block, following the ADC, which performs further conditioning of the input signal, operating on its digitized version. Effective bits are a figure of merit used to quantify the contributions of all forms of distortion and noise added by the measurement process: quantization, nonlinearities, and additive system noise. It is possible to increase the number of effective bits by implementing suitable AD conversion strategies, followed by digital filtering.
B. Oversampling The main activities performed by a postprocessing block are averaging and filtering, both devoted to SNR enhancement by bandwidth reduction. These signal-processing techniques depend on random noise that is uncorrelated with the input signal. It is possible to randomize the quantization noise with respect to the input signal by injecting a pseudorandom noise into the ADC [ 1 3 , so that the noise can be considered white in successive digital processing. However, an even better SNR can be achieved by removing the high-frequency quantization noise components with a digital low-pass filter as well. This task can be accomplished by using high sampling-frequencyperformance ADCs which allow an oversampling of the input signal, with respect to its bandwidth. The effect of this strategy on the instrument precision level may be measured by the increase in the number of effective bits. The quantization noise power due to the use of a b,-bit ADC is:
in terms of the ADC resolution q and full-scale amplitude A. If the quantization noise may be modelled as white, NP, represents its variance. If the input signal is oversampled by an integer ratio D , i.e., the sampling frequencyf, is an integer multiple of twice the maximum input frequencyfh, the noise bandwidth is widened by D , and the relevant power-spectral density is NP,/2Dfh. In order to account for noises due both to the ADC and to the analog front end, it may be useful to introduce the concept of an equivalent ADC as the converter which requires the following number of bits:
hancement by the same ratio (NPer = N P e / D ) and, as a consequence, an increase of effective bits to: 1 (rms)? 1 b, = 2 log:! (0). (3) 2 log2 N P e / D = be + -
The number of effective bits is increased by 1 / 2 b for every factor-of-two reduction in bandwidth ( D = 2 ) .
C. Multistage Decimation Performing the oversampling strategy requires an ADC with a sample rate D times the input bandwidth and setting the record length to D times the desired one. The storage of all data taken during a test may require high memory capabilities so that, once the noise bandwidth reduction has been performed, the filtered samples may be decimated by D to have a virtual b,,-bit ADC sampling at a frequency f , / D , with a reduced noise power which equals NPef. A significant increase in the number of effective bits requires the oversampling ratio D to be high, so that the implementation of a multistage-structure sampling-rate conversion system has to be performed, as it exhibits a greater computational efficiency than a single-stage one, in many cases [2]. Each stage has a low-pass digital filter and a cascaded Di decimating block, so that the overall decimation ratio is factorized in the product: K
D = i =n1 D i
and a multistage structure requires reduced storage capabilities, significantly reduced computation to implement the system and a simplified filter design problem [3]. This last advantage is particularly attractive with reference to the wider normalized transition bandwidth allowed at each stage. Meeting the specification of a narrow transition band requires a high order of the filter unit sample response, so that a lesser constraint in this sense may give significant advantages in decreasing computation time. If we now examine the low-pass filter frequency bands for the individual stages of a K-stage decimator (Fig. 1) we have [ 6 ] :
fh If IADi- I
f,
--
~
to code an input signal with a given rms value. In ( 2 ) , which may be seen as the definition of effective bits as those actually used in the AD conversion system, NP, = NP, + NPfe represents the overall noise power of an ideal be-bit ADC, including the noise introduced by the analog front end. The decreased SNR in (2) obviously makes be c bo.The quantization noise power in the range [ f h , f s / 2 ] may be digitally removed, without affecting the input signal, by low-pass filtering the sequence available after oversampling with a cutoff fh. The consequent noise bandwidth reduction by D after filtering implies an SNR en-
(4)
20
fs fh I f 5 20 A-1
f,
Di
20
f,
-s
20
A-I If I-
2
K- 1 f 5 f-
2
ith stage transition band
(5)
Kth stage transition band
(6)
ith stage stopband
(7)
Kth stage stopband.
(8)
with fh the passband edge frequency for each stage and A the ith stage output sampling rate. Equation (5) shows how the transition bands decrease gradually to the minimum,
409
ANDRIA er al.: OPTIMIZED WINDOWS FOR FIR FILTER DESIGN
r---------1
are needed to obtain satisfactory results in achieving the previous goal. 111. MAXIMALLY FLATLOW-PASSFIR FILTERDESIGN f K =f,
/D
TECHNIQUES BASEDON OPTIMIZED COSINEWINDOWS The advantages offered by finite-duration impulse-response (FIR) filters relative to infinite-duration impulseresponse (IIR) recursive filters in sampling-rate conversion systems have been recognized by several investigators [2], 131, [ 5 ] . The principal advantages can be summarized as follows:
f1
-linear phase designs are easily achieved, while IIR filters can only approximate it; -lesser accuracy is required for the specification of the filter coefficients, especially for internal state variables (small round-off noise, reasonable word lengths) ; -more efficient realization is achievable by direct convolution than with the recursive realization.
Stage 2
Stage 1
Stage 1
0
fh
f,/2D
fK
fh
f,/2D
fK
fh
f,/ZD
fK
fl-f,/2D
'2
f2-f,/2D
fp
f,
f2
f,
Fig. 1 . Block diagram of a K-stage decimator and low-pass filter specifications.
given by (6), in going from the first stage to the last one. This requires higher orders of filters of the last stages. Another consideration in the filter design regards the magnitude specifications on the amplitude response in each of the above-listed frequency bands. If we denote the canonic ith stage low-pass filter response as H,[exp ( j n , ) ] , in terms of the normalized radian frequency a, = 2af/x - the passband and stopband tolerance requirements are given by: 1-
o
I (H,(eJ"')I I6,
passband
(9)
stopband.
( 10)
In above equations 6, and 6, are the maximum allowed deviations from 1 in passband and from 0 in stopband, respectively, for the overall passband magnitude response: K
Ho(eJ"\) =
I 2 ,=I
Hl(eJRf)
(1 1)
where n, = 2af/f,. Equation (9) shows how the higher is the number of stages, much more severe is the constraint which has to be met by the ith stage low-pass filter amplitude response in terms of passband ripple level. This is required in order to compensate the growth of ripple with the number of stages. For the stopband ripple no change is needed in the design specification of the ith stage filter, since 6, is generally small, and the cascade of stages reduces the stopband ripple when the frequency bands of two stages overlap [3]. As a concluding remark we suggest that maximally flat design techniques of digital filters
With reference to this last performance it has to be noted that FIR arithmetic is reduced by precisely the sampling rate decimation factor D, in each stage. In fact, only the output samples at the rate - I / D l have to be computed. By adopting a recursive realization, filtering and decimation are performed according to: N- I
N
v,(m) =
c a,,v,(m
-
n=O
n)
+ nc =O
b,,x,(m
y,(m) = v,(D,m)
-
n)
(12) (13)
with x, ( m ) = y , - ,(m). It is evident how we cannot take advantage of the fact that we have to compute only every D,th output, since previous outputs are needed to compute it. On the other hand, using an FIR filter in this case implies that the output sequence y,(m) is simply related to the input sequence x, ( m ) by: N- 1
Y,(@ =
c h,(n)x,(D,m
n=O
-
n)
(14)
in terms of the impulse-response samples h, ( n ) . The most advantageous approach for designing a multistage decimator is based on setting up an optimization problem [2], [6]. The objective function to be minimized is an analytical measure of the efficiency of the design. The parameters f,,fh, D , 6, and 6 , being specified, the remaining free parameters D, and K are to be chosen to achieve an optimized implementation in terms of minimized computation or storage. One meaningful measure of computation is the total number of multiplications per second (MPS) that must be performed, given by:
if the even symmetry hi ( n ) = hi ( - n ) is assumed in each stage. R; stands for total computation in additions per second (APS). As a counterpart, a measure of design
~
410
IEEE TRANSACTIONS ON INSTRUMENTATION A N D MEASUREMENT, VOL. 41, NO. 3, JUNE 1992
complexity is the amount of memory required for coefficient and data storage, approximately proportional to the sum of the filter lengths in each stage:
number of taps required to meet the set specifications is given by [6], [7]:
K
NK =
C
i=l
Ni.
Both these objective functions involve the filter length Ni required for the ith stage. To formulate the optimization procedure it is then necessary to express the filter order in each stage in terms of the filter requirements for that stage. If the equiripple design technique, set up by Parks and McClellan [8] , is adopted, the approximate design formula:
is available. The second equality in (17) is obtained by substituting the ith transition bandwidth Af; with its expression in terms of passband and stopband edge frequencies, extracted by (5). The expression for the design parameter D,(S, / K, A,), which takes into account the ripple tolerances both in passband and stopband, is given in [2] and [6]. Replacing (17) into (15) or (16) it is possible to perform a computer-aided optimization procedure. The equiripple design technique gives an overall trade-off between ripple levels, transition bandwidth, and filter order. An optimal (in the Chebyshev sense) approximation, giving acceptable distortion errors throughout the passband and the stopband, is provided, rather than just meeting the specification at one frequency, and greatly exceeding it elsewhere. Nevertheless, the computational effort required by the second Remez multiple exchange algorithm, which is commonly used to solve the approximation problem, might not be acceptable for the matter in hand. Keep in mind the chance we have in adjusting the ADC sampling frequency f, in order to provide a sufficient guard space for the transition band of the last stage, which is the most critical of all, from a design viewpoint. A simpler FIR filter design method, which may give the approximation of a desired form of frequency response to an acceptable degree of accuracy, is the one of the Fourier series expansion [7], [9]. Even if the location of the passband and stopband edge frequencies is not properly controlled, yet the performances may be done very well. A ticklish design stage is the choice of the window which has to be used to control the Gibbs phenomenon. Strong advantages of the window method for designing digital filters for use in sampling-rate conversion systems are that it is simple, easy to use, and can readily be implemented in a direct manner (closed-form expressions are available for the window coefficients, hence the filter responses can be obtained simply from the ideal one). The Kaiser’s approach [lo] to window design is the only one which suggests a function to adjust the trade-off between ripple and transition bandwidth specifications. It produces equal-amplitude ripple in both passband and stopband, so that, putting 6 = 6,/K = 6, the minimum
where
r(6) = -20 loglo (6)
-
7.95
14.36 Equations (1 8) and (19) show that the required filter length is inversely proportional to the normalized transition width, for a given value of ripple. A shortcoming of the Kaiser window is the computation of the Io zero-order modified Bessel function of the first kind to find the window coefficients:
w(n) =
Zo[CuJl - ( 2 n / ( N - 1))2]
IO(4 N-1 N-1 -I~I2 2
w(n) = 0
(20)
elsewhere
where a controls the degree of taper towards the edges of the window; in the preceding (20) N is considered to be odd. Other kinds of windows commonly used to design FIR filters for decimators are Hanning and Hamming windows, belonging to the cos (X)window family, the coefficients for which are computed according to: M
w(n) =
c a, cos
m=O
N --
-1 2
N-1 2
I~I-
w(n) = 0 elsewhere (21) for M = 1 [9]. Even if their implementation is much simpler than the Kaiser window technique, they allow, unfortunately, only limited control in choosing values of fh, Af;, S, and 6,. A relationship linking filter length Ni with ripple levels and transition bandwidth is not available, so that an optimized procedure to design a multistage sampling-frequency conversion system, according to (15) or (16), is not possible to be performed. Using cos (X)windows is nevertheless attractive, owing to the amount of time saving they allow in the computation of the window taps, especially for high values Ni of the ith stage filter length. This goal has been reached by optimizing the frequency-response behavior of the windowed filter in terms of the maximum allowed passband ripple level. With reference to the generic decimation stage, the nth sample of the filter impulse response, weighted by the window defined by (21), is given by [7]: M
h(n) = L(n>w(n>= sin n7r (nil,) ~
c a, cos
m=O
(s)
41 I
ANDRIA er al. : OPTIMIZED WINDOWS FOR FIR FILTER DESIGN
,
where Qh = 2rfh/x- and h(0) = Q , / n . In (22) 6(n) is the nontruncated ideal filter impulse response. If it is truncated to N terms and shifted to begin at n = 0, producing a causal filter with pure linear phase, the relevant frequency-response magnitude characteristic is ( N - 1)/2 Qh IH(ejn>l = 2 h(n) cos (nQ) (23)
+
a
which oscillates around the desired unit value in the passband. The amplitude of these oscillations increases as Q approximates Qh, reaching its maximum for Qmax < ah. Increasing the filter length does not involve a ripple minimization, as the oscillations are only confined to a smaller frequency range, preceding the transition band. Otherwise, if the ripple specification given by (9) is rearranged, it may be used to define the error function:
E(e")
=
I 1 - I H(eJ")11
(24)
the maximum value of which, for E [O, ah], may be iteratively minimized until the desired ripple 6, / K is reached. By substituting (22) into (23) and this last result into (24), the optimization procedure is performed in terms of the window coefficients a,,,. With reference to a threeterm cosine window the order M equals 2. Both the normalization and continuity conditions: M m=O C a
m = l
(25)
o
(26)
M
C m=O
(-l>"a,,,
=
may be imposed to the window time response in order to have the error function (24) expressed in terms of only one a,,, coefficient, which has to be optimized. Choosing a low-order M gives windows with a small width of the main lobe, and this is suggested by the requirement to have a filter transition as narrow as possible. Solving (24)(26) in terms of a2 gives: a. = 0.5 - a2
(27)
al
(28)
=
0.5
a2 = 45.787 6
+ 0.085622
(29)
with (29) empirically derived for 6 E [O.OOOl, 0.011 and 6 = h P / K = 6,, similarly to the Kaiser window. If the ripple level is expressed as an attenuation in decibels, according to -20 loglo (A), the range is [40, 801 dB. The following design formula:
with
*(A)
=
,
Kaiser
n=l
-20 log,, (6) 86.6
+ 360
has been derived to perform the optimized design of the
0 + $40
45
50
55 55
60 60
70
65 65
75
3
~ 2 log(6) 0 [dBl
Fig. 2 . Windowed FIR filters design curves
multistage decimation system, according to (15) or (16). As it is evidenced by the curves in Fig. 2, where A F is the transition bandwidth normalized to the sampling frequency, the proposed optimized cosine windows are less sensitive to ripple-level changes than the Kaiser windows. This behavior of new windows is reasonable, because they have been designed to give very low rippleaffected amplitude responses of low-pass FIR filters for measurement applications. The curves can be used to find the minimum filter length N to meet the specifications in terms of normalized transition bandwidth and passband ripple level. This length is only slightly larger for cosine windows than for the Kaiser one, the difference becoming progressively smaller with decreasing ripple. IV . COMPARISONS WITH CLASSICAL TECHNIQUES In order to prove the effectiveness of the proposed weighting functions, a low-pass nonrecursive filter has been designed, according to the Fourier transform method, using the optimized three-term cosine window and classic ones. The passband and stopband ripple specification is 0.001 (60 dB). The cutoff frequency and the transition bandwidth are 0.5 and 0.1, respectively, if they are normalized to the Nyquist frequency (half time the sampling frequency). The coefficients of the optimized cosine window are:
aO = 0.36859
a , = 0.5
a2
=
0.13141
from (27)-(29). Fig. 3 shows the passband amplitude response behavior of differently windowed FIR filters. For the sake of comparison the responses produced by Hanning and Hamming windows are also reported, even if they allow no control of ripple. By using the Hanning window the maximum error is six times the desired one, with an equal filter length. Optimized windowed filter amplitude response exhibits the same maximum specified passband ripple as the Kaiser window, but a much better flatness throughout the passband, producing a very low amplitude distortion. The filter unit sample response is only 25 taps longer [cfr. Fig. 2 and (18) and (30)], but asymptotic stopband attenuation (Fig. 4) is much better. This is due to the faster decay of cosine window sidelobes (Fig. 5) in comparison with the Kaiser one owing to the continuity condition (26).
IEEE TRANSACTIONS ON INSTRUMENTATION A N D MEASUREMENT, VOL. 41, NO. 3, JUNE 1992
412
Hanning window
1
1.004 -
Kaiser window
c
1.002 1.002
t1
o,998 0.996
.
Opnmzed wndow
\
4
H m n g window
I:: i
0.994
0.1
0.3
0.2
0.4
0.5
wrr Fig. 3. Passband behavior of variously windowed low-pass FIR filters.
Amplitude response
0
1
-20
Hamming window
I
1.
-40 h
2
% -
-
-60 -80 -100
REFERENCES Optimzed window
-120 -140
02
04
06
08
1
w 7 T
Fig. 4. Amplitude responses of variously windowed low-pass FIR filters.
-80
‘I I
0
0.1
1
filter realizations, has been proposed in this paper. Though much less computation effort is needed in determining window taps, these weighting functions exhibit spectral performances comparable with those of the Kaiser window, down to very low ripple levels. A relationship linking the filter length with passband ripple and transition bandwidth has been derived and tested, for filters with 40-80 dB stopband attenuation, in order to provide a direct and simple design technique of windowed FIR filters for decimators. A continued effort to develop the outlined procedure suggested in this paper, for this application, seems warranted. The tapered unit sample response has been shown to be suitable to be implemented in postprocessing blocks which perform a multistage decimation dedicated to improve the signal-to-noise ratio (SNR) performances of digital measuring devices by removing the quantization noise produced by A/D conversion. The consequent increase in the number of effective bits is a measure of improved dynamic performances.
0.2
0.3
0.4
Wn Fig. 5. Comparison of window spectra.
V. CONCLUSION A new class of cosine windows, properly designed to give maximally flat low-pass amplitude response in FIR
[ l ] A. Gee and R. W. Young, “Signal conditioning and analog-to-digital conversion for a 4-MHz, 12 bit waveform recorder,” Hewlett-Packurd Journal, vol. 39, pp. 15-22, Feb. 1988. [2] R. R. Shively, “On multistage finite impulse response (FIR) filters with decimation,” IEEE Trans. Acoust., Speech, and Signal Processing, vol. ASSP-23, no. 4 , pp. 353-357, Aug. 1975. [3] R. E. Crochiere and L. R. Rabiner, “Optimum digital FIR implementations for decimation, interpolation and narrow-band filtering,” IEEE Trans. on Acoust., Speech, and Signal Processing, vol. ASSP23, no. 5, pp. 444-456, Oct. 1975. [4] P. P. Vaidyanathan, “Multirate digital filters, filter banks, polyphase networks and applications: A tutorial,” Proc. of the IEEE, vol. 78, Jan. 1990. [5] A. W. Crooke and J . W. Craig, “Digital filters for sample-rate reduction,” IEEE Trans. on Audio and Elecrroacoustics, vol. AU-20, no. 4 , pp. 308-315, Oct. 1972. [6] R. E. Crochiere and L. R. Rabiner, Multirate Digital Signal Processing. Englewood Cliffs, NJ: Prentice Hall, Inc., 1983, pp. 127250. [7] P. A. Lynn and W. Fuerst, Digital Signal Processing with Computer Applications. Essex, U.K.: John Wiley & Sons Ltd., 1989, pp. 132166. [8] T. W. Parks and J. H. McClellan, “Chebyshev approximation for nonrecursive digital filters with linear phase,” IEEE Trans. Circuits Theory, vol. CT-19, no. 2, pp. 189-194, March 1972. [9] V. Cappellini, A. G . Constantinides, and P. Emiliani, Digital Filters and Their Applications. 2nd ed. London: Academic Press Inc., 1981, pp. 53-99, 186-198. [lo] J. F. Kaiser, “Nonrecursive digital filter design using the I,-Sinh window function,” Proc. IEEE Inr. Symp. on Circuits and Syst., April 1974, pp. 20-23.