Anda di halaman 1dari 22

2

Digital Filters

Marcio G. Siqueira 2.1 Introduction ..................................................................................... 839


Cisco Systems, Sunnyvale, 2.2 Digital Signal Processing Systems .......................................................... 840
California, USA 2.3 Sampling of Analog Signals .................................................................. 840
2.3.1 Sampling Theorem
Paulo S.R. Diniz 2.4 Digital Filters and Linear Systems ......................................................... 841
Program of Electrical Engineering,
2.4.1 Linear Time-Invariant Systems • 2.4.2 Difference Equation
Federal University of Rio de
Janeiro, Rio de Janeiro, Brazil, 2.5 Finite Impulse Response (FIR) Filters .................................................... 844
2.6 Infinite Impulse Response Filters .......................................................... 845
2.7 Digital Filter Realizations ..................................................................... 846
2.7.1 FIR Filter Structures • 2.7.2 IIR Filter Realizations
2.8 FIR Filter Approximation Methods ....................................................... 848
2.8.1 W i n d o w Method • 2.8.2 Sar~imaki W i n d o w
2.9 FIR Filter Design by Optimization ........................................................ 849
2.9.1 Problem Formulation • 2.9.2 Chebyshev Method • 2.9.3 Weighted Least-Squares
Method • 2.9.4 M i n i m a x Filter Design Employing WLS • 2.9.5 The WLS-Chebyshev Method
2.10 IIR Filter Approximations .................................................................... 854
2.10.1 Analog Filter Transformation Methods • 2.10.2 Bilinear Transformation by Pascal Matrix
2.11 Quantization in Digital Filters .............................................................. 856
2.11.1 Coefficient Quantization • 2.11.2 Quantization Noise • 2.11.3 Overflow Limit Cycles •
2.11.4 Granularity Limit Cycles
2.12 Real-Time Implementation of Digital Filters ........................................... 859
2.13 Conclusion ....................................................................................... 860
References ......................................................................................... 860

2.1 Introduction information are originally continuous in time, which is usually


the case, and they occupy a limited range of frequencies, it is
The rapid development of integrated circuit technology led to possible to transform continuous-time signals into discrete-
the development of very powerful digital machines able to time signals without losing any significant information. By
perform a very high number of computations in a very short interpolation, the discrete-time signal can be mapped back
period of time. In addition, digital machines are flexible, reli- into the original continuous-time signal.
able, reproducible, and relatively cheap. As a consequence, It is worth mentioning that signals exist that are originally
several signal processing tasks originally performed in the discrete in time, such as the monthly earnings of a worker or
analog domain have been implemented in the digital domain. the average yearly temperature of a city.
In fact, several signal processing tools are only feasible to be As a result, the current technological trend is to sample and
implemented in the digital domain. quantize the signals as early as possible so that most of the
As most real life signals are continuous functions of one or operations are performed in the digital domain. The sampling
more independent variables, such as time, temperature, and process consists of transforming a continuous signal into a
position, it would be natural to represent and manipulate these discrete signal (a sequence). This transformation is necessary
signals in their original analog domain. In this chapter we will because digital machines are suitable to manipulate sequences
consider time as the single independent variable. If sources of of quantized numbers at high speed. Therefore, quantization

Copyright© 2005 by AcademicPress. 839


All rights of reproductionin any form reserved.
840 Marcio G. Siqueira and Paulo S.R. Diniz

of the continuous amplitude samples generate digital signals and converts the level of these samples into a numeric
tailored to be processed by digital machines. representation that can be used by a digital filter.
A digital filter is one of the basic building blocks in digital • Digital filter: The digital filter uses the discrete-time
signal processing systems. Digital filtering consists of mapping numeric representation obtained by the A/D converter
a discrete-time sequence into another discrete-time sequence to perform arithmetic operations that will lead to the
that highlights the desired information while reducing the filtered output signal.
importance of the undesired information. • Digital-to-analog (D/A) converter: The D/A converter
Digital filters are present in various digital signal processing converts the digital filter output into analog samples
applications related to speech, audio, image, video, and multi- that are equally spaced in time.
rate processing systems as well as in communication systems, • Low-pass filter: The low-pass filter converts the analog
CD players, digital radio, television, and control systems. samples of the digital filter output into a continuous-time
Digital filters can have either fixed (Antoniou, 1993; Jackson, signal.
1996; Oppenheim and Schafer, 1989; Mitra, 2001; Diniz, 2002)
or adaptive coefficients (Diniz, 2002).
In this chapter, we will describe: 2.3 Sampling of Analog Signals
• The most widely used types of digital filter transfer func-
Figure 2.2 shows the mechanism behind sampling of continu-
tions;
ous time signals and its effect on the frequency representation.
• How to design these transfer functions (i.e., how to
Figure 2.2(A) shows that a continuous signal x(t) is multiplied
calculate coefficients of digital filter transfer functions);
in the time domain by a train of unitary impulses xi(t). The
• How to map a transfer function into a digital filter struc-
resulting signal from the multiplication operation is x*(t),
ture;
which contains samples of x(t). Figure 2.2(B) shows the fre-
• The main concerns in the actual implementation in a
quency representation of the original signal x(t) before sam-
finite precision digital machine; and
piing. Figure 2.2(C) shows the spectrum of the impulse train
• The current trends in the hardware and software imple-
xi(t). Finally, Figure 2.3 shows the spectrum of the sampled
mentations of digital filters
signal x* (t). According to the convolution theorem, the Fou-
In particular, we focus on digital filters that implement rier transform of the sampled signal x*(t) should be the convo-
linear systems represented by difference equations. We will lution, in the frequency domain, of the Fourier transform of
show how to design digital filters based on magnitude specifi- the impulse train and the Fourier transform of the original
cations. In addition, we present efficient digital filter structures signal before sampling. Therefore, it can be shown that:
that are often required for implementation with minimal cost,
taking into consideration that real-time implementation leads
to nonlinear distortions caused by the finite word length x,~(d'°) = ~ x jT +j~-)
l=--o0
representations of internal signals and coefficients. Finally, (2.1)
the mostly widely used approaches to implement a digital filter 1
z - -

are briefly discussed. Tl=_oc

From the above equation and from Figure 2.2, it can be seen
2.2 Digital Signal Processing Systems that the spectrum of the sampled signal will be repeated at
every ~0s = 2 ~ / T interval. An important consequence of the
A typical digital signal processing (DSP) system comprises the
spectrum repetition is the sampling theorem shown next.
following modules, shown in Figure 2.1.
• Analog-to-digital (A/D) converter: Assuming that the
2.3.1 S a m p l i n g T h e o r e m
input signal is band-limited to frequency components
below half of the sampling frequency, the A/D converter If a continuous signal is ban&limited (i.e., X(jtOa)= 0
obtains signal samples at equally spaced time intervals for to, > We), x(t) can be reconstructed from XD(n) for

x(t)LI Sampleand ~ x(n)


y(n) y*(n) , y(t)
[I I 1 ....... I
Digital
filter
D/A
converter
Low-pass
filter
P

A/D converter

FIGURE 2.1 Architecture of a Complete DSP System Used to Filter an Analog Signal
2 Digital Filters 841

x i (t) of the sampling frequency), the sampled signal spectrum will


be distorted in the frequencies around ms/2. In the case of
Figure 2.4(B), no distortion occurred only because the signal
had no power at ms/2. This distortion is known as aliasing and
is undesirable in most cases. As a consequence, only case
2.4(D) 1 can be used to recover the spectrum of the original
-~@ ,. x*(t) continuous signal shown in Figure 2.4(A).
x(t)
The recovery of the continuous signal spectrum from the
(A) Signal Sampling sampled signal can be theoretically accomplished by using an
analog filter with fiat frequency response to retain only the
X(~) components between -tos/2 and m,/2 of the spectra shown in
Figure 2.4(A). The frequency response of the analog filter with
these characteristics is shown in Figure 2.5. The impulse re-
sponse of this filter is as follows:

/ \ ma
h(t) --
T sin (tOLpt)
"fit
(2.2)

-(% mc

(B) Signal Spectrum In equation 2.2, mLp is the cutoff frequency of the designed
low-pass filter. The mLp shall be chosen to guarantee no alias-
Xi(Jma) ing (i.e., mc < mLp ~ (Os/2). The impulse response in the
above equation is depicted in Figure 2.5. It is easy to verify
that a causal filter with this exact impulse response cannot be
implemented. In practice, it is possible to design analog filters
that are good approximations for the frequency response in
i
-2ms
I
-ms 0
" ms
I t
2ms O)a
Figure 2.5.

(C) Impulse Train Spectrum


2.4 Digital Filters and Linear Systems
FIGURE 2.2 Samplingof Continuous-Time Signals
An example of a discrete-time signal is shown in Figure 2.6. In
- c o < n < oo if ms > 2me, where ms is the sampling frequency a digital filter, the input signal x(n) is a sequence of numbers
in radians per second. indexed by the integer n that can assume only a finite number
Figure 2.4 shows sampling effects on a continuous-time of amplitude values. Such a sequence might originate from a
signal. Figure 2.4(A) shows the continuous-time signal spec- continuous-time signal x(t) by periodically sampling it at the
trum, and Figures 2.4(B), 2.4(C), and 2.4(D) show the time instants t = nT, where T is the sampling interval. The
sampled signal spectra for the cases mc = ms~2, m~ > ms~2, output sequence y(n) arises by applying x(n) to the input of
and mc < mJ2. It can be seen from these pictures that only the digital filter, with the relationship between x(n) and y(n)
Figure 2.4(D) does not produce distortion in the frequencies represented by the operator IT as:
between -mc and inc. Figure 2.4(C) shows that when the
sampled signal has frequency components above ms/2 (half y(n) - :fix(n)]. (2.3)

x* (jo,~)
lIT
, \,/ , \,/--- , \,/,.
-m c
3ms ms -ms__ mc ms ms 3ms 2ms ma

2 2 2 2

FIGURE 2.3 Spectrum of Sampled Signal

1 In the caseof Figure2.4(B), distortioncouldoccuronlyat ms/2.


842 Marcio G. Siqueira and Paulo S.R. Diniz

37
' X (j~)

-C0 c 0 O)c (%

(A) Continuous-Time Signal Spectrum

' XD(eJ~a)
1/T
\ / m
,V----V,
-2% -(% -~s 0 e)s ~s 2°s o
2- -°c= 2

(B) Sampled Signal Spectrum o c = %/2

I Xo(eJ~)
1/T
, ×--
X I
-2% 0
,X
--03s --0 s O)s --(Ds 2% (0
2 2
(C) Sampled Signal Spectrum C0c>O~s/2

l Xo(eJ~)

--\
I I I -~c o' ~c I
, \ ,/ I L
-2c0s --(I) 8
--~s 03s
0s 2c0s o
2 2
(D) Sampled Signal Spectrum Oc< o

FIGURE 2.4 Sampling Effects

2.4.1 Linear Time-Invariant Systems for all integers n and no. A causal digital filter is one whose
response does not anticipate the behavior of the excitation
The main classes of digital filters are the linear, time-invariant
signal. Therefore, for any two input sequences xl(n) and
(LTI) and causal filters. A linear digital filter responds to a
x2 (n) such that xl (n) = x2 (n) for n _< no, the correspond-
weighted sum of input signals with the same weighted sum of
ing responses of the digital filter are identical for n _< no;
the corresponding individual responses; that is:
that is:
F[~Xlxl(n) + o~2x2(n)] = ~xl!T[Xl(n)] + ~XzY[xz(n)], (2.4)
f{xl(n)] = f[x2(n)], for n _< no. (2.6)
for any sequences xx(n) and xz(n) and for any arbitrary con-
stants O~l and cx2. A digital filter is said to be time-invariant An initially relaxed linear-time invariant digital filter is
when its response to an input sequence remains the same, characterized by its response to the unit sample or impulse
irrespective of the time instant that the input is applied to sequence 8(n). The filter response when excited by such a
the filter. That is, 5r[x(n)] = y(n), and then: sequence is denoted by h(n), and it is referred to as impulse
response of the digital filter. Observe that if the digital filter is
F[x(n - no)] = y ( n - no), (2.5) causal, then h(n) = 0 for n < 0. An arbitrary input sequence
2 DigitalFilters 843

H (jC0a) x(n)

-O3Lp OJLp (%

l"
, h(t)

-O)L(.j FIGURE2.6 Discrete-Time Signal Representation

X(z)= ~ x(n)z-'. (2.10)


n=--oo

The transfer function of a digital filter is the ratio of the z


O)Lp 03Lp O)Lp O,)Lp O)Lp (OLp transform of the output sequence to the z-transform of the
input signal:
FIGURE 2.5 Ideal Low-Pass Filter
Y(z)
H(z) - (2.11)
X(z)"
can be expressed as a sum of delayed and weighted impulse
sequences: Taking the z-transform of both sides of the convolution ex-
pression of equation 2.9 yields:
x(n)= ~ x(k)6(n-k), (2.7)
k=-oc

n= oo n= oo k = - o o
and the response of an LTI digital filter to x(n) can then be
expressed by: and substituting variables (l = n - k):

y(n)=F [- ~
k=-oo
x(k)6(n-k) ] n=-oo
Y(n)z-n= ~
k=-cx~
h(k)z-k ~
l=-oc
x(1)z-l. (2.13)

= ~_, x(k)T[6(n- k)] The following relation among the z-transforms of the output
k=--oo (2.8) Y(z), of the input X(z), and of the impulse response H(z) of a
digital filter is obtained as:
= ~ x(k)h(n- k)
k=-oo
Y(z) = H(z)X(z). (2.14)
= x ( n ) * h(n).
Hence, the transfer function of an LTI digital filter is the
The summation in the last two lines of the above expression, z-transform of its impulse response.
called the convolution sum, relates the output sequence of a
digital filter to its impulse response h(n) and to the input 2.4.2 Difference Equation
sequence x(n). Equation 2.8 can be rewritten as:
A general digital filter can be described according to the
following difference equation:
y(n) = ~ h(k)x(n- k). (2.9)
k= oo N M

Z a,y/,-i/- Z b,*/,-,/ =0. (2.15)


Defining the z-transform of a sequence x(n) is written as: i=0 l=0
844 Marcio G. Siqueira and Paulo S.R. Diniz

Most digital filters can be described by difference equations Let us consider in detail a particular case of linear-phase FIR
that are suitable for implementation in digital machines. It is filters:
important to guarantee that the difference equation represents For M even:
a system that is linear, time-invariant, and causal. This is
guaranteed if the auxiliary conditions for the underlying dif-
ference equation correspond to its initial conditions, and the H(z) = h(nlz-" + h z-M/2 + Z h(nlz-"
system is initially relaxed. n=0 n=M/2+l
Nonrecursive digital filters are a function of past input
samples. In general, they can be described by equation 2.15 if Z h(n)(z-~ + z-(M ~1) + h z M/2.
a0 = 1 and ai = 0 for i = 1. . . . . N: rt=O

(2.19)
M
y(n) = Z b l x ( n - 1). (2.16) At unity circle:
I=0 Evaluating equation 2.19 (M even) at z = d °~, we have:

It can be easily shown that these filters have finite impulse M/2-1 (M) M
response and are known as FIR filters. For a0 = 1, equation H(eJ~°) = Z h(n)e-J~" + h e-j~M/2 -1- ~_. h(n)e -)°~".
2.15 can be rewritten as: n=O n=M/2+l
N M Considering the case of symmetric impulse response (i.e.,
y(n) = - Z aiy(n - i) + Z b;x(n - l). (2.17) h(n) = h(M - n) for n = 0, 1. . . . . M/2), we have:
i=1 l=0

It can be shown that these filters have, in most cases, infinite


[ (m) M/2-1 [ ( m)l]
H(e i') = e -j°~M/2 h + ~ 2h(n)cos oJ n - .
impulse response [i.e., y(n) ¢ 0 when n --+ ec] and are there-
fore known as IIR filters.
By replacing n by (M/2 - m), the equation above becomes:

2.5 Finite Impulse Response (FIR) Filters


H ( d ° ' ) = e -j~°M/2 h ( M ) M/2 /M m) cos [oJ(m)] 1.
+ m~_l2 h / ~ - -
The general transfer function of an finite impulse response
(FIR) filter is given by:
Defining ao = h(M/2) and am = 2 h ( M / 2 - m), for m = 1,
M M 2. . . . . M/2, we have:
H(z) = Z blz-1= Hoz M H (Z -- Zt). (2.18)
I=0 1=0 M/2
H (eP°)= e-J~M/2Z amCOS (o~m). (2.20)
A filter with the transfer functions in equation 2.18 will m=0
always be stable because it does not have poles outside the
unit circle. FIR filters can be designed to have a linear phase. A In summary, we have four possible cases of FIR filters with a
linear phase is a desirable feature in a number of signal pro- linear phase:
cessing applications (e.g., image processing). FIR filters can be
• Case A: M Even and Symmetric Impulse Responses
designed by using optimization packages or by using approxi-
(1) Characteristics:
mations based on different types of windows. The main draw-
h(n) = h ( M - n) for n = 0,1 . . . . . M/2
back is that to satisfy demanding magnitude specifications, the
H(eJ~o) = ~-jtoM/2~-.~M/2 ~ COS (corn), where ao=h(M/2)
Z . . m = 0 Um
FIR filter requires a relatively high number of multiplications,
and am = 2h(M/2 - m) for m = 1, 2 . . . . . M / 2
additions, and storage elements. These facts make FIR filters
potentially more expensive than IIR filters in applications (2) Phase: ®(co) = tan -1 fIm[H(e)~)]l
where the number of arithmetic operations or number of ~@(~o) __ M
(3) Group delay: T - ~o~ - T"
storage elements are expensive or limited. However, FIR filters
are widely used because they are suitable for designing linear- • Case B: M Odd and Symmetric Impulse Responses
phase filters. (1) Characteristics:
An FIR filter has a linear phase if and only if its h(n) = h(M - n) for n = 0, 1. . . . . (M/2 - 0.5).
impulse response is symmetric or antisymmetric; that is H(ej~°) = e-Jr°M~2Z..~m=I~-'~M/2+0"5
bm cos [03(m - ½)], where
h(n) = i h ( M - n). bm = 2h(M/2 + 0.5 - m) for m = 1,2 . . . . . (M/2 + 0.5).
2 Digital Filters 845

(2) Phase: O(m) = - t o M. h(n)


@0(~o) __ M
(3) Group delay: "r -- ~o 2"
• Case C: M Even and Antisymmetric Impulse Response
(1) Characteristics:
h(n) = - h ( M - n) for
n = O, 1. . . . . ( M / 2 - 1) and h ( M / 2 ) = O.
H(eJ~O) = e-J(~oM/2 ~/2 ~-~M/2
Z-,m=1 Cm sin (tom), where Cm = 2
TT T
3 4 5 6 9 10
P
n

2 h ( M / 2 -- m) for m = 1, 2 . . . . . M / 2 . (A) Case A


(2) Phase: O(to) = _ t o M + ~ . , h(n)
00(m) __ M
(3) Group delay: • -- e~ -- T"
• Case D: M Odd and Antisymmetric Impulse Response
(1) Characteristics:
h(n) = - h ( M - n), for n = 0, 1. . . . . ( M / 2 - 0.5).
H ( eJo~) = e-j(~oM/2 -~/2)v'M/2+°S
Z.~m=l dm sin [to(rn - ½)],
n
where dm = 2h(M + 0.5 - m), for m = 1, 2 . . . . .
2 3 4 5 6 7 10 1
( M / 2 ÷ 0.5).
(2) Phase: O(to) = _ t o m + 2" (B) Case B
00(~o) _ M
(3) Group d e l a y : c = - so - - T " , h(n)

As an illustration, Figure 2.7 depicts the typical impulse


responses for the linear-phase FIR filter.
Equation 2.19 for linear-phase FIR filters can be rewritten
as:

L t • 6 10
n
P

H ( z ) = z M/2 Z g l ( z I ± Z l), (2.21) 45 I


I=0

where the gfs are related to h(l), where L = M / 2 - 0.5 for M


odd and L = M / 2 for M even. If there is a zero of H ( z ) at (C) Case C
z0, z0 1 is also a zero of H ( z ) . This means that all complex zeros
not located on the unit circle occur in conjugate and reciprocal , h(n)
quadruples. Zeros on the real axis outside the unit circle occur
in reciprocal pairs. Zeros on the unit circle occur in conjugate
pairs.
It is possible to verify that the case B linear-phase transfer
function has a zero at to = 7, such that high-pass and band-
stop filters cannot be approximated using this case. For case C, T T 7 1011
there are zeros at to = ~r and co = 0; therefore they are not 4 s ~ l
suitable for low-pass, high-pass, and band-stop filter designs.
Case D has zero at to = 0 and is not suitable for low-pass and
band-stop design.
(D) Case D

2.6 Infinite Impulse Response Filters FIGURE 2.7 Linear-Phase FIR Filter: Typical Impulse Response

The general transfer function for infinite impulse response


(IIR) filters is shown below:
rd HIM=o (1 -- Z-1Z1) - M (z - zl)
N-M F[l:o
H(z) = ~Io~w- = noZ ~W-7----" (2.23)
H ( z ) -- Y ( z ) _ ~ M o blz-I (2.22) 11i=0 (1 z-lpi) 11i=0 (Z -- Pi)
X(z) 1 + ~ N 1 aiz i"
The above equation shows that, unlike FIR filters, IIR filters
The above equation can be rewritten in the following alterna- have poles located at pi. Therefore, it is required that [Pil < 1
tive forms: to guarantee stability for the IIR transfer functions.
846 Marcio G. Siqueira and Paulo S.R. Diniz

2.7 Digital Filter Realizations x(n)


From equation 2.15, it can be seen that digital filters use three
basic types of operations:
• Delay: Used to store previous samples of the input and
output signals, besides internal states of the filter
• Multiplier: Used to implement multiplication operations
of a particular digital filter structure; also used to imple-
ment divisions
h(O)( h(1)I h(2)(~)
• Adder: Used to implement additions and subtractions of
the digital filter

2.7.1 FIR Filter Structures


General FIR and IIR filter structures are shown in Figures 2.8
and 2.9. Figure 2.8 shows the direct-form nonrecursive struc-
(A)Odd Order

ture for FIR filters, while Figure 2.9 depicts an alternative


transposed 2 structure. These structures are equivalent when
implemented in software.
Since the impulse responses of linear-phase FIR filters are either
symmetric or antisymmetric [e.g., h ( n ) = + h ( M - n)], this
property can be exploited to reduce the overall number of multi-
plications of the FIR filter realization. In Figure 2.10 the resulting
realizations for the case of symmetric h(n) are shown. For the
antisymmetric case, the structures are straightforward to obtain.
)h(~)
2.7.2 IIR Filter Realizations
A general IIR transfer function can be written as in equation
2.22. The numerator in this transfer function can be imple-
y(n)
-- y(n)

x(n)u[~[ ~ ............~ - ~ ~ (B)EvenOrder


FIGURE 2.10 Linear-Phase FIR Filter Realization With Symmetric
h(0)~ ~ Impulse Response

mented by using an FIR filter. The denominator entails the use


of a recursive structure. The cascade of these realizations for
the numerator and denominator is shown in Figure 2.11. If the
recursive part is implemented first, the realization in Figure
2.11 can be transformed into the structure in Figure 2.12 for
the case N = M. The transpose of the structure in Figure 2.12
FIGURE 2.8 Direct-Form Nonrecursive Structure is shown in Figure 2.13.
In general, IIR transfer functions can be implemented as a
cascade or as a summation of lower order IIR structures. In
y(n) case an IIR transfer function is implemented as a cascade of
second-order sections of order m, it is possible to write:
h(O)
H(Z) = ~ I ~Ok -}- "~lkZ-1 @ ~2kz-2 = rI'~okZ2 -}- ~lkZ -~- ~2k
x(n)l I I .... I I
k=] 1 + talk z-1 + m2k z-2 k=l z2 + mlkZ + m2k
FIGURE 2.9 Alternative Form Nonrecursive Structure rn 2 t t imI
H z + Ylk_ £+Y2_ k = Z-lk(z).
= Ho ~ z2 + mlkz + rn2k k=l
2 This structure is characterized by the branches being reversed, such that the
sinks turn to summations, and the summations become distribution nodes. (2.24)
2 Digital Filters 847

bo bo
x(n) < y(n) x(n) = t, y(n)
1

E -a 1
E
bl ? -al
-a 2
E

E bM -a N
' _82

,@--
FIGURE 2.11 Recursive Structure in Direct Form

bo
x( n ) .d) . .(g>--<?) . y(n) FIGURE 2.13 Alternative Direct-Form Structure for N = M

P x(n) o .

(A) Cascade
o n,

a2 b2
i

aN bM
x(n)c = o y(n)


FIGURE 2.12 Direct Form Structure for N = M

Equation 2.24 is depicted in Figure 2.14(A). (B) Parallel


In the case an IIR transfer function is implemented as the
addition of lower order sections of order m, it is possible to FIGURE 2.14 Realization with Second-Order Sections
write:
! !

m 19 2 P t) m YPOkZ247 ,~PlkZ Equation 2.25 depicted in Figure 2.14(B).


H(z) = ~ -" %kz-- + Y~kZ-+-Y*2k = ho + ~_~
Z 2 47 m l k Z 47 m2k Z 2 47 m l k Z 47 m2k In general, for implementations with high signal-to-quan-
k=l k=l
tization noise ratios, sections of order two are preferred. Dif-
l! f/

f ~2 m ferent types of structures can be used for second-order


: h; Jr- = 2 47 m l k Z 47 m2 k k=l
sections, such as the direct-form structures shown in Figures
2.15(A) and 2.15(B) or alternative biquadratic structures like
(2.25) state-space (Diniz and Antoniou, 1986).
848 Marcio G. Siqueira and Paulo S.R. Diniz

'Yo
2.8.1 W i n d o w M e t h o d
x(n) c , o y(n) The window method starts by obtaining the impulse response
of ideal prototype filters. These responses for standard filters
are shown in Figure 2.16. In general, the impulse response is
calculated according to:

h(n) = ~ H(eJ~)d°~&o, (2.26)


--IT

r; ,q for a desired filter.


-m 2 71

(A) Type 1 IH(eJe) l

x(n) .(Z Q . y(n)

, I IP

2n ~o
(A) Low Pass
71 -ml
IH(eJco)l

~'2 t -m2
.C>-G--@.
I I.
(B) Type 2 ~cl ~c2 /'~ 2n m

(B) Band - Pass


FIGURE 2.15 BasicSecond-Order Sections
IH(eJm)l

2.8 FIR Filter Approximation Methods


There are three basic approximation methods for FIR filters
satisfying given specifications. The first one, the window [
method, is very simple and well established but generally
(%1 (%2 /'~ 2n co
leads to transfer functions that normally have a higher order
than those obtained by optimization methods. The second (C) Band Reject
method, known as minimax method, calculates a transfer
function that has minimum order to satisfy prescribed specifi- IH(eJ~)l
cations. The minimax method is an iterative method and is
available in most filter design packages. The third method,
known as weighted least squares-Chebyshev 3 (WLS-Cheby-
shev) is a reliable but not widely known method. The WLS-
Chebyshev method is particularly suitable for multirate
systems because the resulting transfer functions might have I
decreasing energy at a prescribed range of frequencies. (0cl (%2 1~ 2n 0)

(D) High - Pass

3 The WLS-Chebyshevmethod is also known as the peakconstrained method. FIGURE 2.16 Ideal Frequency Responses
2 Digital Filters 849

In the case of a band-pass filter, the prototype filter can be 1 + cos (2"rr/M + 1)
(2.31)
described by following transfer function: Y = 1 + c o s ( 2 [ 3 ~ / M + 1)"

0 for 0 < ]col < Ocl. In the above equation, [3 is a variable parameter that adjusts
IH(eJ~°) I = 1 for cocl< Iml < tOc2. (2.27) the Sar~imaki window main lobe width given by 413~/M + 1.
0 for O c 2 < Iol _< 7 . In the special case of [3 = 1, the Sar~imaki window becomes
identical to the rectangular window.
Using the inverse Fourier transform, the impulse response of The desired normalized window function is as written here:
the filter with the response in equation 2.27 can be obtained as
follows: w(n) = fv(n)/fv(O), (2.32)

for - M / 2 < n < M / 2 and w(0) = 1.


h(n) = ~ l .~ H(ei°')d'°ndm The unscaled coefficients w(n) can be expressed as:

M/2
= ~1 Jill cl 2 cos (on)do 1 (2.28)
cl w(n) = vo(n) + 2 Z vk(n), (2.33)
k=l
1
= - - [ sin (oc2n) - sin (Ocl n)],
,n'n
where vk(n) can be calculated according to the recursive equa-
tions below:
for n # 0, for n = 0, h(0) = 1 (Oc2 - Ocl).
Different window sequences can be multiplied to h(n) to 1 n = 0. (2.34)
limit its length, generating the impulse response for the Vo(n) = 0, otherwise.

designed FIR filter as follows:


vl(n) = { ' y - - 1,
3'/2,
0,
n=0.
Inl = 1.
otherwise.
(2.35)

h'(n) = h(n)w(n). (2.29) vk(n)=f2(y 1)Vk l(n) vk 2(n)+y[Vk l(n--1)+Vk l ( n + l ) ] , -k<n<k.


1 0, otherwise.
In equation 2.29, w(n) is the window sequence, and h'(n) is (2.36)
the impulse response of the obtained filter. The rectangular
window consists of truncating the sequence h(n); that is, The causal transfer function is given by:
w(n) = 1 for n = - M / 2 , - M / 2 + l . . . . . 0. . . . . M / 2 - 1 ,
M/2
M/2.
H(z) = Z- M / 2 Z h'(n)z -n (2.37)
n=-M/2
2.8.2 Sariimaki Window
The abrupt truncation of the impulse response performed by Example
the rectangular window leads to oscillations at frequencies Design an FIR filter satisfying the following specifications:
close to the resulting filter band edges. The satisfaction of Ap=O.2dB, Ar=32dB, op=2wx3400rad/sec, mr=
prescribed specification is difficult because these ripples have 2¢r x 4600 rad/sec, and o, = 2nv x 20, 000 rad/sec
uncontrollable m a x i m u m magnitude.
As alternatives, there are more flexible windows incorporat- Solution
ing design parameters that allow a trade-off between the transi- Figure 2.17 shows different responses obtained by using the
tion bandwidth and the ripples magnitude (Sar~imaki, 1992). rectangular and Sar~imaki windows on a low-pass filter. It can
The frequency response of the unscaled Sariimaki window be seen that the Sar~imaki window showed improvements with
is known to be the following: respect to the rectangular window response. In fact, the rec-
tangular window has a high order of 248; to satisfy the specifi-
cations, the transition band had to be reduced due to the high
• (o) = ~ ~-v(n)e-j°~n = 1 + Z 2 T k [ y c o s o + (y -- 1)l ripples close to the band edges. The Sar/imaki window required
n=-~ k=l order 48 to meet the specifications.

sin [ - ~ ! c o s -~ {y cos o + (y - 1)}]


sin[½cos -1 { y c o s o + (y- 1)}] ' 2.9 FIR Filter Design by Optimization
(2.30)
In the minimax approach, our aim is to design filters that
where Tk is the kth degree Chebyshev polynomial and: minimize the peak (maximum) of the error with respect to
850 Marcio G. Siqueira and Paulo S.R. Diniz

10

-10

-20
l
1
m' -30

g -40
¢-
O')

-50

-60

-70

-80

-900 lO'OO 20'00 3o'0o 4o'o0 50bo 6o.00 7o.00 8o.00 90'00 10,000
Frequency [Hz]

(A) Rectangular Window

20

-201
\
rn
-40
"O
-I
¢-

-60

-80

-100

-120 ' ' ' ~ ' ' ' ~ '


0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10,000
Frequency [Hz]
(B) Sar&maki Window

FIGURE 2.17 Low-Pass Filter Using Window Method

desired characteristics without directly considering the error specifications in terms of the maximum deviation the pass-
energy. On the other hand, the least squares approach aims to band and in part of the stopband, while minimizing the energy
minimize the error energy. As can be observed in Figure 2.18, in the stopband frequency range. This type of approximation is
there are solutions between these two extremal types of object- very useful in modern DSP systems involving subsystems with
ive functions that provide good trade-off between peak error different sampling periods. The approximation method dis-
and error energy. In this section, we present a very flexible cussed here includes the least squares and minimax approaches
approach to designing FIR digital filters satisfying prescribed as special cases.
2 Digital Filters 851

0.0054- The desired frequency response is given by e-JM/2°aD(~),


+ * Minimax solution and W(m) is a strictly positive weighting function. The weighted
error function E(~o) is defined in the frequency domain as:
0 0.0045-
0
0
x
E(to) = W(to)[D(to) -/2/(to)]. (2.43)
0.0036-
+
0 + The approximation problem for FIR linear-phase digital
0.0027- + filters is equivalent to the minimization of some objective
--x
++ Peak constrained Least-square function of E(~o) in such way that ]E(to)l _< & Then:
g 0.0018- solution
*6
I--
+
+
8
0.0009- + I H ( t o ) - D(to)l 5 W(m~" (2.44)
Idealerrors=(O,0) + + + + + + + + + +
,/
0 i I I I I A good discrete approximation of E(to) can be obtained by
0 0.005 0.01 0.015 0.02 0.025 evaluating the weighted error function on a dense frequency
Peak error grid with 0 _< toi _< ~ for i = 1. . . . . L(M + 1). For practical
purposes, for a filter of length M + 1, we use 8 < L < 16.
FIGURE 2.18 Minimax Versus Least Squares
Points placed at the transition band are disregarded, whereas
the remaining frequencies should be linearly redistributed in
the passband and stopband including their corresponding
2.9.1 Problem Formulation
edges. Thus, the following vector equation results:
Consider a nonrecursive filter of length M + 1 described by
the transfer function: e = W ( d - Ub), (2.45)

M
where:
H(z) = Z h(n)z-n' (2.38)
n=0 e = [E(~ol)E(to2) ... E(toL(M+I))]g. (2.46)
W= diag[W(tol)W(to2)... W(toL(M+l))]. (2.47)
assuming that co, = 2-rr. The frequency response of such filter
is then given by: d = [D(tol)D(to2) ... D(~oL(v+l))] r. (2.48)

If cos (ml) cos (2ml) . . COS ( 2


M- 0 3 1 )
M
COS ( ~ 2 ) COS ( 2 ( 0 2 ) .. COS ( M 1.O2)
H(d°') = Z h(n)e-J~'~ = d°(~°)/q(to)' (2.39) U=
n=O
... COS ( M
COS ( ( O L ( M ÷ I ) ) COS ( 2 t O L ( M + I ) ) Tm~(M+I))
where O(to) and/2/(to) are the phase and magnitude responses (2.49)
of H(eJ°'), respectively defined as:
(2.50)

. lfIm[H(eJ'°)]]
0(to) = tan ~ . ~ j~. (2.40) In these equations, L < L because the transition frequencies
were discarded.
/:/(to) = Im(d~°) I. (2.41) A low-pass filter specification includes 8p as the passband
maximum ripple and 8r as the stopband minimum attenu-
Assume that the phase response ®(to) is linear on to, that M ation, with top and tot being the passband and stopband edges,
is even, and that h(n) is symmetrical. The cases of M odd and/ respectively.
or h(n) antisymmetrical can be easily derived based on the Based on these values, the following can be defined:
proposed formulation. The frequency response of such filter
1 +Sp
thus becomes: DBp= 20 lOglo ( ~ ) [dB ] . (2.51)

M/2 DBr = 20 lOgl0 (8r)[dB]. (2.52)


g(eJ°a) = e-JM/2~°Z an COS(ton), (2.42)
n=O The design of a low-pass digital filter using either the minimax
method or the WLS approach is performed by choosing the
with ao = h(M/2) and an = 2 h ( ~ - n) for n = 1. . . . . M/2. ideal response and weight functions, respectively, as:
852 Marcio G. Siqueira and Paulo S.R. Diniz

D(o3) = ~1' 0<o3<o3p. (2.53) 2.9.4 Minimax Filter Design Employing WLS
( 0, o3r < o3 _< "rr. This section describes a scheme that performs Chebyshev
1, 0 < o3 < o3p. approximation as a limit of a special sequence of weighted
W(o3) = 8p/Sr, o3r < ~ < "rr.
(2.54)
least-squares approximations. The algorithm is implemented
by a series of WLS approximations using a varying weight
Other types of transfer functions can be similarly defined. matrix W k , whose elements are calculated by:

2.9.2 Chebyshev Method W~+ 1(03) = W~(O3)Bk(O3), (2.62)

Chebyshev filter design consists of the minimization of the where:


maximum absolute value of E(o3) with respect to the set of
filter coefficients: Bk(o3) = IEk(o3)]. (2.63)

]]E(o3)]]oo = min max [W(o3)lD(o3) -/4(re)I]. (2.55) This approach entails increasing the weight where the error is
b 0<m<'rr
smaller.
Using equations 2.46 to 2.50, the Chebyshev method attempts The convergence of this algorithm is slow because usually 10
to minimize: to 15 WLS designs are required in practice to approximate the
Chebyshev solution. An efficiently accelerated algorithm was
]]E(o3)][~ ~ min max [ W l d - Ub]], (2.56) presented by Lim et al. (1992) that is characterized by the
b 0<_toi_<~r weight matrix W k whose elements are recurrently updated by:

at the discrete set of frequencies. The Chebyshev method w~+1(o3) = w~(o3)&(o3), (2.64)
minimizes:
where/)k(o3) is the envelope function of Bk(o3) formed by a set
DB~ = 20 log10 (8)[dB], (2.57) of piecewise linear segments that start and end at consecutive
extremes of Bk(o3). The band edges are considered extreme
where 8 = max [8/, 8r]. frequencies, and the edges from different bands are not con-
nected. By denoting the extreme frequencies at a particular
iteration k as o3~l,for l = 1, 2. . . . . the envelope function is
2.9.3 Weighted Least-Squares Method formed as:
The weighted least-squares (WLS) approach minimizes:
Bk(o3) = (o3 -- @)Bk(o3~l+l) + (@+1 -- o3)Bk(@) ' < to < '
(°".1 - o3'l) , o31 - - o3.1.
IIE(o3)l122=
[ [E(m)l2 do3 =
V 0
w2(o3)lD(o3)-- /-}(I.0)t2 do.

(2.58)
(2.65)

Figure 2.19 depicts typical cases of the absolute value of the


This objective function at a discrete set of frequencies is esti- error function (dash-dotted curve) used by the algorithm of
mated by: equation 2.62 to update the weighting function; the figure also
depicts a corresponding envelope (solid curve) used by the
algorithm of equation 2.65.
IIE(o3)ll~ ~ eTe, (2.59)

the minimization of which is achieved with: 2.9.5 The WLS-Chebyshev Method


Comparing the adjustments used by the algorithms described
b* = ( u T w 2 U) -1 u T w 2 d (2.60) by equations 2.62 through 2.65 and illustrated by Figure 2.19,
with the piecewise-constant weight function used by the WLS
The WLS objective is to maximize the passband-to-stopband method, it is possible to derive a very simple approach for
ratio (PSR) of energies: designing digital filters with some compromises on minimax
and WLS constraints (Diniz and Netto, 1999). This approach
(I0% ]/2/(m) ]2do3"~ consists of a modification on the weight-function updating
PSR = 101ogl0 ~f~r I/~(o3)12do3]
[dB]. (2.61) procedure in such way that it becomes constant after a par-
ticular extreme of the stopband of Bk(o3):
2 Digital Filters 853

xl 0-3
1.6

1.4

1.2

0.8
i, 'i ii
ii~ 'i ii
i!f !i i ?
i! I 'i
0.6 i!i!~ I 't ii ,~ i !! ! ! i i
i
i! ' i !
i! ii , i ! i : L 'i ~i ~ ii i ~
ii ~i t i ' li ~ ii i i
0.4
ii i! i! i !i i! ! ' , ' i i i
~ i i i i ii i
ii i! i! I !i i' ~i i ~, ii
ii i! i! !i if ii i i i
0.2 ii i! i!
'f !i i 'i ~i i
!i i! i! " i' !i ' 'i ,i
i r
1000 2000 3000 4000 5000 6000 7000 8000 9000 10,000
Frequency [Hz]

FIGURE 2.19 Typical Absolute Error Function B(to) (Dash-Dotted Line) and Corresponding Envelope /~(~o) (Solid Curve). The [3(o))
corresponds to the WLS-Chebyshev method (darker dotted curve).

W#+l(O.) ) = W#(o.))~k(O.) ). (2.66) based algorithms comparable to the classic minimax approach
(Antoniou, 1993). The WLS-based methods, however, do have
For the algorithm of equation 2.65, [3k(O~) is given by: the additional advantage of being easily coded into computer
routines.
!
f 0 !< co < ~0L. (2.67)
Example
L mL<m_<~.
Design FIR using some WLS-Chebyshev filters by satisfy-
The coL is the Lth extreme value of the stopband of ing the following specifications: Ap = 0.02 dB, Ar = 32 dB,
B(~0) = [E(co)[. The passband values of B(eo) and /~(eo) are ~0p = 2w x 3400 rad/sec, tot = 2~r x 4600 rad/sec, O~s = 2w
left unchanged in equation 2.67 to preserve the equiripple x20,000 rad/sec. These are specifications established by in-
property of the minimax method, although it does not have dustry standards for prefiltering speech signals before these
to be that way. The parameter L is the single design parameter signals are subsampled to 8kHz.
for the proposed scheme. Choosing L = 1 makes the new
scheme similar to an equiripple-passband WLS design, Solution
whereas choosing L to be as large as possible (i.e., making This example applied to the functions seen in Figure 2.19
O-)L = w), we return to the original minimax algorithms. is depicted in Figure 2.20. The results are for the least-squares
The computational complexity of WLS-based algorithms, and minimax approaches and for the WLS-Chebyshev
like the algorithms here described, is of the order of filter where co~ was chosen as the fourth extreme in the
(M + 1) 3, where M + 1 is the length of the filter. This com- filter's stopband. The order of all filters is 40. Compared with
plexity can be greatly reduced by taking advantage of the the filters designed by the window methods, the WLS, WLS-
Toeplitz-plus-Hankel internal structure of the matrix Chebyshev, and the minimax filters are much more econom-
(uTw2u) in equation 2.60 and by using an efficient grid ical. The reader should note that the passband ripple specified
scheme to minimize the number of frequency values. These here is 10 times smaller than the value used in the window
simplifications make the computational complexity of WLS- example.
854 Marcio G. Siqueira and Paulo S.R. Diniz

10 , , ,

-10

-2O
7
m -30
2
(D
-0 t
= -40
¢-
03
, li i t !
! n ; i .,\lli'
z; -50

•l~i : i ! : !" /if- -1[~ A


-60 •i .'! ". !]. r" i'j [:
!]i !.'] i~ •• ~
~ t" i i! ....
/I • ~,.
-70
! ' ''~ i"i
i i."
i.
i

-80
lo;o 2o'oo 3o'oo 4o'oo sooo 6000 7000 '.80~0 000 10,000
Frequency [Hz]
;" •I i

FIGURE 2.20 Frequency Responses of the WLS, WLS (Dotted Line), WLS-Chebyshev(Dashes and Dotted Line), and the Minimax (Solid
Line) Filters

N
2.10 IIR Filter Approximations
Hal(z) = Z T rkz (2.69)
Z - - eP k T '
k=l
IIR filters are usually designed by using analog filter approxi-
mations that are easy to apply and are well established. IIR filters where rk and Pk are the zeros and poles of the analog transfer
can also be designed by using optimization methods. It is function approximation.
known, however, that simultaneous approximation of magni-
tude and phase is a difficult problem, and no reliable iterative Bilinear Transformation Method
design methods are available. The use of optimization methods
The b i l i n e a r t r a n s f o r m a t i o n m e t h o d is based on applying the
in IIR filter design is more common in equalization problems
transformation s = 2(z - 1)/T(z + 1) to the designed analog
when specifications for both magnitude and phase are given.
transfer function, so that:

2.10.1 Analog Filter Transformation Methods Hd(z) =Ha(s)ls_~ . (2.70)

There are two popular methods for designing digital filters As a consequence, the bilinear transformation maps the analog
starting from analog approximations: the i m p u l s e i n v a r i a n c e frequencies into the digital frequencies as follows:
m e t h o d and the bilinear t r a n s f o r m a t i o n m e t h o d . These
methods are discussed in the following sections. 2 toT
toa = ~ t a n (2.71)
1 2
Impulse Invariance Method
In the impulse invariance method, a digital filter is designed so Therefore, to design a digital filter with predefined specifica-
that its impulse response is close to the sampled analog im- tions, it is necessary to first design an analog transfer function
pulse response. This method is useful for low-pass and some with adjusted specifications (prewarped) according to the
band-pass filter approximations. In general: above equation.
Figure 2.21 (A) shows how the frequencies in the digital filter
ha(n) = Tha(nT), (2.68) are mapped into the designed analog filter frequencies. Figure
2.21(B) shows how the frequency response is affected by the
where ha(n) is the digital filter impulse response and ha(t) is bilinear transformation frequency mapping.
the analog filter impulse response with desired specifications. The prewarped specifications of the low-pass analog filter
The above equation implies: prototype are given by:
2 Digital Filters 855

2 H(s) - G - , sl (2.75)
2~a f_o aN-isi"
lOs
When the bilinear transformation in equation 2.70 is applied
1 to the transfer function shown above, the resulting transfer
function in the z-domain is shown below:

H ( z ) -- ~ m O bN-lZl
(2.76)
0.5 1.0 ZT o aN_jzi
2o)
IO s
It can be shown (Psenicka et al., 2002) that it is possible to
(A) Analog and Digital Frequencies create a transformation that maps the coefficients hi into ai
and bl into bl as shown below.

a = PN x a. (2.77)
b = PN x b. (2.78)
i. i

. . . . It
- i i The a and b are vectors for the coefficients ai and bl defined by:
.11 *lo
[Ha(jlo) l ',,, :
a = [aN aN 1 aN 2... a0] T.
i i i (2.79)
IH(ello)l i

,':~,'
i i
b = [bN bN 1 bN-2...b0]V.

~lo
The vectors h and b contain, respectively, the coefficients hi
and bl as follows:
(B) Bilinear Transformation Effects

F I G U R E 2.21 Bilinear T r a n s f o r m a t i o n W a r p i n g Effects


ITI2 ... gt0[v]NlT (2.80)
2 o~pT (2.72)
eOap = ~ t a n 2
012] 1
2 o~rT
~Oar = ~ t a n 2 (2.73)
It can be shown that PN is a Pascal matrix with the following
properties:
We can apply prewarping to as many frequencies of interest as
desired. These frequencies are given by o~i for i = 1, 2 . . . . . n, • All elements in the first row must be ones.
such that the analog filter specifications are written as: • The elements of the last column can be computed by:

Pi, N+I = ( -- 1) i-1 N!


(N- i + 1 ) ! ( i - 1)!' (2.82)
2 tan~°iT for i = 1, 2 , . . . , n. (2.74)
(Dai = T 2
w h e r e i = 1,2 . . . . . N + I .
• The remaining elements can be calculated by:
Design Procedure
• Prewarp the prescribed frequency specifications eoi to Pi, j • Pi-l,j + Pi-l,j+l q- Pi, j+i, (2.83)
obtain ~Oaa. wherei=2,3 ..... N,N+landj=N,N-1 . . . . . 2, 1.
• Generate Ha(s), satisfying the specifications at the fre-
quencies oJa~. Example
• Generate Hd(s) by replacing s by 2 ( z - 1)/T(z + 1) at Design an elliptic filter satisfying the following specifications:
Ha(s). Ap = 0.02 dB, Ar = 32 dB, cop = 2Tr x 3400 rad/sec, eor =
2w x 4600 rad/sec, and O~s = 27 x 20, 000 rad/sec
2.10.2 Bilinear Transformation Solution
by Pascal Matrix According to equations 2.72 and 2.73, it is possible to calculate
Consider an analog transfer function H(s) shown below: o% and e%r as follows:
856 Marcio G. Siqueira and Paulo S.R. Diniz

t % = 8.8162 x lO-Srad/sec. 0.2188 + 0.1020z 1 + 0.3127z 2 + 0.3127z-3


H(z) = 10 -1 + 0 . 1 0 2 0 z - 4 + 0 . 2 1 8 8 z -5
t%~ = 5.9140 x lO-Srad/sec.
0.3372 - 0.7314z -1 + 0.9856z 2 _ 0.7350z 3'
+0.3406z 4 __ 0.0703z-5
An analog elliptic filter that meets the above specifications for
t % and e%, has the following transfer function: The magnitude response for the transfer function above is
shown in Figure 2.22.
6.8799 + 1.4569 X 10 2653 + 1.1041 x
× 10-654 10-1352
-1.5498 x 10-345+ 3.9597 x 10.-22
H(s) = 55 + 8.6175 x 10-5s4 + 8.6791 x 1 0 - 9 5 3 + 4.3333 x 10-1352 "
+1.6932 x 10-17s + 3.9597 x 10-22
2.11 Quantization in Digital Filters
In this case, the vectors h and b are as follows:
Quantization errors in digital filters can be classified as:

= [3.9597 x 10 -26, 1.5498 x 10 -42, 1.1041 x 10 -25, • Round-off errors derived from internal signals that are
1.4569 x 10 -42, 6.8799 x 10 -26, 0] T. quantized before or after more down additions;
• Deviations in the filter response due to finite word length
b = 10-2310.0040 0.0169 0.0433 0.0868 0.0862 0.1000] r representation o f multiplier coefficients; and
• Errors due to representation of the input signal with a set
and the matrix P5 is as written here: of discrete levels.

1 1 1 1 1 1 A general, digital filter structure with quantizers before delay


5 3 1 -1 -3 -5 elements can be represented as in Figure 2.23, with the quan-
10 2 -2 -2 2 10 tizers implementing rounding for the granular quantization
P5 = and saturation arithmetic for the overflow nonlinearity.
10 -2 -2 2 2 -10
5 -3 1 1 -3 5 The criterion to choose a digital filter structure for a given
1 -1 1 -1 1 -1 application entails evaluating known structures with respect to
the effects of finite word length arithmetic and choosing the
The resulting transfer function H(z) is as follows: most suitable one.

10 , , ,

"0
OJ

,%
-10

-20

-30

-40
1
-50

-60

-70

-80
0 10'00 20'00 30'00 4000 5000 60'00 70'00 80'00 90'00 10,000
Frequency [Hz]

FIGURE 2.22 Magnitude Response of the Designed Low-Pass Elliptic Digital Filter
2 Digital Filters 857

x(n) xj(n+ l) xi(n)


Z-1 Z-I

u(n) y(n)
Linear network

-" [ ~ X k + ' ( n + l !- - - - 7Z~ XN(n)


Z-1

FIGURE 2.23 DigitalFilter Including Quantizers at the Delay Inputs

2.11.1 C o e f f i c i e n t Q u a n t i z a t i o n The discussion here concentrates in the fixed-point implemen-


tation.
Approximations are known to generate digital filter coeffi-
A finite word length multiplier can be modeled in terms of
cients with high accuracy. After coefficient quantization, the
an ideal multiplier followed by a single noise source e(n) as
frequency response of the realized digital filter will deviate
shown in Figure 2.24.
from the ideal response and eventually fail to meet the pre-
For product quantization performed by rounding and for
scribed specifications. Because the sensitivity of the filter re-
signal levels throughout the filter much larger than the quant-
sponse to coefficient quantization varies with the structure,
ization step q = 2 b, it can be shown that the power spectral
the development of low-sensitivity digital filter realizations
density of the noise source ei(n) is given by:
has raised significant interest (Antoniou, 1993; Diniz et al.,
2002). q2 2-2b
A common procedure is to design the digital filter with Pe~(Z)- 1 2 - 1~- (2.86)
infinite coefficient word length satisfying tighter specifications
than required, to quantize the coefficients, and to check if the
In this case, el(n) represents a zero mean white noise process.
prescribed specifications are still met.
We can consider that in practice, el(n) and ek(n + I) are statis-
tically independent for any value of n or 1 (for i ~ k). As a
2.11.2 Quantization Noise result, the contributions of different noise sources can be taken
into consideration separately by using the principle of super-
In fixed-point arithmetic, a number with a modulus less than position.
one can be represented as follows: The power spectral density of the output noise, in a fixed-
point digital-filter implementation, is given by:
x = bob1 b 2 b 3 ... bb, (2.84)
K

where bo is the sign bit and where bl b2b3 . . . bb represent the Py(z) = ~Y2e ~ Gi(z)Gi(z-1) , (2.87)
modulus using a binary code. For digital filtering, the most i=1
widely used binary code is the two's complement representa-
tion, where for positive numbers b0 = 0 and for negative
numbers b0 = 1. The fractionary part of the number, called ei(n)
x2 here, is represented as:
x( n) o ,, , o y(n)
x if bo = O. (2.85)
x2 = 2 -[x] if bo = 1. FIGURE 2.24 Model for the Noise Generated after a Multiplication
858 Marcio G. Siqueira and Paulo S.R. Diniz

The constant X is usually calculated by using Lp norm of the


9 ~(~ Gi(~
P q transfer function from the filter input to the multiplier input
nj(z) Fi(z), depending on the known properties of the input signal.
The Lp norm of Fi(z) is defined as:
mi

IIF~(d')llp L2,rrj ° IF~(~°~)lPd~oI , (2.89)


X
x(n) : ' =~F'X"~ , = y(n)
for eachp _> 1, such that f2~ iFi(do~)]Pdo~ <_ oo. In general, the
following inequality is valid:

FIGURE 2.25 Digital Filter Including Scaling and Noise Transfer


Functions. Ixi(n)[ ~ IIF~llpllXllq, ,t,(1-4-1=q1), (2.90)

for p, q = 1, 2 and oo.


where Pe,(ejw) = O'2e, for all i, and each G/(z) is a transfer The scaling guarantees that the magnitudes of multiplier
function from multiplier output (gi(n)) to the output of inputs are bounded by a number Mmax when Ix(n)[ _< Mmax.
the filter as shown in Figure 2.25. The word length, including Then, to ensure that all multiplier inputs are bounded by Mmax
sign, is b -4- 1 bits, and K is the number of multipliers of the we must choose X as follows:
filter.
1

2.11.3 Overflow Limit Cycles


x. = Max{llVlll p..... IIF~IIp..... IIFKIIp}' (2.91)

Overflow nonlinearities influence the most significant bits of which means that:
the signal and cause severe distortion. An overflow can give
rise to self-sustained, high-amplitude oscillations known as IlFf(d~)llp < 1, forllX(~a~°)ll q < Mmax, (2.92)
overflow limit cycles. Digital filters, which are free of zero-
input limit cycles, are also free of overflow oscillations if the The K is the number of multipliers in the filter.
overflow nonlinearities are implemented with saturation arith- The norm p is usually chosen to be infinity or 2. The L~
metic, that is, by replacing the number in overflow by a norm is used for input signals that have some dominating
number with the same sign and with maximum magnitude frequency component, whereas the L2 norm is more suitable
that fits the available wordlength. for a random input signal. Scaling coefficients can be imple-
When there is an input signal applied to a digital filter, mented by simple shift operations provided they satisfy the
overflow might occur. As a result, input signal scaling is re- overflow constraints.
quired to reduce the probability of overflow to an acceptable In case of modular realizations, such as cascade or parallel
level. Ideally, signal scaling should be applied to ensure that the realizations of digital filters, optimum scaling is accomplished
probability of overflow is the same at each internal node of the by applying one scaling multiplier per section.
digital filter. This way, the signal-to-noise ratio is maximized in As an illustration, we present the equation to compute the
fixed-point implementations. scaling factor for the cascade realization with direct-form
In two's complement arithmetic, the addition of more than second-order sections:
two numbers will be correct independently of the order in
1
which they are added even if overflow occurs in a partial
summation as long as the overall sum is within the available xi = II I1~{ Hj(z)Fi(z)tl~ (2.93)
range to represent the numbers. As a result, a simplified scaling
technique can be used where only the multiplier inputs require where:
scaling. To perform scaling, a multiplier is used at the input of
1
the filter section as illustrated in Figure 2.25. z
Fi(Z) Z2 ÷ mliz ÷ m2i
It is possible to show that the signal at the multiplier input is
given by: The noise power spectral density is computed as:

Xi(n) = 2~j~c Xi(z)zn-ldz • ~


1 J0f2~,Vi(eJt°)X(eJ~)eJ~°nd°)' (2.88)
2 3+ 3 HHi(z)H~(z_l)+5~-~ z~ H~(z)H;(z-I) ,
P y ( Z ) = O"e ~11 i=1 j=2 )kj

where c is the convergence region common to Fi(z) and X(z). (2.94)


2 Digital Hlters 859

whereas the output noise variance is given by: 2.12 Real-Time Implementation
of Digital Filters
2 2 [ 3+
3 1 2II I Si(d~°)l[22+5 ~-~ csll
1 /H_~
j Si(eJ~)ll
"22]
0"° = O'e ~11 i=1 j=2 )kj There are many distinct means to implement a digital filter.
The detailed description of these implementation methods is
(2.95)
beyond the scope of this chapter. The interested reader can
refer to Wanhammar (1990) and Diniz (2002) and the refer-
As a design rule, the pairing of poles and zeros is performed
as explained here: poles closer to the unit circle pair with closer ences therein.
zeros to themselves, such that IIHi(z) llp is minimized for p = 2 The most straightforward way to implement digital filters
o r p ~-- oo.
relies on general purpose computers by programming their
For ordering, we define the following: central processing units (CPUs) to execute the operations
related to a particular digital filter structure. This type of
implementation is very flexible because it consists of writing
p~_ [IHi(z)ll~ (2.96) software, allowing fast prototyping and testing. This solution,
IIHi(z)ll2 however, might not be acceptable in applications requiring
high-processing speed, fast data input/output interfaces, or
For L2 scaling, we order the section such that Pi is decreasing.
large-scale production.
For L~ scaling, Pi should be increasing.
Efficient software implementations of digital filters are
usually based on special-purpose CPUs known as Digital
2.11.4 GranularityLimit Cycles Signal Processors (DSPs). These processors are capable of
implementing a sum of product operations, also referred to
The quantization noise signals become highly correlated from
as multiply-and-accumulate (MAC) operations, in a very effi-
sample to sample and from source to source when signal levels
cient manner.
in a digital filter become constant or very low, at least for short
Another implementation alternative is to employ program-
periods of time. This correlation can cause autonomous oscil-
mable logic devices (PLD) that include a large number of logic
lations called granularity limit cycles.
functions on a single chip. An advanced version of PLD is the
In recursive digital filters implemented with rounding, mag-
field-programmable gate array (FPGA). An FPGA is an array of
nitude truncation, 4 and other types of quantization, limit-
logic macro-cells that are interconnected through a number of
cycles oscillations might occur.
communication channels configured in horizontal and vertical
In many applications, the presence of limit cycles can be
directions. The FPGAs allow the system designer to configure
harmful. Therefore, it is desirable to eliminate limit cycles or to
very complex digital logic that can implement digital signal
keep their amplitude bounds low.
processing tasks at low cost with reduced power consumption.
If magnitude truncation is used to quantize particular
Usually, high-level software tools are available for the design of
signals in some filter structures, it can be shown that it
digital systems using FPGAs.
is possible to eliminate zero-input limit cycles. As a conse-
Special purpose hardware is also possible for implementing
quence, these digital filters are free of overflow limit cycles
a digital filter. Hardware implementations consist of designing
when overflow nonlinearities, such as saturation arithmetic,
and possibly integrating a digital circuit with logical gates to
are used.
perform the basic operating blocks inherent to any digital filter
In general, the referred methodology can be applied to the
structure, namely multiplications, additions, and storage
following class of structures:
elements. Multiplications and additions can be implemented
• State-space structures: Cascade and parallel realization of using bit-serial or bit-parallel architectures. In general, hard-
second-order state-space structures includes design con- ware implementations of digital filters are less flexible than
straints to control nonlinear oscillations (Diniz and Anto- software (CPU-based) implementations. Special purpose hard-
niou, 1986). ware, however, is usually necessary when high cost of develop-
• Wave digital filters: These filters emulate doubly termin- ment is offset by a large production and a DSP-based solution
ated lossless filters and have inherent stability under is too expensive or is incapable of meeting sampling frequency
linear conditions as well as in the nonlinear case where specifications.
the signals are subjected to quantization (Fettweis, 1986). Consider a heuristic related to the computational complex-
• Lattice realization: Modular structures allowing easy limit ity of digital filters in a full custom design (Dempster, 1995).
cycles elimination (Gray and Markel, 1975). Figure 2.26 shows an intuitive plot of complexity as a function
of filter order for all digital filter implementations meant to
4 Truncation here refers to the magnitude of the number is reduced, which satisfy a given set of specifications. The complexity of a digital
leads to the decrease of its energy. filter is measured in terms of number of bits used in the
860 Marcio G. Siqueira and Paulo S.R. Diniz

Complexity These filters are very important building blocks for signal
processing systems implemented in discrete-time domain. In
particular, the widely available digital technology allows the
implementation of very fast and sophisticated filters in a cheap

!
J ~ t i n g spec / and reliable manner. As a result, the digital tilers are found in
j will be in this region J
numerous commercial products such as audio systems, bio-
medical equipment, digital radio, and TV just to mention a few.

References
Antoniou, A. (1993). Digital filters: Analysis, design, and applications.
(2d ed). New York: McGraw-Hill.
Min. ............... Slopeis minimum Dempster, A. ( 1995). Digital filter design for low-complexity implemen-
cost .......... feasible tation. Ph.D. Thesis. University of Cambridge, Cambridge, UK.
.......!'"' word length
Diniz, P.S.R. (2002). Adaptive filtering: Algorithms and practical imple-
m mentation. (2d Ed.). Boston, MA: Kluwer Academic.
NO N1 Order Diniz, P.S.R., and Antoniou, A. (1986). More economical state-space
digital filter structures which are free of constant-input limit cycles.
FIGURE 2.26 Complexity of a Digital Filter IEEE Transactions on Acoustic Speech Signal Processing ASSP-34,
807-815.
Diniz, ES.R., da Silva, E.A.B., and Netto, S.L. (2002). Digital signal
coefficients and number of multiplier operations, s For a pre- processing: System analysis and design. Cambridge, UK: Cambridge
scribed set of frequency specifications and a particular filter University.
structure, a certain order No may be capable of meeting the Diniz, P.S.R., and Netto, S.L. (1999). On WLS-Chebyshev FIR digital
specifications with infinite precision. For filters with an order filters. Journal of Circuits, Systems, and Computers 9, 155-168.
lower than No, it is not possible to meet the prescribed specifi- Fettweis, A. (1986). Wave digital filters: Theory and practice. Proceed-
cations. Infinite precision is translated as very high complexity ings of the 1EEE 74, 270-327.
because an infinite number of bits is required. If higher order is Gray, A.H. Jr., and Markel, J.D. (1975). A normalized digital filter
structure. IEEE Transactions on Acoustic Speech Signal Processing
used, the number of bits necessary for multiplier coefficients
ASSP-23, 268-277.
may be reduced, implying lower complexity. An order N1 in
Jackson, L.B. (1996). Digital filters and signal processing. (3rd ed.).
Figure 2.26 is the order of the implementation with the lowest Boston, MA: Kluwer Academic.
possible complexity. Orders higher than N1 will necessarily Lim, Y.C., Lee, J.H., Chen, C.K., and Yang, R.H. (1992). A weight
imply higher complexity. The heuristic introduced here, least-squares algorithm for quasi-equiripple FIR and IIR digital
when applied to the case of FIR filter designs using direct- filter design. IEEE Transactions on Signal Processing 40, 551-558.
form realizations, leads to complexity curves that are very flat Mitra, S.K., (2001). Digital signal processing: A computer-based
around their m i n i m u m point, indicating that almost min- approach. (2d ed). New York: McGraw-Hill.
i m u m complexity can be achieved for a wide range of values Oppenheim, A.V., and Schafer, R.W. (1989). Schafer, Discrete-time
for the filter order. On the other hand, for IIR filters, the signal processing. Englewood Cliffs, NJ: Prentice Hall.
complexity curve is rather sharp, implying that a more careful P~eni~ka, B., Garcia-Ugalde, E, and Herrera-Camacho, A. (2002).
The bilinear Z transform by Pascal matrix and its application in
choice for the filter order should be made.
the design of digital filters. IEEE Signal Processing Letters 9,
368-370.
Sar~imaki, T. (1992). Finite-impulse response filter design. In S.K.
2.13 Conclusion Mitra and J.E Kaiser, (Eds.) Handbook of digital signal processing.
New York: John Wiley & Sons.
In this chapter the main steps for the design and implementa- Wanhamman, L. (1999). DSP integrated circuits. New York: Academic
tion of linear and time-invariant digital filters are introduced. Press.

s For fixed-point implementation, computational complexity is mainly deter-


mined by the number of adders used in the implementation of multipliers.