Introduction To Digital Signal Processing
Introduction To Digital Signal Processing
INTRODUCTION
TO DIGITAL
SIGNAL PROCESSING
RomanKuc
Department of Electrical Engineering
Yate University
SSP BS Publications
4-4-309, Giriraj Lane, Sultan Bazar,
Hyderabad - 500 095 - AP.
Phone: 040-23445677,23445688
e-mail: ci.: . [email protected]
www.bspublications.net
Reprint 2008
All rights reserved.
Published by :
SSP BS
=
__
Publications
e-mail: [email protected]
www.bspublications.net
Printed at
Adithya Art Printers
Ilyderabad
ISBN
81-7800-168-3
PREFACE
This book is intended to be used in the first course covering digital signal
processing and filter design, typically offered at the senior or first-year
graduate level in electrical engineering. The course is also appropriate for a
graduate course in departments other than electrical engineering, such as
geophysics and mechanical engineering, in which the analysis of discrete"time
data is performed. It is assumed that the student has had a course covering
Fourier series and LaPlace transforms on the level of the first linear circuits or
control systems course. This text also includes projects that require students to
write computer programs to accomplish signal processing projects. The student
should bO'familiar with some programming language 'such as FORTRAN,
BASIC, PASCAL, or C.
This book approaches digital signal processing and filter design in a novel
way, by presenting the relevant theory and then having the student apply it by
implementing signal processing routines on a computer. This mixture of theory
and application has worked successfully for the past six years' in teaching this
course at Yale University. With this approach, the students receive a deeper
and intuitive understanding of the theory, its applications and its limitations.
The text can accommodate a wide variety of courses. Currently, the
course on digital filters at the undergraduate level are taught primarily as a
theory course, with homework problems and exams to determine the course
grade. This book can be used directly in this type of course. However, the
course becomes much more interesting and enjoyable when students apply the
theory to write programs to perform signal processing tasks. Each chapter
describes programming techniques that implement the theory and includes
projects that illustrate different applicatio'!l:>. Digital filter routines are written
from the very beginning of the course, immediately after the time-domain
description of discrete-time systems is presented in Chapter 2. The programs
can be written on any computer from personal to mainframe, requiring only a
standard terminal for displaying the results in graphical form and a printer for
v
vi
PREFACE
generating the hard copy. The programs to be written by the student are not
difficult. Each routine performs only one primitive task in the signal processing
procedure. For example, the discrete Fourier transform subprogram can be
accomplished in only nine lines of code. But once the student has given
sufficient thought to the problem to write these nine lines, the magic associated
with this procedure disappears, being replaced by understanding. To minimize
the programming effort of the student, the routines are used as building blocks
in later projects. Constructing more sophisticated programs from these simpler
building blocks aids the student in conceptualizing projects later in the course.
By the end of the course, the student has a package of signal processing
programs that can be used for a variety of applications.
The graphic outputs for the projects are displayed on the terminal and on
a printer, being generated by programs provided in the Appendix. These plots,
although having crude resolution, are adequate for illustrating the ideas and
also have the advantage of not requiring special plotting hardware. Students
having higher-resolution terminal graphic capabilities have readily written their
own graphic routines using the programs in the Appendix as guides.
This text differs from others in the area of digital filters and signal
processing in the important respect that processing signals and designing filters
on a digital computer, using simple programs composed by the students, are
an integral part of the course. For this reason, more realistic problems can be
assigned and discussed than would be in a course without computers, for whichthese problems would be mathematically untenable or at least tedious. The
organization of the material presented in the text allows the student to start
writing meaningful filtering programs from the beginning of the course.
Projects included in the text illustrate both digital signal processing and digital
filter design concepts.
The book is organized in the following manner. Chapter 1 defines the
basic components of a digital filter and provides motivation by describing
several common applications of digital filters and signal processing. The
material in Chapters 2 through 5 covers the fundamentals of time, frequency,
and z-plane analysis. If some of this material has been introduced in previous
courses, the respective chapters can be treated as a review. Several common
structures that are employed to implement digital filters are described in
Chapter 6.
The synthesis of digital filters to meet a desired specification is presented
in Chapters 7 through 9. To compare the different filter design procedures, the
projects are structured to allow each student to be assigned a personal
specification to be satisfied. In Chapter 7, the digital filter design is accomplished by interactively and intuitively placing poles and zeros in the z plane.
This procedure serves three purposes. First, it develops an understanding of
the interaction of the singularities in generating a filter magnitude response or
system spectrum. Second, it provides an appreciation for the conventional
filter design procedures presented in Chapters 8 and 9. Finally, this intuitive
procedure indicates how to correct the locations of the poles and zeros
PREFACE
vii
viii
PREFACE
processing courses at the undergraduate and graduate levels. For a conventional undergraduate theory course in digital filters, the first nine chapters of
this book supply the necessary topics in discrete-time signals and systems. In
some universities, such a theory course is followed by a digital filter design
laboratory. The Projects in this book can be used as the exercises in such a
course. At the graduate level, a faster pace allows topics from all chapters to
be covered. Courses stressing the signal processing aspects should emphasize
the analytic methods and the discrete Fourier transform and de-emphasize IIR
filter design and quantization effects, while courses stressing filter implementation should stress the latter and reduce the emphasis on the former.
To allow adequate space for this treatment of this material, the analytic
techniques have been restricted to those that are absolutely necessary for
understanding the filter synthesis and signal processing procedures. Topics that
are normally covered in a senior/first-year graduate course on digital signal
processing, but that are not considered in this text, include the solution of the
difference equations with the one-sided z-transform, the numerical methods
for optimizing digital filter designs, and the area of multidimensional signal
processing. These topics are better treated in a second course in which the
students have the familiarity of the material contained in this book.
The author is indebted to the students at Yale University who have taken
this course and provided many useful comments regarding the topics and the
exercises in this book. Among these are Ata Arjomand, Billur Barshan, Leo
Costello. An;lOld Englander, Kannan Parthasarathy, Rob Roy, and David
Starer. The author would like to thank the following reviewers for their
comments and-suggestions, J. I. Aunon, Purdue University; Edward Delp,
Purdue University; Simon Haykin; McMaster University; M. Kaveh, University of Minnesota; and Paul Prucnal, Columbia University.
The author hopes that the instructors teaching digital signal processing as
a combination of theory and computer exercises, as described in this text, have
an enjoyable learning experience. This learning comes about from the
questions posed by the students, who inevitably find some novel approach or
interpretation to filter design on the computer. This has certainly been the case
every time the author has taught this course.
Roman Kuc
CONTENTS
Preface
1 Introduction
1-1
1-2
1-3
1-4
1-5
1-6
1-7
1-8
v
1
1
3
5
7
12
13
17
18
Introduction
Discrete-Time Sequences
Superposition Principle for Linear Systems
Unit-sample Response Sequence
Time-Invariant Systems
Stability Criterion for Discrete-time Systems
Causality Criterion for Discrete-time systems
Linear Constant-Coefficient Difference Equations
Suggested Programming Style
Writing a Digital Filter Program
Summary
Introduction
Definition of the Fourier Transform
Important Properties of the Fourier Transform
20
20
20
26
27
30
38
40
41
44
45
55
65
65
65
69
ix
CONTENTS
3-4
3-5
3-6
3-7
3-8
3-9
3-10
3-11
3-12
4
4-1
4-2
4-3
4-4
4-5
4-6
4-7
4-8
4-9
4-10
4-11
4-12
4-13
4-14
5 The z-transform
5-1
5-2
5-3
5-4
5-5
5-6
5-7
5-8
5-9
5-10
5-11
5-12
5-13
5-14
Introduction
The Definition of the z-transform
Properties of the z-transform
The System Function of a Digital Filter
Combining Filter Sections to Form More Complex Filters
Digital Filter Implementation from the System Function
The Complex z-plane
The Region of Convergence in the z-plane
Determining the Filter Coefficients from the Singularity
Locations
Geometric Evaluation of the z-transform in the z-plane
. Relationship Between the Fourier Transform and the
z-transform
The z-transform of Symmetric Sequences
The Inverse z-transform
Summary
72
80
82
84
92
94
96
105
110
118
118
119
121
128
130
132
133
135
136
142
146
148
150
150
157
157
158
160
162
164
167
169
i74
178
183
184
188
196
203
CONTENTS
Introduction
System Describing Equations
Filter Catagories
The Direct Form I and II Structures
Cascade Combination of Second-order Sections
Parallel Combination of Second-order Sections
Linear-phase FIR Filter Structures
Frequency-sampling Structure for the FIR Filter
Summary
Introduction
Interrelationships of Analytic Methods
Practical Magnitude Response Specifications
Log-magnitude Response Curves
Programs to Compute the Log-magnitude Response of Poles
and Zeros
Phase Response Considerations
Steps in Performing a Filter Design
Choice of Filter Type
Interactive Filter Design by Intuitive Pole/Zero
Placement
Writing an Interactive Design Program
Summary
Introduction
Analog Filter System Function and Frequency Response
Analog Lowpass Filter Design Techniques
Methods to Convert Analog Filters into Digital Filters
Frequency Transformations for Converting Lowpass Filters
into other Types
All-pass Filters for Phase Response Compensation
Summary
Introduction
Designing FIR Filters with the Windowing Method
The DFT Method for Approximating the Desired Unit-Sample
Response
Designing FIR Filters by Combining the DFT and Window
Methods
Designing FIR Filters with the Frequency-sampling Method
xi
208
208
209
209
210
214
218
220
221
227
230
230
231
236
238
239
243
246
246
247
256
258
262
262
263
263
280
295
310
312
318
318
319
341
348
361
xii
CONTENTS
9-6
9-7
10 Finite-precision Effects
10-1
10-2
10-3
10-4
10-5
10-6
10-7
10-8
Introduction
Finite-precision Number Representation within the Computer
Quantization Error in Analog-to-digital Conversion
Expressing Coefficients in Finite Precision
Performing Arithmetic in Finite-Precision Number Systems
Effects of Finite-Precision Arithmetic on Digital Filters
Programs to Simulate Quantization Effects
Summary
11 Inverse Filtering
11-1
11-2
11-3
11-4
11-5
11-6
11-7
11-8
11-9
Introduction
Applications of Inverse Filters
Minimum Phase Systems
Formulating the Problem for Applying an Inverse Filter
FIR Filter Approximations to the Inverse Filter
Discrete Hilbert Transform Relationship for Minimum-Phase
Systems
Designing Inverse Filters with the Discrete Hilbert Transform
The Effects of Noise on Inverse Filters
Summary
379
384
390
390
391
395
399
404
409
411
416
422
422
423
426
429
432
433
436
441
448
Appendix A
455
Appendix B
469
Index
471
CHAPTER
1
INTRODUCTION
In this chapter, we present the concept of a digital filter and define the adder,
multiplier and delay elements that are its components. Some typical applications of digital filters for signal processing, system simulation and spectral
analysis are described. An overview of the topics covered in the book
concludes the chapter.
1""____
. .I----o...,uIPul{y(n))sequence
DIGITAL
Input seQueo-nce
__
_
{*)} 0
FILTER
FIGURE I-I
A digital filter transforms the input
sequence {x(n)} into the output
sequence (y(n)}.
digital filters have been employed to reduce the redundancy in the speech
signal so as to allow more efficient transmission, and for speech recognition.
Input sequences can be generated in several ways, as shown in Fig. 1.2.
One common method is to sample a continuous-time signal at a set of
equally-spaced time intervals. If the continuous-time signal is denoted by
x(t), then the values of the discrete-time sequence are denoted as
x(nT.) = x(t)lt=nT,
(1.1)
(1.2)
CONTINUOUS-TIME SIGNAL
DISCRETE-TIME SEQUENCE
{x(nT.)}
fIII,
IMAGE
III I JlI ,.
DISCRETE-TIME SEQUENCE
{i(nD.)}
-+#-iIR-IllII--IJII--t-Scan line
....IUI.....rr.......
FIGURE 1-%
Deriving one-dimensional discrete-time sequences from analog signals.
nD.
nT.
INTRODUCTION
ADDER
---;-cp"
+ "'--_0
xl(n) ...
y(n)
=xl(n) + x2(n)
x2(n)-
MULTIPLIER
POSITIVE AND
NEGATIVE DELAYS
x(n)
K"'---__
----iV-
_0
y(n) = ax(n)
--.".B. .---o
8
x(n) ....
y(n) = x(n-I)
y(n) = x(n+ I)
nGURE 1-3
Elements that are interconnected to implement a digital filter.
used to look ahead to the next value in the sequence, and is indicated by a box
y(n) = ix(n
As shown in Fig. 1.4, the current output y(n) is equal to the average of the next,
current, and previous input values. The advance serves to access the next value of
the sequence, while the delay stores the previous value.
Any past or future input data values can be accessed by including the
appropriate number of delay or advance elements. Data values can be
combined, however, only through an ad~er.
INTRODUcnON
x(n)--+------..;-c
FIGURE 1....
Nonrecursive digital filter that acts as a three-sample averager.
The term order will be used to denote the minimum number of delays
and advances that are necessary to implement a digital filter. For example, the
3-sample averager is a second-order filter. When the filter output is a function
of only the input sequence, as in the 3-sample averager, it is called a
nonrecursive filter. When the output is also a function of the previous output
values, it is called a recursive filter. Example 1.2 illustrates a recursive filter.
Example 1.2. First-order recursive filter. Consider the relationship between the
input and output sequence values given by
y(n) = ay(n -1)
+ x(n)
where a is a constant. As shown in Fig. 1.5, the current value of the output is
equal to the sum of the input and a times the value of the previo,lls output. Since
only one delay is necessary, this is a first-order filter.
"')If-::-(--a--$~Z_I--
'----l,\r--<<J
FIGURE 15
A first-order recursive digital filter.
(;
(x(n)} =
{COS
(wn)}
".
"
nGURE 1-6
The cosine sequence {cos(wn)} for w = :tr/l2.
. DISCRETE-TIME SEQUENCES
MAGNITIJDE SPECrRA
~--~-----:!:~w
(X2(n))
... 1'
I II I I I I
JI
1...
)n
oL _ _ _
---L~
_ _~.;. W
I
nGURE 17
Discrete-time sequences and their magnitude spectra. The sequence {x)(n)} = {x\(n)} + {x2(n)}.
7
consider the discrete-time sinusoidal sequence {x(n)} shown in Fig. 1.6, and
given by
INTRODUcrlON
{x(n)}
= {cos(wn)}
(1.3)
1.9, which represent samples taken from two speech signals. The first is the lal
sound, as in "father", and the second is the IiI sound, as in "see". These two
periodic signals are most easily differentiated by computing the magnitude
spectrum of one period. We note that the two spectra, IX1(eiw)1 and IX2(e IW)I,
consist of peaks that correspond to the resonances of the vocal tract shape that
{X3(n) }
.,1"1,, III
...
1...
IHuo(ei"') I
{X3(n)}~---J
LOWPASS
L{yu.(n)}
I . . ._FI_I:_:rE_R_-,1 =
{x.(n)}
'I
FILTER
r--
{x~n)}
I..
F:GURE 1-8
Recovering sequences by filtering. The sequence {Xt(n)} is recovered from {x3(n)} by lowpass
filtering. and {x2(n)} is recovered by bighpass filtering.
was used to generate the sound. In speech recognition systems, various speeCh
sounds can be differentiated on the basis of the frequency locations of these
peaks.
COMPUTER SIMULATION OF A PHYSICAL SYSTEM. When the physical
system, such as a robot, is very complicated or expensive to build, often it is
first simulated on a digital computer in its digital filter form. This simulation is
employed to determine the performance and the sensitivities of the analog
INTRODUcnON
(X.(II)}
-~~O------------------------------~nro
Pvr\A,,,.
(X,(II)}
~~O------------------------------~nro
1'
FIGURE
Speech signals and their spectra. The sequence {x1(n)} consists of 512 samples of the speech sound
lal and {x2(n)} of IiI. The sample values are connected by straight lines. The corresponding
spectra IX1(ejO1 and IX2(ei"')I, given in logarithmic units of dB, exhibit peaks that can be used to
differentiate these sounds.
10
INTRODUCTION
(a)
11
--"0"---,
r--"O"
"t"----i>I1IE-E
x(t)
~----~-----+--~--~-+--~----~-----,time
(b)
ftGURE 1-10
Frequency-shift keying (FSK) signals. a) Example of continuous-time signal from actual system. b)
Simuated sequence produced by computer.
{e(D)} = {
8(D)~
{e(n)}
___ ...r_.:::_..... Ili n)}
I
-----~:--;..-
= (y(n)}
{lin)}
!!
ftGURE 1-11
Simulating a robot a'lll by applying an excitation sequence and computmg the response sequenct'
expected if the model is accurate. The value of this simulation model is that
the coefficient values of the digital filter can be adjusted to produce the desired
response. Then the final values can be employed to determine the physical
dimensions of the robot arm.
INTRODUCTION
13
ANALOG FILTER
x(t)
-"'I)
DIGITAL FILTER
ftGURE lU
Replacing an analog filter with a digital filter requires the additional operations of an
analog-ta-digital conversion (ADC) and a digital-to-analog conversion (DAC).
frequencies, analog filters still have the advantage. But with decreasing cost
and increasing speed of digital circuits, more and more analog filters are being
replaced with their digital counterparts.
14
frequency behavior of digital filters, the goal is then to design and implement a
digital filter to perform a desired task. The synthesis procedure involves
combining the digital filter elements and specifying the values of the multiplier
coefficients to satisfy a desired specification.
Most often, the transformation that is to be performed by the digital filter
is specified in terms of the magnitude response IH(eiw)l. The magnitude
response for an ideallowpass filter, for which the frequency components in the
input sequence from zero to some cutoff frequency Wc are passed through the
filter unaffected, while all th~ others are completely eliminated from the output
sequence, is shown in Fig. 1.13(a). This ideal cannot be achieved in practice,
but must be approximated. A practical specification that can be satisfied by a
digital filter is shown in Fig. 1.13(b). This desired specification allows slight
deviations from the ideal response: E in the passband, () in the stopband, and a
nonzero frequency interval for the transition between the passband and
stopband. A successful digital filter design produces a magnitude response that
falls within the allowed regions.
We will consider two different digital filter types to satisfy a given
INTRODUCTION
I<
PASS BAND
0
(b)
=-jE
STOPBAND
w,
;.
15
IHdc>"cd(eJ"')1
Successful design
1-
I
I
I
I
I
I
-----------1-----------~.~~--~~--~
OL-------~--------~~~=--=~~
I<
PASS BAND
~IE
wp
TRANSITION
RANGE
STOP BAND
~I W
Ws
FlGURE 1-13
Magnitude response curves for a digital low pass filter. (a) Ideal low pass rlter response. (b)
Practical low pass filter specification allows derivations from the ideal response. A successful
digital filter has a magnitude response that falls within the allowed regions.
specification: infinite impulse response (IIR) filters and finite impulse response
(FIR) filters. IIR digital filters are usually designed by extending classical
analog filter design procedures. An I1R filter design is typically accomplished
in three steps. First, an analog lowpass filter is designed to meet the desired
passband specification. The most commonly employed are the Butterworth,
Chebyshev and elliptic analog lowpass filter design procedures. Second, an
analog-to-digital filter transformation is employed to obtain a digital lowpass
filter. The impulse-invariance method and the bilinear z-transform method are
described for transferring these analog designs into their digital counterparts.
In the final step, a frequency transformation is employed to obtain a highpass,
bandpass or bandreject filter.
/
The design procedures for FIR filters have been develope~SpeciallY for
16
digital filters and do not have analog filter counterparts. Two FIR filter
structures will be investigated. The first involves implementing the desired
filter unit-sample response in a tapped-delay line structure. Since the desired
response often has an infinite number of nonzero elements, a finite-duration
window must be applied to eliminate all but a finite number of these elements.
We investigate the effect of this truncation on the resulting filter's transfer
function. The second structure is the frequency-sampling structure, which
employs a comb-filter followed by a bank of resonators and implements the
filter by specifying the magnitude response at a finite number of frequency
points. A comparison of the two design procedures is performed to determine
under which conditions one is more efficient than the other.
FAST FOURIER TRANSFORM (FFf). In addition to digital filters, we also
explore the use of the fast Fourier transform (FFT) algorithm for processing
data and performing spectral analysis. The FFT is an elegant and efficient
method for computing the discrete Fourier transform that allows the filtering
operation to be performed in the frequency domain. We present both an
intuitive description of the FFT, as well as a more rigorous mathematical one,
to indicate how this efficiency is achieved. The utility of employing the FFT for
filtering applications is described and compared with the methods of direct
digital filter implementation.
FINITE-ACCURACY EFFECTS. An important concern for implementing practical digital filters involves finite-accuracy effects caused by the limited
precision to which the sequence and coefficients values are represented within
the computer. Similar errors are also introduced in the numerical round-off
routinely performed in tedious hand calculations. In the analysis and synthesis
discussions above, we dealt with the ideal, or infinite-precision, case. To
process data on a computer, the data values must first be quantized to a finite
number of bits, usually equal to or smaller than the word size on the computer.
The effects of this quantization error will be investigated. The coefficients used
in the digital filter multipliers must also be quantized. The slight change in
these coefficient values modifies the frequency response of the filter. A third
source of error occurs when several numbers are added or multiplied and the
result excee'ds the limits of the computer. In this case, the result must be scaled
and truncated, introducing still another source of error that can produce
unwanted oscillations at the output of some IIR filters. We consider analytic
methods of characterizing these three common quantization problems.
INVERSE FILTERS. In the final chapter, we discuss the interesting and
important topic in signal processing called inverse filtering. This topic integrates many of the digital signal processing concepts presented in the previous
chapters to solve the problem of removing distortions from observed signals
that are introduced by measuring instruments or by physical transmission
media. It is hoped that this topic whets the student's appetite for pursuing
further study in this most interesting area of research and development.
JNTRODUcnON
17
18
1.8 SUMMARY
In this chapter, we have provided the motivation for digital filtering, defined
the components of a digital filter, and indicated some common applications.
An overview of the course material has described the inter-relationship of the
topics that describe the theory and application of digital filters to signal
processing.
FURmER READING
IEEE Acoustics, Speech and Signal Processing Magazine. This bimonthly magazine of the
Acoustics, Speech and Signal Processing Society of the Institute of Electronics and Electrical
Engineers (IEEE) provides tutorial articles on various topics covering digital signal processing
and digital filters.
IEEE Transactions on Acoustics, Speech and Signal Prl?cessing. This bimonthly journal publishes
articles describing the most recent results in the development and implementation of digital
filters and digital signal processing techniques.
Rabiner, L..R. and C. M. Rader (eds.): Digital Signal Processing, IEEE Press, 1972; and Digital
Signal Processing ll, IEEE Press, 1975. [These books contain reprints from various journals
that provide an organized and historical treatment of digital filter theory and applications.]
REFERENCES TO TOPICS
Pascal
Cooper, Doug, and Michael Clancey: Oh! Pascal!, W. W. Norton, 1982.
Jensen, Kathleen, and Niklaus Wirth: Pascal User Manual and Report, Springer-Verlag, Berlin,
1985.
Mallozzi, John, and Nicholas De Lillo: Computability with Pascal, Prentice-Hall, Englewood
Cliffs, NJ, 1984.
C language
Harbison, Samuel, and Guy Steele Jr.: C, A Reference Manual, Prentice-Hall, Englewood Cliffs,
NJ,1984.
FORTRAN
Didday, Richard, and Rex Page: FORTRAN for Humans, West, 1981.
McCracken, Daniel: FORTRAN, Wiley, New York, 1967.
BASIC
INTROOycnON
19
Comptder (OIIUIIlUIicatioas
Schwartz, Mischa: Telecommunication Networks, Addison-Wesley, Reading, Mass. 1987.
Tanenbaum, Andrew: Computer Networks, Prentice-Hall, Englewood Cliffs, NJ, 1981.
Lathi, B. P.: Modem Digital and Analog Communication Systems, Holt, New York, 1983.
RoIIot
_aIadoa
CHAPTER
2
DISCRETE-TIME
DESCRIPTION
OF SIGNALS
AND SYSTEMS
,r
2.1 INfRODUcnON
2.2
DISCRETE~TIME
SEQUENCES
21
d n = { 1 for n = 0
()
0 otherwise
(2.1)
This sequence is shown in Fig. 2.1 and will play an important role as the input
sequence to a digital filter. Since the unit-sample sequence contains only one
nonzero element, the form of the output sequence then directly indicates the
effect produced by the digital filter.
The delayed unit-sample sequence, denoted by {d(n - k)}, has its
nonzero element at sample time k:
d(n - k)
= {~
for n = k
otherwise
(2.2)
x(k)= ~ d(n-k)x(n)
(2.3)
n=-OCI
as shown in Fig. 2.2. This follows because d(n - k) is nonzero only when its
argument is zero, or when n = k. When multiplying the two sequences together
term by term, only the single element x(k) remains nonzero and the sum
evaluates to x(k). Hence, the unit-sample sequence can be used to select, or
sift, a single. element from the entire sequence. This sifting property will be
important below in the derivation of the convolution relationship between the
digital filter input and output sequences. A more convenient, but equivalent,
form of Eq. (2.3) that is used below employs the time-reversed version of the
{d(n)}
... r. ..
FIGURE 2-1
Unit-sample sequence.
22
(x(n)}
... 111111!]11
I
...
k ... -I 0 1 2
:>
(d(n-k)}
.c.
k
:>
n
(u(n)}
... ...IIIIIII
o
FIGURE 2-2
Sifting property of the unit-sample sequence.
FIGURE 2-3
Unit-step sequence.
= k:
00
x(k)=
d(k-n)x(n)
(2.4)
n=-CIO
u(n) = {~
forn~O
otherwise
(2_5)
and is shown in Fig. 2.3. The unit-step sequence is used for defining the
starting point of a sequence in analytic expressions. For example, the sequence
an
for n ~O
(2.6)
x(n) = {
otherwise
0,'
(2.7)
(cos(wn)}
"'1.
1II
w=.~
. iiI.
-I 0 1
(sin(wn)}
1I
23
....
21 II
(o)=~
...
tIllllt
10
III1
-2- l o
1 2
FIGURE l-4
Two discrete-time sinusoidal sequences.
= Wo + 2m:re
(2.8)
= {cos(won)}
(2.9)
This last result follows because the cosine function is periodic with period 2:re
and the argument is won plus an integral number ( =tnn) of 2:re. In Fig. 2.5,
this effect is shown for COo = 0.1:tr and COl = 2.1:re. This result is also true for the
sine sequence.
COMPLEX EXPONENTIAL SEQUENCE. Before we consider the complex
exponential sequence, we will establish the notation for complex numbers and
the complex plane used throughout this book. Let c be a complex number.
Then it can be written as
c =a + jb
(2.10)
where a is the real part, b is the imaginary part, and j = (_1)112. The
representation of c on the complex plane is shown in Fig. 2.6. An alternate
form of a complex number is the complex vector notation:
c = lei ei Arg[c)
where
(2.11)
24
...
{cos (2.IIT)}
FIGURE 25
Two analog signals having different frequencies can proouce the same values for a discrete-time
sinusoidal seque\lce.
defined by the angle with respect to the real axis in the complex plane. The
following geometric relationships can be derived from Fig. 2.6:
and
Icl 2 = a2 + b2
(2.12)
Arg[c] = arctan[bla].
(2.13)
-------~---'L-.----I:--~
Real
FIGURE 2-6
The complex plane.
2S
Imaginary
c=elNf'I
------4<--"---'--_ Real
Imaginary
-----~-+---_:_.."..__:_~
Real
Imaginary
2)sin(wn)
-e-"'"
eJ"'"
____--l..-______
Real
F1GURE 27
Interpretation of the Euler identities in the
complex plane.
relationships shown in Fig. 2.7, which are known as the Euler identities. These
are given by
ei",n = cos( ron) + j sin( ron)
(2.15)
ei",n + e-i",n
(2.16)
cos(ron) =
2
sin(ron) =
ei",n - e-i",n
2j
(2.17)
26
since ej2mn = 1, when m is any integer. This identity can also be demonstrated
in the complex plane. Increasing the phase of a complex number by a is
equivalent to rotating the complex vector by angle a, counter-clockwise if
a> 0 and clockwise if a < O. If a = 2m:r, where m is any integer, then the
complex vector makes m complete revolutions about the origin and returns to
its original orientation.
= aG{xI(n)} + (3G{x2(n)}
= a{YI(n)}
+ (3{Y2(n)}
(2.19)
+ (3{y2(n)}
27
This last equation is simply the sum of the two outputs that would have been
observed if only {crxt(n)} or {,8x2(n)} had been applied. Hence, the 3-sample
averager is a linear system.
+ ,82x~(n) + 2a,8Xt(n)x2(n)
which is not equal to ~xi(n) + ,82x~(n), the output required for the system to be
linear. Hence, the square-law device is a nonlinear system.
k)X(k)}
= ... + x( -1) G{d(n + I)} + x(O) G{d(n)} + x(l) G{d(n -I)} + ...
00
= 2:
(2.21)
k=-oo
G{d(n - k)} is the output sequence produced by the system when the input is
a unit-sample sequence having fts nonzero element at n = k. This output is
called the unit-sample response, and is sufficiently important to merit its own
symbol:
G{d(n - k)}
= {h(n, k)}.
(2.22)
28
(..)}
If:
{.t(II)}
---1
~(y(.)}
LINEAR
SYSTEM
= {d(lI)}
I..
0
{Y(II)}
>
~
II
= {h(lI)}
.. IIIt ...
-I 0 I
II
Then:
{Y(II)}
{.t(II)}
~I
0 I
II
-I
.t(
)(d(lI+ I)}
-I
L~-I:
II
o
---.........l-Tl"""'
r-r......'""'...........;..~I .t(-l){h(lI+ I)}
+
.t(O){d(lI)}
+
.t(I){d(lI+ I)}
I.t!O~
0
II
T , >
o
.t(O){h(lI)}
II
... r.
oI
II
Ji'lGURE U
The input sequence to a \inear system can be viewed as the superposition in time of a set of scaled
unit-sample sequences. The output sequence is then the superposition of the scaled unit-sample
responses.
29
{h(n,O) }
.:111 ..
3 21 0 1 2 3
Forn=-I,
For n =0,
For n = 1,
For n=2,
FIGURE 2-9
Unitsample response
sample averager.
of nonrecursive three-
i.
For n>2, y(n) =0, since the nonzero value of {d(n)} has moved out of the
memory of this filter. Since {d(n)} is the input, the output is defined to be
{h(n, O)}. Hence
h(n, 0) =
{~,
for-I""n",,1
otherwlse
Unit-5lUllple
respoIIIe
for n 2:0
otherwise.
To find {h(n, O)}, we let {x(n)} = {d(n)} and apply the zero initial condition.
For n<O, y(n) =0, because d(n) is zero for n <0 and y(-I) =0.
For n = 0, y(O) = ay( -1) + d(O) = 1.
For n = 1, y(I) = ay(O) + d(I) = a.
For n = 2, y(2) = ay(I) + d(2) = a2
For n =k,.y(k) =ay(k -1) + d(k) = a".
Hence,
h(n, 0) =a"u(,n)
for all n
Some typical sequences are shown for different values of a in Fig. 2.10.
This concept of a unit-sample response can also be applied to timevarying systems, in which the multiplier coefficients vary with n, as illustrated
in the next example.
30
h(n,O)
II
for all n
.'.
0<.<1
..1111 J
o
= a"u(n)
t , " ";"
)0
-I <a<O
a<-l
FIGURE 2-10
Four possible unit-sample response sequences that can be produced by first-order recursive
filter.
{ o~IY(n-l)+x(n)
n+
forn""O
otherwise.
Applying the zero initial condition and using the same approach as in the
previous example, we have
h(O, 0) = (1)(0) + 1 = 1
h(I, 0) = 0>(1) + 0 = ~
h(2, 0) =
h(3, 0)
<no> = ~
= mm = -i4
-In, then
h(l, 1) = G)(O) + 1 = 1
h(2,I)=m(I)+O=i
h(3,I)=mm=fi
In
On.
31
y(n) =
(2.23)
x(k) h(n, k)
k=-oo
{yen - no)}
= G{x(n -
no)}
(2.24)
for all no
G{d(n - k)}
(2.25)
k)}
This equation implies that a shift in the time that the unit-sample sequence is
applied to the system results only in a corresponding time shift in its
unit-sample response, as shown in Fig. 2.11. A time-invariant digital filter can
easily be recognized, since its coefficient values do not vary with time.
{d(n))
.'I
0 1 2
.. 1.
o 1
.. IJ
o1
Tt
2
(h(n.k)} = {h(n-k)}
(h(n))
, , ";'
n
F1GURE 211
Shift-invariance properly of the unit-sample response for a time-invariant system.
32
y(n)=
x(k)h(n-k)
(2.26)
= {x(n)} * {hen)}
(2.27)
k=-cc
L
m=cc
=n -
(2.28)
x(n - m) hem)
= L
h(m)x(n - m)
(2.29)
m=-oo
The desired result is obtained when m is replaced by k. The limits of the first
sum in Eq. (2.29) appear in reverse order, but can be reordered without
consequence because the same terms appear in the evaluation of the sum.
The convolution operation is also distributive, i.e.
{hen)}
(2.30)
33
x(n) =
{~
for -1 sn s 1
otherwise
h(n) =
{~
for -1 Sn S 1
otherwise
and
* {x(n)}
x(n)={n+1,
0,
and
h(n) = a"u(n)
for all n
We will perform the convolutio.n in two ways. First, using Eq. (2.29), we have
~
y(n)=
2:
2:
aku(k)x(n-k)
for n -k =0,
for n -k = 1,
for n -k =2,
otherwise
ork=n
ork=n-1
ork =n-2
h(k)x(n-k)=
k=-ao
z(n
-k)-{~
34
{x(n)}
{h(n)}
..'I II. .
-3 -2 -1 0 1 2 3
.. 'I II...
-3 -2 -1
n=-1
n=-2
{x(k)}
{~~~~
(x(k)}
1II. ...
I 11. ... :
-4 -3 -2 -1
y(-2)=1
n=O
0 1 2 3
0 1 2 3 4 k
y(-I)=2
n=l
III
...
y(1)=2
y(0)=3
n=2
III .
III ..
(x(4)}
(h(2-k)}
-4 -3 -2 -1 0
(y(n)}.
I'l'I r
-4 -3 -2 -1 0
2 3 4 k
l'
y(2) ... 1
ftGURE loU
1bc CODvolution of two fiDite-duration sequences.
I' .
a.
1 2 3 4
3S
thIn)}
{x(n))
. rl I..
012
.... I
IIII I I
o1
II
{h(k)l
{x(n-k)}
.IJ
. . IIIIIII [
t"\N-C-
I I I
a:
s:
+I:
I ...
for n = 0
{x(n-k)l
'_00_ _. _
-2-1012
-\ 0 \ 2
for n = 1
for n = 2 ....
II I .
-10 1 2
{y(n)l
FIGURE 2-13
The convolution of a finite-duration sequence with an infinite-duration sequence.
y(n) = .t ~
x(k) h(n - k) = l-O
~ (k + l)a"-tu(n - k)
__ oo
2)
36
= r",
(2.31)
where r is a constant and Nl and N2 are any two numbers. In evaluating the
sum of products in the convolution, we commonly encounter sequences that
form such a series. The sum can then be easily computed by employing the
following two geometric sum formulas. To derive these formulas, let us
consider the following Taylor series expansion: Given a complex number c,
where Icl < 1, then
--=1+c+c2+c3 + ...
l-c
= ,,~
L c"
(2.32)
Applying this result in the reverse direction yields the infinite geometric sum
formula: Given a complex number c, where Icl < 1, then
L cit =1z
(2.33)
1- c
We can also compute the sum of a finite number of elements in a
geometric series. Let us consider the following sum
It-O
1+c+~+ +~-l=
N-l
,,0
C"
(2.34)
N-l
...
...
LC"=LC"-LC"
11==0
n-O
...
n-N
...
=Lc"-cNLc"
It-O
(2.35)
,,=0
Applying the infinite geometric sum formula to the two summations, we obtain
the desired finite geometric sum formula: Given a complex number c, then
N-l
l-cN
LC"=-It.O
1-c
(2.36)
While the infinite geometric sum formula requires that the magnitude of c
be strictly less than unity, the finite geometric sum is valid for any value of c.
EumpIe 2.8. Convolution of two lnfiIIite-dantion seqnences. Let
h(n) =a"u(n)
x(n) = b"u(n)
for all n,
for all n
. .] rl~
11
to . . . .
.... IIIII
)0
-I 0 1 2
bb
-I 0 1 2 3
. . ..'I rri
(.I(n-k)}
n=-1
It
iII: ..
JlIII1 r..
It
... 1JIII
-I 0
n=O
y(-I)=O
)0
It
y(O) = 1
)0
IlIlllH.
n=l
y(l)=a+b
)0
oI
n=2
)0
It
... I IIIII~H
1__ .
y(2)=a2+ab+b2
)0
012
It
y(n)
.I111I1I
)0
-10123
FIGURE Z-14
The convolution of two infinite-duration sequences.
as shown in Fig. 2.14. Then the output sequence values are equal to
y(n) =
L-
" akb"-k
aku(k)b"-ku(n - k) = L
k---
= b"
k-O
"
L (alb)"
k-O
r'
. ( )=b"I-(alb
n
t-(alb)
37
38
...
S=
L Ih(k)1
k=-CIO
(2.37)
k)1
(2.38)
Recall that the magnitude of the sum of terms is less than or equal to the sum
of the magnitudes. Hence,
ly(n)1 ~
'"
Ih(k)x(n - k)1
(2.39)
k=-oo
Finally, since all the input values are bounded, say by M, we have for all n:
ly(n)1 ~ M
'"
Ih(k)1
k=-oo
or
ly(n)I~MS
(2.40)
Hence, since both M and S are finite, the output is also bounded.
To show that it is necessary for S to be finite for the filter to be stable, we
present a counter-example. We need to finq a bounded input sequence that
39
'* 0
(2.41)
This sequence consists of plus and minus ones and is obviously bounded. Let
us now consider the output value for n = 0, or y(O). From the convolution
equation, we have
...
y(O) =
2:
...
h(k)x( -k) =
k--~
h2(k)/lh(k)1
k=-~
...
2:
(2.42)
Ih(k)I=S
k==-oc
. --
s= ~
Example 2.9 can be easily extended to show that any filter with a
unit-sample response having a finite number of nonzero elements is always
stable.
Eumple 1.10. Stability of first-onler reamive &her. Let
y(n)
Recall that h(n) =a"u(n), for all n. Checking for stability, we must calculate
s = ,,_-OD
~ Ih(n)1 = ~ lal"
11-0
It is obvious that S is unbounded for lal2: 1, since then each term in the series is
2:1. For lal < 1, we can aIfply the infinite geometric sum formula, to find
1
S=--
1-a
forlal<1
Since S is finite for lal < 1, the system is stable for lal < 1.
40
yeO) = 1
y(l)
=2r cos(wo) -
y(2) =
r cos(wo)
=r cos(wo)
00
Hence, the filter is stable for Irl < 1. The inequality of the sums in the
above stability calCUlation comes about because the magnitude of the cosine
function is less than or equal to unity.
for n <0
(2.43)
41
response of the first-order recursive filter in Example 2-4 obeys the condition
given in Eq. (2.43), it is a causal filter.
Np
(2.44)
k=-NF
In words, the current output y(n) is equal to the sum of past outputs, from
y(n -1) to y(n - M), which are scaled by the delay-dependent feedback
coefficients ak, plus the sum of future, present and past inputs, which are
scaled by delay-dependent feedforward coefficients bk The output value at
time n is determined by the input values from N F samples in the future
x(n +NF), through the current value x(n), to the sample N p time units in the
past x(n - Np ). For a causal filter NF sO. When NF> 0, then the future values
of the input determine the current output value, and the filter is noncausal.
EumpIe 2.12. Difference equation of a simple filter. We can combine the
equations of the nonrecursive 3-sample averager and the first-order recursive
filter, to get
y(n) = ay(n -1) + lx(n + 1) + lx(n) + lx(n -1)
This filter has both a recursive and a nonrecursive part and is also noncausal.
The difference equation is useful not only for analyzing digital filters but
can be employed for implementing them. A digital filter can be implemented
from the general difference equation by performing the following four steps, as
shown in Fig. 2.15.
Step 1. Two points are drawn, one corresponding to the current input
x(n) and the other corresponding to the current output y(n).
Step 2. To gain access to the past values of the input and output
sequ~nces, delay elements are connected to the output and input points.
Future values of the input sequence are obtained by connecting advances to
the input point.
Step 3. Multipliers are connected to the outputs of the delay elements to
produce the required products. Multipliers with gains of unity need not be
included, but replaced by a simple wire.
Step 4. Finally, the digital filter is accomplished by connecting the
outputs of the multipliers to two adders. The first generates the sum of
42
STEP I
x(n)_
y(n)'
STEP 2
..+N,)--+
x(n+2)~
,..---.. y(n)
x(n)---~
I
I
I
~
--..T~y(n-M}
STEP 3
y(n)
x(n)--+----i
ftGURE 2-15
Steps to produce a digital filter structure from the general difference equation. This filter structure
43
STEP 4
X(II)
_-.------1 >-..--,~
}-----_--oY(II)
products of the inputs and the feedforward coefficients, and the other that of
the outputs and the feedback coefficients.
The following example illustrates the application of these four steps.
_tal
X(II)_-.......----~
}------.---y(II)
FIGURE 2-16
Digital filter structure that implements the difference equation given by
y(n) = 2r cos(ClJo) yen -1)
_,2 yen -
44
x(n) o---+----i
.>--30(
J..------__-- y(n)
ftGURE 1-17
General digital filter structure implemented in the computer programs.
The general digital filter structure shown in Fig. 2.17 is convenient for
describing the logic behind the computer programs described below. However,
it is not the most efficient structure in terms of the number of delays that are
used. In a later chapter, we will consider other filter structures that have a
smaller number of delays but for which the corresponding computer programs
are more complicated. Conceptually, however, these more memory-efficient
programs perform the same types of operations as the simple programs
described below.
4S
SUBROUTINE NULL(X,NX)
DIMENSION X(NX)
DO 1 I=1,NX
X(I)=O.
RETURN
END
An array B(N), for 1:s N:s NB, can be zeroed in the main program with the
following statement:
CALL NULL(B,NB)
Two additional subroutines, described below, compute the sum of
products of two arrays and implement a shift register. Use of such simple
subroutines will simplify the main program by making it more readable, which
is important for debugging and trouble shooting. This programming style also
allows the student to reason in terms of these primitive tasks.
In trying to explain the programs in a manner that is not specific to a
particular programming language, a problem immediately arises with aI'tay
indexing. The various computer languages used for signal processing can be
divided into two classes: those that allow arrays to be indexed starting with
zero, such as BASIC and C, and those that do not, such as FORTRAN and
PASCAL. In the first set, x(O) is the first element of an array, in the second.
the first element is x(l). Since all languages can start indexing from 1, we will
use this convention in the programs below. For computer languages that allow
the array index to start from zero, a slight modification in the indexing of the
programs should be made. The advantage of starting the array with x(O) is that
it then conforms to the notation used for sequen~es in the analytic sections of
this book, i.e. x(n), for 0 :s n :s N - 1.
46
X(N), for 1 s; N s; NX, where NX is a known value. This array represents the
input data to be processed. In this book, the most common input will be the
unit-sample sequence. We are usually asked to design a digital filter that is
specified by an array of feedback coefficients ACOEF(N), for 1 s; N s; NA, to
be used in REC and an array of feedforward coefficients BCOEF(N), for
1 s; N s; NB, to be used in NONREC.
Since we are implementing nonrecursive and recursive filters separately,
it is helpful to define two output arrays. The output of a nonrecursive filter is
denoted by YN (N) and will have a duration NY = NX + NB - 1. This duration
follows from the convolution of two finite-duration sequences. The output
array of the recursive filter is denoted by YR(N) and has a duration NY. For
the recursive filter, however, the value of NY must be specified. Because of
the feedback loop, the output of an ideal recursive filter contains an infinite
number of non-zero elements. However, for a stable filter, the output values
eventually approach zero when the input has a finite duration. Hence, there
will be only a finite number of output elements whose amplitudes are
significantly greater than zero. For all the filters in this book, NY will be less
than or equal to 128.
Since most programming languages require that the size of all arrays be
specified at the beginning of the program, a length of 128 floating-point, or
Teal, elements for all arrays will be adequate for most of the projects in this
book. In the descriptions of the variables below, Teal is used to specify a
floating-point variable.
We first consider the implementation of a causal filter, for which NF=O
in Eq. (2.44), and then describe the simple modification that can be added to
implement a noncausal filter.
PROGRAMMING A CAUSAL FILTER. The general causal filter is implemented by combining two causal components: a strictly nonTecuTsive causal
part with a strictly TecuTsive part.
The general difference equation (2.44) of a causal nonTecuTsive filter, for
which NF = 0 and ak = 0 for all k reduces to
Np
yen) =
bkx(n - k)
(2.45)
k=O
y(n) =
L h(k)x(n -k)
(2.46)
k=O
for - NF s; k
s; Nr
(2.47)
47
L aky(n-k)+x(n)
(2.48)
k-l
SUMP(COEF,BUF,NC,SUM)
where
COEF
BUF
NC
SUM
SUM = L COEF(I)
* BUF(I)
(2.49)
1-1
48
COEFFICIENT ARRAY
BUFFER ARRAY
COEF(I)
BUF(I)
COEF(2)
BUF(2)
COEF (3)
BUF(3)
COEF(NC)
BUF(NC)
nGURE 218
Operation performed by the SUMP
routine.
such that the oldest element in the buffer is lost and the current value of the
time sequence is put into the first element of the buffer. That is, at time L,
X(L) is put into XBUF(1) and only the current and past NB -1 values are
retained in the buffer.
In general, given a value VAL and buffer array BUF(N), for 1::5 N ::5
NBUF, we want to write the subroutine called
SHFTRG(VAL,BUF,NBUF)
where
VAL
(real input) is the value to be inserted into the buffer;
BUF
(real input and output array) is the buffer array;
NBUF
(integer input) is the duration of the buffer array.
This subroutine shifts BUF(K) into BUF(K + 1), for 1::5 K::5 NBUF, and puts
VAL into BUF(l), as shown in Fig. 2.19. When used in NONREC, the buffer
BUF is equal to XBUF, NBUF is equal to NB, and at time L, VAL is equal to
X(L). When used in REC, BUF is equal to YBUF, NBUF is equal to NA and
at time L, VAL is equal to YR(L). We now describe how to use these
subroutines to implement the nonrecursive filter subprogram NONREC and
the recursive filter filter subprogram REC.
NONREC Subprogram. For the nonrecursive filter, the input array X(N), for
1::5 N::5 NX and the feedforward coefficient array BCOEF(N), for 1::5 N::5 NB
BEFORE SHFfRG
CALL
AFfER SHFfRG
CALL
VAL
BUF(I)
BUF(I)
BUF(2)
BUF(2)
BUF(NC-I)
BUF(NC-I)
BUF(NC)
BUF(NC)
nGURE 2-19
Operation performed by the SHFrRG
routine.
49
(NB = Np + 1), are specified and the output array YN(N), for 1:5 N:5 NX +
NB - 1, is to be generated_ The nonrecursive filter subroutine is denoted by
NONREC(X,NX,BCOEF,NB,YN)
where
X
NX
BCOEF
NB
YN
After this routine is completed, the nonrecursive filter operation has been
accomplished and the output values will reside in the YN array. The
combination of the SHFTRG and SUMP routines results in a convolution
operation.
REC Subroutine. For the recursive filter, the input array X(N), for 1:5 N:5
NX, and the feedback coefficient array ACOEF(N), for 1:5 N:5 NA (NA =
M), are specified and the output array YR(N) , for 1:5 N:5 NY, is to be
generated. Unlike the nonrecursive filter, the duration of a recursive filter can
be infinite because of the feedback. Hence, the value of NY must be
sufficiently large so that the important features of the output are observed. In
the case of determining the unit-sample response, the value of NY must be
chosen large enough such that the values of h(n) for n > NY are approximately
zero. In producing a plot of the sequence, it is sufficient that the omitted
magnitudes be smaller than the resolution of the plotting device. Typical
values for NY used "in the projects will be 55 and will not exceed 128.
50
FIGURE 2-20
Logic diagram for the NONREC filter routine. The values for the input array X(N), the size of the
array NX, the feed-forward coefficient array BCOEF(N), and the size of the coefficient array NB
are given; the output array of the nonrecursive filter YN(N) is to be computed.
51
REC(X,NX,ACOEF,NA,YR,NY)
where
X
(real input array) is the input array to the recursive filter;
NX
(integer input) is the duration of the input array;
ACOEF
(real input array) is the feedback coefficient array;
NA
(integer input) is the duration of the coefficient array;
YR
(real output array) is the output array;
NY
(integer input) is the duration of the output array.
The logic diagram for the REC routine is shown in Fig. 2.21. Within REC, the
following steps are performed:
Step 1. The buffer array YBUF(N), for 1:5 N:5 NA, is defined and
initialized to zero.
Step 2. In a loop with index I, for 1:5 1:5 NX, the output at time I,
YR(I), is equal to the sum of the input X(I) and SUM, the product of the past
outputs stored in YBUF and ACOEF. For 1= 1, SUM is equal to zero. VAL
is then set equal to the output YR(I) and is sequenced into YBUF.
Step 3. When I > NX, all the elements of X(N) have been used. At
that point the output YR(I) is then determined from only the past output
values. The recursive filter operation is accomplished after the desired number
of output points NY have been computed.
GENERAL FlLTER IMPLEMENfATION. The general filter can be imple-
when future values of the input sequence are used in the computation of tb,e
current output value. Noncausal filters can be identified easily from the
difference equation by Np being greater than zero. Since arrays with negative
indices are not generally allowed in programming languages, the simplest way
to implement a noacausal filter is to change the difference equation in such a
52
~{
nGURE 2-21
Logic diagram for the REC filter
routine. The values for the input
array X(N), the size of the array NX,
the feedback coefficient array
ACOEF(N), and the size of the
coefficient array NA are given; the
output array of the recursive filter
YR(N) is to be computed.
way as to produce a causal filter and then shift the final output array into the
future by N p index units, as described below. Using this procedure, the causal
filter can then be implemented in the manner described above, and only an
additional shift routine is needed, to obtain the noncausal result.
The noncausal property of the filter is due to the NF feedforward
coefficients having negative index values in the nonrecursive part of the filter.
Hence, a noncausal filter can be made causal by shifting the coefficient
YN(N)
lo;;No;;NX+NB)
NONREC
X(N)
for lo;;No;;N
:x"
53
B.E.C
YR(N)
ACOEF(N) - 1o;;No;;NY
lo;;No;;M
BCOEF(N)
lo;;No;;NB
FIGURE 2-U
Combining NONREC and REC to form the general filter having both nonrecursive and recursive
parts.
y'(n)=
Np+Np
L aky'(n-k)+ L
k-l
b;'x(n-k)
(2.50)
k~O
CAUSAL FILTER
Noncausal
y'(n)
part
zen) c---~---l
~~-~
(y(n)}
,... rII"r
(ytn)} =(y(n.NF)}
, .. 1 I lour+ ~n
o
Ji1GURE 2-23
Transforming a noncausal filter into a causal filter.
NF
Np
54
oorIIIlhr. ..
0
~7
I
1 2 NF NF+Np
Jr1 rT
_ .......~T';-L-L-L-!-'L.JWW'L..o...........o--_ _ _ _ _.".:>
- NF
Np
FIGURE 2-24
The noncausal filter output is
obtained by shifting the output
of the causal filter to the left.
This causal tiltf!r can be implemented by using the routines described above.
The values of {y'(n)} are exactly the same as those of {y(n)}, but only shifted
by NF index values. To obtain the noncausal output sequence {y(n)}, a time
shift to the future is required, i.e.
y(n) = y'(n + NF ),
SHIFT(Y,NY,NF)
where
y
AFTERSHlFT
CALL
BEFORE SHIFT
CALL
Y(l)
Y(l)
Y(2)
Y(2)
Y(NF )
Y(Ny-Nr-l)
Y(NF + 1)
Y(NF +2)
Y(Ny-NF)
Y(Ny-NF+l)
Y(Ny-l)
Y(Ny -1)
Y(Ny)
Y(Ny)
0
FIGURE l-2S
Operation performed by the SHIFf
routine.
55
2.11 SUMMARY
This chapter has presented the time-domain analysis techniques for describing
linear time-invariant digital filters and discrete-time systems, from basic
definitions to programming techniques. A particularly useful sequence that
describes the behavior of a digital filter is its unit-sample response, since from
it we can determine whether a filter is stable and whether it is causal. Further,
for any input sequence to a digital filter, we can determine the output sequence
by performing convolution with the unit-sample response.
An alternate time-domain description of a digital filter is the linear
difference equation. Yhe unit-sample response can be determined from the
difference equation by simply making the input equal to the unit-sample
sequence and computing the output sequence. Of practical importance, it was
found to be a rather straightforward task to implement a digital filter structure
from the difference equation. If the unit-sample response has a finite duration,
a nonrecursive filter can be implemented by identifying the feedforward
coefficients with the corresponding elements of the unit-sample response.
The steps for implementing a digital filter as a computer program were
presented. By writing simple routines to perform a sum-of-products computation and a shift-register operation, the implementation of nonrecursive and
recursive filters becomes conceptually easy to grasp. The general filter
structure containing both nonrecursive and recursive parts is implemente.d by
employing both routines. Noncausal filters can be implemented by employing
the causal filter routines and applying a subprogram that shifts the output
sequence "into the future".
PROBLEMS
2.1. Express the following in complex vector notation:
(a) 1 + e- j8
(b) 1- a e- j8
(c) 1 + 2e- j8 + e-j28
(d) 1 + ja
1 + jb
1 + a eJ8
(e) 1 + b eJ8
(f) (a
+ jb )112
56
(d) 1 + e
J; + e J28
2.3. Use the Euler identities to derive the formula for the cosine of the sum of two
angles:
R) cos( a + P) + cos( 11'- P)
cos( 11'+ P =
2
2.4. Demonstrate that the first-order recursive filter is linear. (Hint: Express G{x(n)}
as an infinite sum of scaled terms containing current and past values of x(n).
2.5. Evaluate the following summations and, give ,the result in complex vector
notation:
for Irl < 1
n=O
N-)
(b)
L e-
jwn
n=O
N-)
(c)
L cos(wn)
n=O
N-I
(d)
L an e-
jwn
2.6. This problem considers the case of determining the unit-sample response of a
filter having nonzero initial conditions. This condition can occur when the delay
element contents are not initialized to zero.
(a) The 3-sample averager. Determine {h(n,O)} when the content of the delay
element is equal to 2 and that of the advance is equal to 1 at n = O.
(b) The first-order recursive filter. Determine {h(n,O)} when the content of the
delay element is equal to 3 at n = O.
2.7. Given two finite-duration causal sequences, {x(n)} containing Nx elements and
{h(n)} containing NH elements, show that {y(n)} = {x(n)} * {h(n)} produces a
causal, finite-duration sequence containing Ny = Nx + NH -1 elements.
2.S. Given the following two sequences, determine an analytic expression for
{y(n)} = {x(n)} * {h(n)}. Let
x(n) = {~
forOsnsN-1
otherwise
{~
for OSnsN-1
otherwise
and
h(n) =
2.9.
2.10.
2.11.
2.U.
2.13.
2.14.
2.15.
2.16.
2.17.
2.18.
2.19.
57
Hint: First try N = 2 and then N = 3, to obtain the general analytic form of the
sequence.
Prove that any realizable filter having a finite number of elements in its
unit-sample response is always stable.
For the following difference equations, determine and sketch the unit-sample
response sequence and implement the digital filter structure:
(a) y(n)=x(n)-x(n-N)
(b) y(n)=ay(n-1)+x(n)+x(n-1)
Let a = 0.9.
For the digital filter structures shown in Fig. n.ll, determine the difference
equation, compute and sketch the unit-sample response.
The steady-state condition of a discrete-time system is defined as that in which the
output value does not change with time, i.e. y(n + 1) = y(n) for n very large.
Determine this steady-state value when the input sequence is a constant-valued
step sequence, x(n) = Ku(n), for the following system:
h(n)={~
for n ~O
otherwise
for all n
Using the convolution equation, determine the values of w for which y(n) is
finite, and the values of w for which y(n) is infinite.
58
(a)
x(n) - ___---~
~---___oy(n)
(b)
x(n)c
(c)
x(n)
y(n)
y(n)
(d)
y(n)
x(n)
(e)
x(n)
y(n)
OGURE Pl-ll
Digital filter structures.
2.20. Find the output sequence produced for the system having the unit-sample
response given by
h(n)=H
forn=O
forn=4
otherwise
S9
{~
COMPUTER PROJECTS
Preface
Most of the projects contain the following parts:
Object, that is a concise statement of the purpose of the project.
Analytic results, which describe the required analysis to be performed for
later comparison with the computer results. In some cases, references are
made to a problem at the end of the chapter.
Computer results, which describe the programs to be written and the
computations to be performed.
Definitions for the following terms will be helpful for performing the projects.
60
Computer results. Using the program TESTO.FOR in Appendix A, enter the two
values of frequency used above to produce the sinusoidal sequences. The program
asks for the frequency in Hertz per sample interval F, where F = w /2n. The range
of F that produces unique values is then -0.5:s F < 0.5.
Use the PLOT.FOR subroutine given in Appendix A to plot the data on the
terminal and on the printer. Since 55 lines fit on one piece of paper, limit the
number of points plotted to 55 whenever possible.
2.2. Exponential sequences
Object. Generate an exponential sequence and to determine the value number
range of the computer.
for 0 :s n :s 8.
for some positive value of 0.9 < r < 1. Repeat for some negative value of
-l<r< -0.9.
Computer results
(a) Write a program to accept a real-valued constant r and compute 55 elements
of the exponential sequence. Plot the sequences for the two values of r used
above. Compare your results with analytically determined sequences and
sketches.
(b) Determine an approximate range for the largest floating-point number that
can be expressed on your computer by accepting increasingly larger values of r
until an overflow eITor is encountered in computing the sequence. Determine
the smallest magnitude number that is still nonzero by accepting decreasingly
smaller values of r, until either an underflow eITor occurs, or the sequence
values become zero.
61
62
Hint:
,n
for n 2:0
SID Wo
x(n)
={
In practice, this sequence could have been obtained by placing observed data
values into the even-indexed elements of an array. The idea is to determine the
values of {x(n)} that are zeros by employing an interpolation sequence.
To perform the interpolation, let us consider the noncausal filter whose
unit-sample response is given by
h(-I) =0.5
h(O) = 1
h(l) = 0.5
* {h(n)},
y(n) =x(n)
prove that
for n even
and
Y()
n =
x(n - 1) + x(n
+ 1)
for n odd.
Computer results. Implement the causal filter to obtain the intermediate array
{y'(n)}, then shift {y'(n)} to obtain the desired array {y(n)}. Compare the plots
of {y(n)} with {y'(n)} to verify the shift and with {x(n)} to verify the
interpolation.
Notice the strange values at the ends of the interpolated sequence. These are
artifacts produced by assuming the values of the sequence are zero outside the
specified range.
2.6. Cascading filters
Object. To implement more complicated digital filters by cascading simpler filter
sections.
Write a program to cascade NONREC and REC. To verify the filter
operation, let the input array be the delayed unit-sample sequence given by
X(N) =
{~
for N= 6,
otherwise.
63
and
y(n) = Uyn(n
and
Let r
= 0.95,
Wo
r.
and
for a = 0.8 and b
2.8.)
In the FSK system, each bit value (lor 0) will be transformed into 32
elements of a sinusoid at a different frequency: a zero will be transmitted as
cos(won), for OSn s31, and a one will be transmitted as cos(wln), for
OSn s31.
The two frequencies will be personalized to each student: let K be the sum
modulo-8 of the last four digits of your social security number, then
wo=2;rK/32
and
WI
2;r(K + 8)/32
Computer results
(a) Generate and plot the two 32 element sequences that correspond to the two
binary values. On the computer plot, sketch the continuous-time sinusoid from
which the samples were derived_
64
(b) To produce an FSK sequence for future projects, write the subroutine
FSK(X)
where X (real 0lltput array) is an array of duration 96 that contains the
discrete-time sequence that results for the binary pattern 010.
Plot the output sequence. Sketch directly on the plot the continuous-time
sinusoidal function that corresponds to the samples.
FURTHER READING
Gold, Bernard, and Charles M. Rader: Digital Processing of Sig1Ulls, McGraw-Hill, 1969. [This
classic is one of the earliest books in the field.]
Oppenheim, Alan V., and Ronald W. Schafer: Digital Signal Processing, Prentice-Hall,
Englewood Cliffs, NJ, 1975. [This book was probably the most popular book in digital
signal processing, before the availability of the present text, and is suitable for advanced
study of many of the topics covered here.]
Rabiner, Lawrence R., and Bernard Gold: Theory and Application of Digital Signal Processing,
Prentice-Hall, Englewood Cliffs, NJ, 1975. [This book provides many practical aids for
digital filter design and implementation. J
REFERENCE TO TOPIC
TlDle-varying filters
Cowan, C. F. N. and P. M. Grant: Adaptive Filters, Prentice-Hall, Englewood Cliffs, NJ, 1985.
Goodwin, C. G. and K. S. Sin: Adaptive Filtering, Prediction and Control, Prentice-Hall,
Englewood Cliffs, ~J, 1984.
Haykin, Simon: Adaptive Filter Theory, Prentice-Hall, Englewood Cliffs, NJ, 1986.
Honig, M. L. and D. G. Messerschmitt: Adaptive Filters, Kluwer Academic, Boston, 1984.
CHAPTER
3
FOURIER
TRANSFORM OF
DISCRETE-TIME
SIGNALS
3.1 INTRODUcnON
In many signal processing applications, the distinguishing features of signals
and filters are most easily interpreted in the frequency domain. This chapter
describes the frequency-domain properties of discrete-time signals and the
frequency-domain behavior of discrete-time systems. The main analytic tool is
the Fourier transform of a discrete-time sequence, which can be applied either
to the unit-sample response of a filter to define the filter transfer function, or to
a data sequence to define the signal spectrum. The important properties of the
Fourier transform applied to discrete-time sequences are itemized and discussed. The magnitude and phase responses of a digital filter are examined. In
practice, discrete-time sequences are commonly obtained by sampling
continuous-time signals. The relationships between the spectra of continuoustime signals and the corresponding discrete-time sequences are investigated.
Interpolation functions to convert discrete-time sequences into continuoustime functions are also desc:ribed.
66
y(n)=
..
..
L
h(k)x(n-k)
k=-CCI
k=--CIC
= eiaJo"
h(k) eiaJo(n-k)
h(k) e-iwok
(3.1)
k=-CID
..
H(ei wO) =
(3.2)
k--oc
+ arg[H(eiwo)])}
(3.3)
wo=rr/4
Ar
012_
00
LINEAR
TIME-INVARIANT
SYS1EM
FIGURE 3-1
Magnitude and phase effects produced by a linear time-invariant system.
67
This result is true for any frequency wand hence this coefficient can be
generalized to be a function of frequency. We will denote this frequency
function by H(e jW ), where
00
H(e jW ) =
h(n) e- jw"
(3.4)
(3.5)
Ih(n)l<oo
n=-CIC
X(e jW)
= L
x(n) e- jw"
(3.6)
n-=-oo
Then X(e jW) defines the frequency content of {x(n)}, and will be called the
signal spectrum.
Eumple 3.1. Transfer function of the 3-sample avenger. Recall that the
unit-sample response for the noncausal 3-sample averager is given by
h(n)={~ol
for-lsnsl
otherwise
H(ei ,") =
h(n) e- J.... =
le- i ,""
n--i
= 1(ei "
+ 1 + e- i ..)
to get
Example 3.2. Transfer function of the first-order recursive filter. Recall that the
unit-sample response is given by
h(n) = a"u(n)
for all n
68
Ih(n)1 =
,. _ _ 00
n-O
lain
If lal ~ 1, the sum becomes infinite and the Fourier transform does not exist. For
lal < 1, we can apply the infinite geometric sum formula
L lal"=-"=0
1-lal
from which we note that the sum is finite for la I < 1. Then
~
H(eiOJ) =
Since la e-iOJI < 1 when lal < 1, we can apply the infinite geometric sum formula
to obtain
.
1
H(eIOJ) =
.
for lal < 1.
l-ae 1
01
fuadiOD
for all
11
i
=! [i (r e -i(OJ-"'o" + i (r e -i("'+",ol)"]
2 ,,_0
,,-0
For Irl < 1, we can apply the infinite geometric sum formula to get
H(ei"') = U(1 -
.
1
2 - r(eJ....o + e-j.,O) e- i'"
H(el ....) =.
.
.
-2
...
21- r(el....O + e- IOJO) e- IOJ + r e-l~
1- r cos(I)o) e- i.,
69
In the examples above, the sequences were written in the form of the
unit-sample response of a system {h(n)}. It is to be understood that the same
results would have been obtained for a signal sequence {x(n)}, having the
same element values. In this case, we would be calculating the spectrum,
rather than the transfer function.
= {axl(n)} + {bx2(n)}
(3.7)
Y(ei"')
= L
y(n) e- i "'"
n=-oo
00
=a L
00
xl(n) e- i "'" + b
n=-oo
(3.8)
H(ei ("'+2k1r
L
00
h(n) e- i (",+2kn)"
n=-ac
= L
(3.9)
n=-tIC
For integer values of k and n, the case here, e-i2knn = 1. Hence, we have
H(ei (",+2kn = H(ei "').
This periodicity can also be noted because the variable w appears in the
function only as e i"', which is itself periodic with period 27[. If the argument of
a function is periodic, it follows that the function itself is also periodic.
70
TABLE 3.1
H(~") =
h(n) e-
I'"
2. Linearity: If
3. Periodicity:
H(~a = H(ei (OJ+2kn
= HR(eiOJ) + jHI(eia
then
IH(~OJ)12 = Hi(~OJ) + HUe i "')
Arg[H(~OJ)
= arctan[HI(~")/ HR(eia]
= {x(n -
no)}
then
= {h(n)} * {x(n)}
then
Y(eJOJ ) = H(~"')X(ei"')
= {h(n)x(n)}
then
(periodic convolution)
8. For the real-valued sequence {h(n)}:
~
HR(ei"') =
h(n) cos(wn)
H1(eiOJ) = -
h(n) sin(wn)
11_-Il10
(a)
(b)
(c)
(d)
(e)
(f)
(g)
Complex-conjugate symmetry:
H(ei ") = H(ei "') = H(e- iOJ)
Real component is even function:
HR(~") = HR(e- iOJ )
Imaginary component is odd function: HI(el W ) = -H1(e- iOJ)
Magnitude spectrum is even function:
IH(~CV)I = IH(e-i"')1
Phase spectrum is odd function:
Arg[H(eiw)] = -Arg[H(e- 1W)]
If {h(n)} = {h( -n)} (even sequence), then H(~a is purely real.
If {h(n)} = {-h(-n)} (odd sequence), then H(~W) is purely imaginary.
REAL
AND
IMAGINARY
COMPONENTS
OF
THE
FOURIER
TRANSFORM. Since the Fourier transform is a complex function, it is
helpful to define alternate forms that can be plotted on a pair of twodimensional graphs. Let us consider the general case of a complex sequence
{h(n)}, which can be written as
h(n) = hR(n)
+ jhl(n)
(3.10)
71
where hR(n) is the real component and hJ(n) is the imaginary component. By
applying Euler's identity to the definition of the Fourier transform, we have
~
n=-~
(3.11)
This function can be expressed explicitly in terms of its real and imaginary
parts as
(3.12)
where
~
(3.13)
n=-oo
and
~
(3.14)
n=-oo
MAGNITUDE AND
PHASE
COMPONENTS
OF THE
FOURIER
TRANSFORM. Being a complex quantity, we can also express H(eij as a
complex vector:
(3.15)
If H(ei"') denotes the transfer function of a system, it is conventional to call
IH(ei"')1 the magnitude response, and Arg[H(ei"')] the phase response. For
signal sequences, H(ei"') is the spectrum, IH(ei"')1 is called the magnitude
spectrum, and Arg[H(ei"')] is the phase spectrum. The magnitude response is
equal to
(3.16)
72
H(e jOJ )=
00
00
L h(n)cos(wn)-j L
n=-oo
h(n)e- jOJn =
n=-tD
h(n)sin(wn)
n=-oo
(3.19)
The Fourier transform of a real sequence has the following useful symmetry
properties.
SYMMETRY OF THE REAL AND IMAGINARY PARTS. Let us consider the
effect of reversing the sign of the frequency variable in the argument of the
transform. We can then write
H(e-io = HR(e-io + jH1(e-iOJ)
(3.20)
Evaluating H(e-iO, we find
00
H(e-iO
= L
hen) e jwn =
n=-oo
00
00
L hen) cos(wn) + j L
n=-oo
hen) sin(wn)
(3.21)
n=-OC
HR(eiO =
(3.22)
indicating that the real part is an even function of w. Comparing the imaginary
parts, we find
00
HI(eifD) = -
(3.23)
indicating that the imaginary part is an odd function of (J). Also, since the
complex conjugate is obtained by changing the sign of the j terms, we find
H(e- jCO ) = H*(ejO.
(3.24)
Since H(ei CO) is a periodic function of w with period 2Jr, an important
consequence of these results is that, for real-valued discrete-time sequences, all
the information in the Fourier transform is contained in the frequency range
O:s; w :s; Jr. The unspecified portion of the Fourier transform in the range
-Jr :s; w < 0 can be determined from these symmetry properties.
SYMMETRIES OF THE MAGNITUDE AND PHASE FUNCDONS. The magnitude response is also an even function of frequency, since
IH(ejOJ)1 = (H(e jOJ )H*(e jOJ
= (H*(e- jCO )H(e- jCO = IH(e-iCO)1 (3.25)
ll2
ll2
73
= -arctan[HI(eiw)/HR(eiro)]
= -Arg[H(eiw )]
(3.26)
d(n-k)={~
for n =k
otherwise
Dk(e IW ) =
2:
The real and imaginary parts are most easily determined by applying the Euler
identities:
and
The magnitude spectrum is equal to
IDk(eiw)1 = [cos2 (wk) + sin2 (Wk)]112 = 1
or, alternately,
IDk(eIW)1
= (e-Jwk)(eJcat)112 = 1
The magnitude and phase spectra could also have been obtained by inspection by
noting that Dk(eJW) is already in the complex vector form. The magnitude and
phase functions are shown in Fig. 3.2 for different values of k.
74
(a)
(b)
k=O
(d")} . .
r. .
(c)
k>0
:}_.J.I_l_)
__{_d(_n-_k....
..n
-2,-1012
o1
k<O
r.
(<I(.-.))
k -10
IDu(ei"') I
-21T
-IT
If
If
I) w
2Ii
Arg[Do(ei"') J
!
-21T
-IT
t
0
-+
If
FIGURE 3-2
Magnitude and phase spectra of the unit-sample sequence. (a) Standard unit-sample sequence
(k = 0); (b) Delayed sequence (k > 0); (c) Delayed sequence (k < 0).
this range, a jump of 2.1t' is needed to bring the phase back into this range.
This principal value range is also convenient, since it is the value returned by
the commonly available ATAN2(Y, X) computer function, where Y is the
imaginary component and X is the real component.
Example 3.5. Mapitllde and pbase response of the 3-samp1e avenger. From
Example 3.1, we have
IH(ei"')1 = 11 +2~(CO)1
and the phase response is equal to
Arg[H(eJ"')] =
{O
1r
The magnitude and phase responses are shown in Fig. 3.3. The appropriate sign
of 1r is chosen to make the Arg[H(eio] an odd function of frequency.
75
{h(n)}
...
.~"1.
-2 -10 1 2
nGURE 3-3
Magnitude and phase responses of the 3-sample averager.
h(l) = 1
h(2) = t
h(n) = 0 otherwise
H(ei "') =
! + e-J'" + ~e-i2'"
76
+ cos(we-ieo
This last form is the linear-phase form given above. In this case, the amplitude
function is never negative and the phase response is simply - w.
PHASE JUMPS. From the previous examples, we note that there are two
occasions for which the phase function experiences discontinuities, or jumps.
1. A jump of 2Jr occurs to maintain the phase function within the principal
value range of [-n, n).
2. A jump of n occurs when B(eiev ) undergoes a change in sign.
The sign of the phase jump is chosen such that the resulting phase function is
odd and, after the jump, lies in the range [-n, n].
Example 3.7. Magnitude and phase response of the first-ordel' reausive
filter. From Example 3.2, we have H(ei"') = (1- a e- i 1 The magnitude
response is most easily obtained by calculating the squared magnitude function,
or
"'r
To find the real and imaginary parts, we make the denominator real by
mUltiplying by its complex conjugate:
1
1 - a ci"'
- 1 - a e i"'1 - a ei "
H( i"') _
1- a ei "'
1- a cos(w) - ja sinew)
1 - 2a cos( w ) + a 2
Since the denominator is real, we can now separate the numerator terms to
determine the real and imaginary parts. The real part is then
/{, (ci") =
R
1- a cos(w)
1-2acos(w)+a2
The real part is an even function of frequency. The imaginary part is equal to
H1(ci"') =
-a sinew)
1- 2a cos(w) + a2
77
a= -0.9 IH(e'''')1
a= -.0.5
I
I
---"
".
.-
/~a=-0.9
-IT
Arg[H(e'''')]
Arg[H(e'''')]
n/2
n/2
......'"","" \
a=O.5
a=-0.5
-n/2
ftGURE 3-4
Magnitude and phase responses of first-order recursive filter for different values of Q.
l-acos(co)
These responses are shown in Fig. 3.4 for different values of a. When 0 < a < 1, a
lowpass filter results, and when -1 < a < 0, a highpass filter results.
Example 3.S. Magnitude and phase response of the second-order recursive
filter. From Example 33, we have
H(e i"')=
1-rcos(co~)e-I'"
1- 2r cos(coo) e- l '" + r2 e-,2O)
For simplicity of notation, let us write H(el "') in the following form
1 + a e-iO)
N(e i"')
H(el "')=
=
-l+ae- i"'+pe-,2O) D(eiw)
where N(eiw ) is the numerator and D(ei"') is the denominator. The magnitude
response is then
(N(eiO N*(e iO)lI2
.
IH(el"')1 = D(ei aJ ) D*(eIW)
_
- [1 + ~ +
[1 + 2a cos(co) + a2f12
p2 + 2a(1 + P) cps(co) + 2P coS(2CO)j112
Note from this rather complicated form that co appears only as an argument of
78
jH(eJro)j
Arg[H(elro)]
11
FIGURE 3-5
Magnitude and phase responses of second-order
recursive filter for different values of r.
H(e
HI
ei )
( W
(af3
+ ex - a) sin(w) + f3 sin(2w)
Wo
= ,,/4 and
= n/4 = 000,
Example 3.9.
h(n)={lo
forOsns2
otherwise
79
Then
We shall evaluate this sum using three methods: the mathematically tedious
approach, the enlightened direct approach and by applying the finite geometric
sum formula.
Mathematically tedious method. Evaluating the sum, we get
H(eiw ) = ill + e- iw + e- i2w]
= ill + cos(w) - j sin(w) + cos(2w) - j sin(2w)]
+ cos(2w + 4 oos(w)]
= Ml + 4ooS2(W) + 400s(w)] = Ml + 2cos(wW
= ~[1 + 2(1
W + 2cos(we- iw = B(eiw)e-iw
h(n)
~ III
-.....l~O~1-72-!j-4~-
....
~ n
Arg(H(eJO>)]
:~
-1T
FlGURE 3-6
Magnitude and phase responses of causal 3-sample averager.
80
and
Arg[H(eJW )] =
{-W
-Wlr
for -2lr/3<w<2lr/3,
for -lr:S W < -2lr/3
H(e JW ) = .J
= 3
e -jw sin(3w/2)
sin(w/2)
B( j"') -jw
e e
This last form is the amplitude with linear-phase form described above in Eq.
(3.27). From that discussion, we find
IH(eJW)1 = Isin(3w/2)1
13 sin(w/2)1
and
Arg[H(eIW )] =
{-W
-w lr
81
real-valued elements. Then, the real part of the Fourier transform evaluated at
frequency Wk> denoted by HR(e iWk ), is given by
MI-l
HR(eJWk )
2:
(3.29)
hen) cos(wkn)
n=O
(3.30)
NH
2:
for1:::;K:::;Np
(3.31)
N=l
The frequency of the Kth cosine sequence is equal to 2n(K -1)INp , for
1:::; K:::; N p The array containing the imaginary part, HI(K), is
HI(K) = -
NH
2:
for 1 :::;K:::;Np
(3.32)
N=l
Using the programming style described in the pre lious chapter, the
computation of the Fourier transform should be performed with the subprogram, denoted by
FT(H,NH,HR,HI,NP)
where
H
MAGPHS(HR,HI,HMAG,HPHS,NP)
82
where
HR
HI
HMAG
HPHS
NP
for 1 :s K:s NP
(3.33)
for 1 :s K :s NP
(3.34)
When both HI(K) and HR(K) are zero, the arctangent function should not be
used, but rather a value of zero should be assigned for the pha~e value.
Some programming languages only have the ATAN(Y IX) function,
which generates the phase in the first and fourth quadrants, i.e. in the range
[-n/2, Jr/2]. It is left as an exercise for the student to determine the principal
value of the phase using the ATAN function and the sign of the real part.
Because of the symmetry properties for real-valued sequences, we need
to evaluate the plot the Fourier transform only over the range 0 :s OJ :S Jr. Since
both the frequency points OJ = 0 and OJ = Jr are included, the number of points
to be computed is equal to one more than half the points covering one entire
period, or (Np /2) + 1.
(3.35)
= ,,~'" L~
(3.36)
MUltiplying this last equation by unity, in the form eJwk e- Jwk , we get
'"
.,
Y(eiw ) =
[h(k) e-iwkx(n - k) e-Jw(n-k)]
2: 2:
83
(3.37)
n=-oo k=-oo
Since h(k) e- iwk is not a function of n, it can be factored out of the summation
with respect to n, giving
Y(eiw )
k) e-iW(n-k)]
(3.38)
This last result indicates that the input spectrum X(e iW ) is changed through a
multiplicative operation by the filter transfer function H(e iW ) to produce the
output spectrum Y(ei aJ ). Applying the complex vector notation to the output
spectrum, we obtain
Y(eiaJ) = IY(eiaJ)1 exp{j Arg{Y(ei"')]}
= IH(ei"')1 exp{j Arg[H(ei"')]} IX(eiaJ)1 exp{j Arg[X(ei"')]}
(3.40)
and
(3.42)
In words, the output magnitude spectrum is equal to the product of the input
magnitude spectrum and the filter magnitude response. The output phase
spectrum is equal to the sum of the input phase spectrum and the filter phase
response.
Example 3.10. Sipal processing with the Fourier transform. Let the input
sequence be given by
x(n) =
{~
for -1 Sn S 1
otherwise
a"
h(n) = { 0
for n 2:0
otherwise
Y(eiw) =H(eiw)X(eiW ) =
~(; ::o;~~
_
(1+2cos(wW
- 9(1- 2a cos(w) + a2 )
The output phase spectrum can be computed in two ways. First, it can be
obtained from the real and imaginary components of Y(ei W ) , determined from
iW
Y(eiw ) = (1 + 2 COS(~)(1- a e )
3(1- a e- IW ) 1- a elw
_ (1- a cos w)(1 + 2 cos(w - ja sin(w)(1 + 2cos(w
3(1- 2a cos(w) + a2 )
Then
j ..
_
(-aSin(w)(1+2COS(W)_
(-asin(W)
Arg[Y(e )]-arctan (1-acos(w(1+2cos(w -arctan 1-acos(w)
The phase can also be determined by adding the phase response of the filter to
the phase spectrum of the input:
Arg[Y(e i "')] = Arg[H(eIW)] + Arg[X(e i "')]
-a sin(w) )
= 0 + arctan ( 1- a cos(w)
8S
2:'"
hk{n) e- jOJn
n=-oo
'"
2:
h{n n=-OCI
k) e- jWft
(3.43)
(h(n)}
Original
sequence
... llil I
o
Delayed
sequence
"..
1 2
(hJn)}
........
II!II.;.
o
1 k-l k k+l
Arg[H(e JW )]
IH(el"')1
1T
-It
.-
CI)
I.-
I
I
It
CI)
-.-
-------1
I
I
F1GURE
~7
Comparison of the magnitude and phase spectra for original and delayed sequences.
CI)
86
00
2:
n=-IXI
=e- jwk
00
hen - k) e-iw(n-k)
(3.44)
n=-oo
= IH(eiW)1
(3.46)
and
(3.47)
for all m
(3.48)
The two cases, depending on whether Ns is an integer, are shown in Fig. 3.8.
The special case when Ns = 0 defines an even sequence, for which
hen) = h( -n)
for all n
(3.49)
Antisymmetric sequences are those whose elements about the point Ns are
of equal magnitude, but of opposite sign, or
heNs + n) = -heNs - n)
for all n
(3.50)
The two cases, depending on whether Ns is an integer, are shown in Fig. 3.8.
When Ns is an integer, heNs) must equal zero for {hen)} to be an
antisymmetric sequence. The special case when Ns = 0 defines an odd
sequence, for which
hen) = -h(-n)
for all n
(3.51)
ANTISYMMETRIC SEQUENCES
EVEN-SYMMETRIC SEQUENCES
11 INs TIT
NsINlEGER
Ns NONINlEGER
87
~J-LT-",---o.>
-.-J'LT1-...1-1-1,1c'-1
Ns
nGURE 3-8
Symmetric and antisymmetric sequences shown for integer and noninteger values of symmetry
point N s -
..
h(n) e- iWrl
n=-oo
-1
..
h(n) e- iwn
n=-oo
..
=L
h( -m) el<mt
m=1
h(n) e- iwn
n=1
..
+ h(O) + L
..
= h(O) + L
h(n)(e- iwn
+ elOJn )
n=1
= h(O)
+2 L
h(n) cos(wn)
(3.54)
n=1
88
Since its imaginary part is identically zero, the phase function computed from
the arctangent function is zero. The phase response then only accommodates
the sign change of H(e iw ):
Arg[H(ei W )] = {O
Jr,
for
for
iw
(J)
(J)
(3.56)
=0 otherwise
n--2
= 1 + 2 cos( w)
+ 2 cos(2w)
{~(II)}
. .I
I
I III_
IIII
-M
I . .
-lOI2 M
{1Is(n)} = {h.!(n-M)}
..I
I II
I I I I II I .
-1 01
2M
FIGURE 3-9
n
89
for 0:5n:54
This is just the delayed version of the sequence given in Example 3.11. We can
get the Fourier transform by simply adding the linear phase function - 2w to the
result of Example 3.11 to include the delay.
We verify this result by directly computing the Fourier transform of the
above sequence, which is given by
4
H(e jW ) =
L e-
...
-0
e - jS on ejSwi2 _ e - jSwi2
e ion
eiwi2 _
e iwi2
= sin(5w/2) e- J2UJ
sin(w/2)
The phase is a linear function of frequency with slope equal to -2. It is left as an
exercise for the student to show that the two amplitude expressions are
equivalent.
Recall that an even sequence has zero phase, except for the phase jumps
of .;rr caused by the sign reversal of the amplitude of the Fourier transform. If
these jumps are ignored, we are left with a phase that is linear with frequency,
which will be called a linear-phase function. This linear-phase property will be
important for filter design in the following chapters.
FOURIER TRANSFORM OF ANflSYMMETRIC SEQUENCES. We first consider the Fourier transform of an odd sequence, followed by that for the
general antisymmetric sequence. For an odd sequence, h(O) = 0, and the
Fourier transform can be written as
00
=-
j2 ~ h(n) sin(wn)
n=l
(3.60)
90
IH(eiCO)1
= HI(e iCO )
=-H1(eico )
(3.61)
Ar [H(eico) = {lC/2
g
lC/2 lC
0
0
(3.62)
01
forn=-2
for n =2
othe~
-lC/2
(3.63)
Then, we have
(3.64)
91
IH(eI'")1
'VV\
o
1tfl
1t
-,.
Arg[H(eJ")
1t.
1tfll-
I
1t
-lTfl
-IT'-
FIGURE 3-10
Magnitude and phase spectra for an odd sequence.
and
(3.65)
Ignoring the phase jumps due to sign reversals in the amplitude function,
including the one at (J) = 0, we are also left with a linear-phase function for
antisymmetric sequences. This result is true even when M is not an integer,
although a strictly odd sequence does not exist in this case. This is illustrated in
the next example.
Example 3.14. Fourier transform of aD aDtisymmetric sequence. In this example, we will cOnsider the case when Ns is not an integer. As shown in Fig. 3.11,
IH(e)")1
{h(n)}
-2 -1
~,
-IT
1t
FIGURE 3-11
Magnitude and phase spectra
for an antisymmetric sequence.
92
let h(O) = -!, h(1) = 1, h(2) = -1, h(3) =! and h(n) = 0, otherwise. Then, the
Fourier transform is given by
H(ei"') = _! + e-J'" - e-J2", + !e- i3 ",
= -!(1- e- i3 ",) + (e- j'" - e- j2 ",)
= _e-i3WI2H(ei30i2 _ e- i30i2) + ei0i2 _ e- i0i2]
= -je- i3",I2(sin(3ro/2) + 2 sin(ro/2
argument:
Let s(t) be a periodic function of the continuous-valued variable t with
period T. Then s(t) can be expressed in the following Fourier series
expansion:
co
s(t) =
an e- iot
(3.66)
an
=-1 fTI2
T
-TI2
s(t) eiO.,t dt
(3.67)
In exactly the same fashion, H(eiw) can be expressed as the following Fourier
series expansion
co
H(eiw )
where 8n
= 2.1l'n/2.1l' = n,
L en e- iBw
n=-co
(3.68)
93
Note the similarity of the definition of the Fourier transform in Eq. (3.4) and
the Fourier series expansion of H(eiw ) given in Eq. (3.68). This similarity
allows us to define the inverse Fourier transform as
(3.70)
This integral solution for the inverse Fourier transform is useful for analytic
purposes, as shown later, but it is usually very difficult to evaluate for typical
functional forms of H(eiw ). An alternate, and occasionally more helpful,
method of determining the values of h(n) follows directly from the definition
of the Fourier transform. equal to
00
H(eiw ) =
2:
h(n) e-IW>l
n=-oo
W + 2cos(w
_If
J.. ("
6.n-L.
_J.. (el -
- 6.nsin(n.n-)
3n.n-
= --+
Recall that sin(n.n-) =0 for integer values of n. When the denominator is also
zero, an indeterminate form results. Applying L'Hospital's argument, we find
that
lim sin(E)/E = 1
.-0
94
{t
a"
h(n)= { 0,
for n 2:0
otherwise
the
output
=! ejQ) + 1 + ~-j..,
3 1-ae-JOJ
Combining all the terms having the same complex exponential factor and
equating h(k) with the coefficient of e -jOlk, the output sequence is found to be
yen) = l[an+1u(n + 1) + a"u(n) + an-1u(n - 1)]
95
for all n
(3.71)
(3.72)
V(ei lil) =
"=-00
To determine a more useful form for V(eiW ), we first express h(n) as an
inverse Fourier transform given by
(3.73)
We thus get
(3.74)
Interchanging the order of summation and integration, we have
(i
V(eiO=~
(w(n)e-i(W-cr)n)H(eiJda
2Jf )-_ 11_-"
(3.75)
The term in the parentheses is similar to the definition of the Fourier transform
of {w(n)}, but at a frequency argument of co - a, or W(ei("'-cr. Including this
Fourier transform into the integral, we get
V(eio =
~ (- H(ei J W(ei(o>-cr da
2Jf 1-_
= H(eiO
W(ei"')
(3.76)
Sin!:;~4)
in
96
OJ
1~]lllllL. .
(~" I ,,")hi"))
II r
.. .I-3 I 0
-3
HC'")
It. ..
3
FIGURE 3-12
Multiplication of two discrete-time sequences with the corresponding spectral convolution
operation.
{~
V(ei "'),
W(d"') =
2:
e- j .... = ePO>
n--3
. 1 - e- j7 .,
=eI3 ..
.
1 - e I'"
2: e-;'"
n-O
sin(3w/2)
sin (w /2)
The result of the convolution is shown in Fig. 3.12. The main effect of the
convGlution is that the sharp transitions in H(ej .,) have been made smoother. We
will explore this multiplication with a window sequence in more detail in the
design of finite-impulse response filters in a later chapter.
97
T. is commonly called the sampling period and has units seconds per sample
interval. The discrete-time Fourier transform for such sampled data sequences
is defined by
(3.79)
n=-oo
where w has units radians per sample interval. This discrete-time spectrum is
related to the continuous-time spectrum CA(jQ) by
C(e
iw
(3.80)
98
f\
-:bE
Ts
-It
Ts
7t
2r.
Ts
Ts
co,n
FIGURE 3-13
Spectrum of a discrete-time sequence obtained by sampling a continuous-time signal.
We first define the Dirac delta function and present its properties that are
important for this application. By definition, the Dirac delta function, denoted
by c5(t), has infinite height and zero width, but its area, or weight, is equal to
unity. To illustrate how we can approach a Dirac delta function, consider the
rectangular function r.(t), whose width is E and whose height is lIE, so its area
is equal to one, as shown in Fig. 3.14. We can define c5(t) as
c5(t) = lim rE(t)
(3.81)
....0
The following three properties of the Dirac delta function are useful
here.
Property 1. The product of a function and a delta function. In multiplying any continuous-time function f(t), the weight of the delta function
becomes equal to the value of the function at the instant of the delta function,
or
f(t) c5(t - to)
= f(t o) c5(t -
to)
(3.82)
,.(1)
II
-'h
'h
o
1"==0
FIGURE 3-14
Limiting proCedure to obtain a Dirac delta function.
(3.83)
99
This last equality follows because the area of o(t) is unity. The Dirac delta
function is used to select, or sift, the value of the function at t = to
Property 3. Convolving a function with a delta function (The shifting
property). When the function f(t) is convolved with o(t - to), the origin of
f(t) is shift to t = to, or
o(t - to) * f(t)
= f(t -
to)
(3.85)
'"
L o(t n=-oo
nT.)
T. seconds is
(3.86)
We can now use these properties of the Dirac delta function to determine
the relationship between the spectra. The sampling process is modeled by the
multiplication operation given by
for all
= cA(t)
L'"
o(t - nT.)
for all t
(3.87)
n=-CXl
[J
cA(t)
jQt
dt
n~'" o(t -
(3.88)
nT.)] e-
jQt
dt
(3.89)
Changing the order of integration and summation, and applying the sifting
100
FIGURE 3-15
Sampling a continuous-time signal can be treated as a multiplicative process with a train of Dirac
impulses.
Cs(jQ) =
nT.) CA(t) e-
jDt
dt]
...
2:
cA(nT.) e-jnCT,
(3.90)
compari~g
That is, the form of C(eiQ) can be obtained by determining CsOQ) and
replacing Q by (J) I T.. The division of (J) by T. scales the values of (J) to be the
same as Q. For sampled-data applications, it is conventional to express w in
the range [-niTs, nlT.), to have the same numerical values as Q. The units of
wiT. are radians per second, just as for the continuous-time frequency.
To complete the proof, we must determine Cs(jQ) in terms of the
continuous-time spectrum CA(jQ). Since 6r.(t) is a periodic function, it can be
expressed in the following Fourier series expansion given by
..,
6 T ,(t) =
where Q n
= 23m1T., and
i
T.
2: an e-jc
n=-oo
T
,12
an = -1
(3.92)
6 T,(t) ejQ.r dt
(3.93)
-T,12
Over the interval - T./2 :$ t < T./2, the impulse train 6r.(t) is represented by
only the single Dirac impulse situated at t = 0, or 6(t). Making this substitution
and applying the sifting property, we get
i
T.
1
an =-
T
,12
-T,12
1 j o=1
6(t) dQ.rdt=-e
.
T.
T.
for all n
(3.94)
101
Substituting this Fourier series expansion into the sampling process, we get
=-
oo
L
L
00
T. n=-oo
Tan=-cc
e- IQ t
CA(t) e-IQ t
(3.95) .
jQt
dt
(3.%)
(3.97)
L:
CA(t) e-j(Q+Qk)t dt
= CAOQ + jQk)
(3.98)
This result is simply the original analog spectrum that has been shifted from
0=0 to 0 = -Ok, as shown in Fig. 3.16. The total spectrum is then the sum
of these shifted versions and is given by
(3.99)
(= -2ITk)
T,
FIGURE 3-16
Shifted version of the analog spectrum.
102
(b)
T, < 7T/OM
C (j11)
Ideallowpass filter
_"' ' _~. .J.:- ~-,- r- I<: ~ZS:_- _-" "*-_-_- -:-! -~-L-i-LL_~'_'-+~
- 211
IS
-11
--
Ts
11"
11"
-11
Ts
211
Ts
FIGURE 317
Relationship between continuous-time spectrum of a signal and the spectrum of the discrete-time
sequence obtained by sampling the signal with sampling period T.. (a) Original spectrum of
continuous-time signal; (b) spectrum of sampled sequence when 11M < nIT.; (c) spectrum of
sampled sequence when Q M > nIT.. The latter case illustrates the aliasing error.
-m
-1[
Ts
IS
1[
21[
IS
IS
CAoy,
-1[
1[
IS
IS
103
~(jn)
U
-
IS
- n
Ts
FIGURE 3-18
Two candidates for the continuoustime spectrum when aliasing occurs_
(3.101)
for all n
104
(b)
(a)
CA(j!l)
o 'lo
It
T,
k' J
\
-It
T,
~21T
/ 'lo
2!..
T,
C,(eJOl)
C,(el"')
-21T
I
0
~~\----~--~~;IT
-+'loT
T,
I T~IT I
21T
--'loT - +'loT
T,
T,
--------
FIGURE 3-19
Demonstration of aliasing caused by choosing too large. (a) Unaliased version, when < 11:/0.0 ;
(b) aliasing caused when > 11:/0.0 In this latter case a low-frequency cosine function is apparent
when the sequence is interpolated.
r.
r.
r.
2;',,~~ [6(0 -
from the term 6(0 + 0 0 - 2KIT.), or the k = 1 term. The impulse located in the
range -KIT. < 0 ~ 0 is at
0= 0 0 - 1K/T. = lOOK -180n = -BOn rad S-1
105
from b(g - go + 2nllT.), or the k = -1 term_ In this case, the sampled sequence
appears to be derived from a continuous-time function at a lower frequency
2n/T. - go = BOn rad S-I_ This is the aliasing phenomenon_
nificant power in the original continuous-time signal may be larger than that
containing the desired information. This commonly occurs when a lowfrequency signal is corrupted by high-frequency noise or in modulated signals,
such as broadcast radio. If sampled at the rate dictated by the Nyquist criterion
for the desired analog signal, unwanted high frequency signals would cause
aliasing errors to occur.
To prevent aliasing errors caused by these undesired high-frequency
signals, an analog lowpass filter, called an anti-aliasing filter, must be used.
This filter is applied to the analog signal prior to sampling and reduces the
power in the analog signal for the frequency range beyond Q = niT.. In
practice, the spectral magnitude level for Q ~ JrIT. should be less than 1%
(-40 dB) of the important spectral features in the desired signal spectrum to
prevent significant aliasing.
For example, let the observed analog signal contain power in an
arbitrarily large frequency range, but have relevant information only in the
frequency range -Q R $ Q $ QR. We wish to determine the appropriate
sampling period T.. The Nyquist criterion tells us that T. must be less than
Jr/QR. If sampled at this rate, the higher frequency components in the analog
signal will be aliased into the relevant discrete-time signal. The anti-aliasing
filter must satisfy two conditions:
Condition 1. The analog signal components with frequencies less than
must be negligibly attenuated by the filter.
Condition 2. To prevent aliasing in the relevant analog frequency range,
the components for IQI ~2JrIT. - QR must be attenuated. After sampling, the
components in this frequency range fall into the range -Q R $ Q $ Q R when
the periodic extension is formed.
QR
We consider how these conditions can be met in Chapter 8, where the design
of analog lowpass filters is discussed.
3.11 RECONSTRUcnON OF
CONTINUOUSTIME SIGNALS FROM
DISCRETETIME SEQUENCES
In many practical applications, discrete-time sequences are required to be
transformed into continuous-time signals. One example is the digital audio
106
CS<jO)
D
27t
-T,
/:\ D
I
_~-OM
T,
OM
7t
27t
T,
T,
H,(jO)
I 1""1- - - . ; . ; . : . . . . . ; . . . . . - - - ,
1
I
L
0
I
I
I
7t
o
FIGURE 3-20
The spectrum of an analog signal can be obtained by multiplying the spectrum of the sample values
with the transfer function of an ideal analog lowpass filter. In practice, H,(jQ) must be
approximated.
compact disk system, in which the audio signal is stored as digital samples on
the disk and must ultimately be converted into the analog signal that drive the
speakers. Another is the digital controller in a robot system, that uses the
digital computer to process the sensor data, but requires an analog signal to
control the actuator motors. In these cases, we are faced with the converse
problem from that of sampling CA(t) to obtain {cA(nT.)}. The relevant
question now becomes how to recover the analog signal CA(t) from the
sampled sequence {csCnT.)}.
We begin by considering the unaliased spectrum of Cs(jQ), shown in Fig.
3.20. CA(jQ) then has the same form as Cs(jQ) over -rclT.:5 Q < rclT.. Let us
consider an analog lowpass filter with the following ideal frequency response
for -rclT.:5Q<rclT.
otherwise
(3.103)
(3.104)
To interpret this result in the time domain, let us examine the corresponding
convolution equation given by
CA(t) =
L"'", cs(c)hICt -
c) dc
(3.105)
107
Approximation to C,(t)
"/
...
FIGURE 3-21
Approximating the sequence of weighted Dirac
delta functions with a sequence of narrow pulses
having different amplitudes.
_ _~--l~~_--':'-_u....._. n T,
=----j2m
~ Sinc(tlT.)
1 sinemIT.)
lttlT.
= T.
(3.106)
The Sinc(x) function is shown in Fig. 3.22. The function is equal to zero for
integral values of the sampling time, i.e. t = nT., where n is a non-zero-valued
integer. For t = 0, we find
hI(O) = lim.!. sin(mlT.)
1-+0
T.
:Jrt I T.
(1/3!)(lttlT.)3 + ...
Jrt I T.
lIT.
(3.107)
~.
-3T-2
-T
2T 3T
4T
FIGURE 3-22
The Sinc(tIT) function, used
for interpolation, is the impulse response of the ideal
analog lowpass filter.
188
ftGURE 3-23
In the time domain, the interpolation
process is treated as the convolution of
weighted and delayed Sinc(t/T) functions.
The values of the sequence {cs(nT.)} are
shown as dots. The continuous-time
function is shown in heavy solid line.
oo
CA(t) =
=.!.
T.n=-oo
nT.)
(3.108)
(2)
(3)
</>(0) = 1
</>(nT.) = 0
for n *0
(3.109)
00
The first two properties permit the interpolated function to equal the sample
values at the sampling instants. Property (3) guarantees that the interpolated
function remains finite between the sampling instants. Example 3.20 considers
two commonly employed interpolation functions that have these properties.
109
1;
~(t)
-T,
nGURE 3-24
1;
Eumple 3.20. Zero-order hold and linear iDterpolaton. The impulse response
of the zero-order hold interpolator 4>o(t) is given by
4>o(t) =
{~
forO~t<T.
otherwise
T.
nGURE 3-25
Results of applying the two interpolation functions to the same
sequence.
110
3.12 SUMMARY
In this chapter, we presented the frequency-domain procedures for analyzing
digital filters. The Fourier transform of the unit-sample response provided the
frequency filtering characteristics of the digital filter, while the Fourier
transform of a data sequence indicated its frequency content. The Fourier
transform was shown to be a periodic function of w, with period 2Jr, and for
real-valued sequences to have a magnitude function that is an even function of
frequency and a phase function that is odd. This allows the entire function to
be determined from the values for O:s; w :s; Jr. Even or odd real-valued
sequences were shown to have purely real or imaginary Fourier transforms,
while sequences with symmetries have linear phase functions. The operations
of convolution and multiplication were shown to be converted into the other
when the Fourier transform was computed. The inverse Fourier transform,was
defined through a Fourier series argument, but found to be complicated to
apply directly. An alternate method involving a Taylor expansion was found to
be simpler, but did not provide an analytic form for the time series. The
relationship between continuous-time and discrete-time frequency functions
was discussed and so were procedures to convert a continuous-time function
into a discrete-time sequence. This chapter ended with a short discussion on
reconstructing the analog signal from the sampled sequence by using an
interpolating filter. In the next chapter, we will investigate the signal
processing implications of evaluating the Fourier transform at a finite number
of points by computer.
FURmER READING
Antoniou, Andreas: Digital Filters: Analysis and Design, McGraw-Hill, New York, 1979.
Bracewell, R. N.: The Fourier Transform and Its Applications, 2d ed., McGraw-Hill, New York,
1978.
Childers, D. G. (ed.): Modern Spectral Analysis, IEEE Press, New York, 1978. [This is a book of
reprints which presents a historical perspective of the evolution of spectral analysis.]
Gold, Bernard and Charles M. Rader: Digital Processing of Signals, McGraw-Hill, New York,
1969.
Hamming, R. W.: Digital Filters, 2d ed., Prentice-Hall, Englewood Cliffs, NJ, 1983.
Jong, M. T.: Methods of Discrete Signal and System Analysis, McGraw-Hill, New York, 1982.
Oetkin, G., T. W. Parks, and H. W. Schussler: "New results in the design of digital
interpolators", IEEE Trans. ASSP ASSp23: 301-309 (1975).
Oppenheim, Alan, V., and Ronald W. Schafer: Digital Signal Processing, Prentice-Hall,
Englewood Cliffs, NJ, 1975.
111
Papoulis, A.: The Fourier Integral and its Applications, McGraw-Hill, New York, 1962.
Papoulis, A.: Signal Analysis, McGraw-Hili, New York, 1977. [This book contains the
continuous-time results referred to in this chapter.)
Peled, A. and B. Liu: Digital Signal Processing: Theory, Design and Implementation. Wiley, New
York,1976.
PhiIlips, C. L. and'H. T, Nagle, Jr.: Digital Control Systems Analysis and Design, Prentice-Hall,
Englewood Cliffs, NJ, 1984.
Rabiner, Lawrence R. and Bernard Gold: Theory and Application of Digital Signal Processing,
Prentice-Hall, Englewood Cliffs, NJ, 1975.
Schwartz, Mischa; Information, Transmission, Modulation and Noise, McGraw-Hill, New York,
1980. [This book contains the continuous-time results referred to in this chapter.)
Schwartz, Mischa, and Leonard Shaw: Signal Processing: Discrete Spectral Analysis, Detection and
Estimation, McGraw-Hill, New York, 1975.
PROBLEMS
3.1. Given the following unit-sample response sequences compute the Fourier
transform and sketch the magnitude and phase functions.
(a) h( -1) = 1, h(l) = 1, h(n) =0, otherwise.
(b) h(O) = 1, h(l) = -1, hen) = 0, otherwise.
(c) h( -1) = 1, h(O) = -2, h(l) = 1, hen) = 0, otherwise.
3.2. Determine whether the following sequences have Fourier transforms and
compute the Fourier transform when it exists.
(a) hen) = 1, for n ~O, = 0, otherwise.
(b) h(n) = 1, 0:5 n :5 N, = 0, otherwise.
(c) hen) = 1, for all n.
(d) h(n)=1, for -N:5n:5N, =0, otherwise.
3.3. An important theorem of signal processing is Parseva/'s theorem, that can be
stated as
~
1
"~~ x(n)x*(n)=2n -n X(e1W)X*(e1W)dw
fn
Prove this theorem by substituting the definition of X(e 1W ) into the integral and
evaluating.
3.4. Show that a causal filter that has more than two nonzero elements in its
unit-sample response cannot have a phase response that is zero for all
frequencies.
3.S. Consider the sequence {g(n)} that is the time-reversed version of {hen)}, or
g(n)=h(-n)
for all n
(a) Let the H(e1W ) be the transfer function of the filter whose unit-sample
response is {hen)}. Compute the transfer function G(eiW ) in terms of H(e 1W ).
(b) Consider taking the output of the filter described by H(eiw ) and letting it be
the input to a second filter having the transfer function G(e iw). The total
transfer function is then G(e iW) H(e~'). What are the magnitude and phase
responses of this cascade combination?
3.6. For the following difference equations, determine the transfer function of the
filter and sketch the hlagnitude and phase responses.
(a) yen) = x(n) - x(n - N). Let N = 4.
(b) yen) = 2r cos(O) yen - 1) + r2y(n - 2) + x(n). Let 0 = n/4 and r = 0.9.
ill
3.7. For the following magnitude and phase functions, determine and sketch the
unit-sample response, the digital filter implementation and the difference
equation.
(a) IH(ei"')1 = [20 + 16 cos(2w WI2,
j
:S:~~;2 )
3.9. Some computer languages provide only the ATAN(Y/X) function, which
produces the radian angles in the range - : /2 :5 w :5 : /2. Describe a procedure
to determine the principal value of the arctangent over the range -::5 w < :,
from the result of the ATAN(Y/X) function and the values of X and Y.
3.10. If we wanted to generate the sequence
x(n) = cos(won/lO),
for all n
X(I) = COS(Ool)
for all 1
U(I) = COS(Ool)
then
if
V(I) = sin(Ool)
then
and
-
c5(0 + 0 0 )]
Determine and sketch the real and imaginary parts. of the spectra Us(jO) and
Vs(jO) for the continuous-time sampled functions for the following three sampling
periods:
(i) T. < : 100
(ii) 1;>>>:100
(iii) 1; = :100
3.U. SampUng. bandlimited signal. Let CA(I) have a spectrum CA(jO) that is nonzero
only over the frequency range 0 1 :5101:5 O 2 , as shown in Fig. P3.12. It can be
shown that cA(I) can be sampled at a rate that has to be greater than twice the
bandwidth, O 2 - 0 1 , rather than twice the highest frequency O2 , and yet have no
information loss. This can be demonstrated by doing the following steps.
(a) Let 1; = 2:1(0 2 - 0 1), Determine and sketch the periodically extended
spectrum of the time series.
f'1
---.. .uo,....----'o,....---:!!--~U-~---.;.~n
-fi2 -fi]
fi]
fi2
113
FIGURE P3-U
Bandpass spectrum of continuoustime signal.
(b) Sketch the magnitude response of the bandpass filter that retrieves the
desired signal spectrum.
(c) The impulse response response of this filter acts as the interpolation function.
Assume the magnitude response of part (b) and a zero phase response to find
the impulse response. Sketch this continuous-time function. Consider
whether this waveform is reasonable by considering its values at the sampling
instants.
COMPUTER PROJECTS
3.1. High frequency sequences
Objed. Observe the shape of sinusoidal sequences for frequencies in the range
:re/2 < (J) <:re, since they can often appear to be confusing.
Computer results. Use TESTO to obtain plots of either the sine or cosine sequence
for the following values of frequency: (J) = :re/2, 3:re/4, 7:re/8.
Aoalytic results. Determine and sketch the corresponding continuous-time sinusoid that connects the dots of the computer plot.
3.2. Computer evaluation of the Fourier transform
Objed. Write and verify the program that evaluates the Fourier transform of a
real-valued sequence at a specified number of frequency points in the range
Os (J) < 21&.
Analytic results. Determine and sketch the magnitude and phase spectra of the
sequences given below and compare them with the computer results. In all cases,
evaluate the sum in the Fourier transform.
Computer results. Write the subprogram
FT(H.NH.HR.HI.NFT)
where H is the input array containing the real-valued discrete-time sequence of
length NH, HR and HI are the output arrays of size NFT containing the real and
imaginary values of the Fourier transform, with the Kth element corresponding to
the frequency point (J)K = 21&(K - 1)/NFT, for 1 S K S NFT. For this project, let
NFT = 128, which will allow comparison with the fast Fourier transform in the
next chapter.
A clever way of obtaining the value of :re in the program is by using the
arctangent function: PI = 4. *ATAN(1.).
To compute the magnitude and phase spectral sequences, write
114
which converts the input real HR and imaginary HI arrays of the Ff of size NFf
into the output magnitude HMAG array and phase HPHS array. Use the
FORTRAN function ATAN2(XI, XR), where XI is the imaginary component
and XR is the real component, to calculate the principal value of the phase, i.e.,
in the range [-:re, :re). Undefined values of the phase, when HR(K) = HI(K) = 0,
should be set to zero.
To plot the magnitude and phase sequences, use the PLOTMR and
PLOTPR subroutines given in Appendix A. These plot the 65 elements of
HMAG and HPHS that correspond to the range 0!5 W !5 :re.
Compute the spectra for the following sequences.
(a) h(O) = t h(l) =~, h(2) = 1, h(3) = t h(4) = land h(n) = 0, otherwise.
(b) The unit-sample response of first-order recursive filter for the following
values of a: 0.8, 0.95, -0.8, and -0.95 (compute first 128 elements).
3.3. Becoming familiar with the phase spectrum
Object. Illustrate the jumps in the phase response curves.
Analytic results. Determine and sketch the phase spectra of the sequences given
below and compare them with the computer results. In all cases, evaluate the sum
in the Fourier transform. Indicate the phase jump location and type on "the
sketches and computer plots.
Computer project. Use the programs Ff and MAGPHS written in Project 3.2 to
compute the phase and plot with the subroutine PLOTPR given in Appendix A.
Use NFf = 128.
(a) Jumps of 2:rc in the phase spectrum. Compute the phase spectrum of the
delayed unit-sample sequence {d(n - k)} for k = 2. Repeat for k = 3 and
k = 10. Sketch the linear phase functions on the plots.
(b) Jumps of :re in the phase spectrum. Compute the phase spectrum of the
following sequence: h(O) = h(l) = h(2) = 1, and h(n) = 0, otherwise. /
(c) Both jumps of :re and 2:re. Compute the phase spectrum for the following
sequence: h(n) = 1 for 1 !5 n !5 5, and h(n) = 0, otherwise. Indicate the causes
'Of the jumps.
3.4. Demonstration of aliasing
Object. Demonstrate the aliasing phenomenon both analytically and numerically.
Analytic results. Do Problem 3.11 and compare the results with those produced
by the computer.
Computer results. For this project use the TESTO.FOR program in Appendix A
to generate both the sine and cosine sequences. Rather than varying the sampling
period with respect to the frequency of the sinusoid, we will keep the sampling
period constant, equal to 1, and vary the frequency. Demonstrate the aliasing
effect by plotting the time-domain sequences which result when the frequency 0 0
is varied to correspond to the three cases in Problem 3.11.
3.S. Frequency domain interpretation of interpolating sequences
Object. Explore the frequency-domain behavior of two discrete-time interpolation
functions.
"
Consider the sequence
v(n) = cos( won)
115
V(e JW )
---O~--~W~o--------------------~n--+W
X(e JW )
o
with
Cl.Io=
IT
The idea is to determine the values of {x(n)} that were zeroed, by employing
interpolation functions as was done in ProJect 2.5_
The spectra of the two sequences, denoted by V(ei"') and X(eiOJ ) are shown
in Fig_ Proj. 3.5. They are related by
~
X(eIOJ ) =
2:
V(ei(OJ+kn-
k=-oo
for0:5n:51
otherwise
First-order interpolator, where
0.5
1.0
ht(n) =
~.5
forn=-1
forn=O
forn=1
otherwise
116
(a) Determine the magnitude responses IHo(eiw)1 and IH1(e jW )I. Sketch both
responses on the same graph for 0:5 W :5 n.
(b) Let {yo(n)} and {Yl(n)} be the outputs of the zero-order and first-order
interpolators, respectively, when {x(n)} is the input. Compute the magnitude
spectra IYo(eiw)1 and 1y'(e'W)I. Sketch both spectra on the same graph.
Computer results. The interpolation cap be implemented as a nonrecursive filter:
Computer results
(a) Compute and plot the magnitude spectra of the two 32-sample sequences (use
NFf = 128). Use PLOTMR to plot only the first 65 points. Indicate the
location of the two FSK frequency values on each magnitude spectrum plot.
117
(b) Implement the two filters using the NONREC subprogram. Compute and
plot the magnitude response of the two filters (use NFl' = 128). Compare
these to part a.
(c) Generate and plot the four discrete-time sequences that are obtained by
passing each of the 32-bit sequences into each of the two filters.
(d) Generate and plot the discrete-time output sequence for each filter when the
input is the FSK sequence corresponding to bit pattern 010. Based on these
output patterns, describe a simple procedure to determine which binary value
was transmitted.
CHAPTER
.4
THE DISCRETE
FOURIER
TRANSFORM
4.1 INTRODUCl10N
The discrete Fourier transform (DFr) sequence, denoted by {H(k)}, allows us
to evaluate the Fourier transform H(e i "') on a digital computer. This complexvalued sequence is obtained by sampling one period of the Fourier transform
at a finite number of frequency points. The DFf is important for two reasons.
First, it allows us to determine the frequency content of a signal, that is, to
perform spectral analysis. The second application of the DFr is to perform
filtering operations in the frequency domain. After defining the DFr and the
inverse discrete Fourier transform (IDFf), we examine some of its properties
that are relevant for signal processing. The DFr can be applied directly to
causal, finite-duration sequences. Difficulties arise, however, when we try to
apply it to noncausal or infinite-duration sequences. These difficulties are
examined and solutions are suggested. The. fast Fourier transform (FFr)
algorithm is presented as an efficient computational procedure for evaluating
the DFr. Its efficiency is the main reason much current signal processing is
performed in the frequency domain. The FFr algorithm is described in both an
intuitive and analytical form using the decimation-in-time approach.
us
119
(4.1)
forOsksN-1
(4.2)
H(el"')
h(n)
/~.'
21r(J)
tbysamPling
H(k)
h{n)
III 1 , , I III.
-1
0 1 2
N-IN
FIGURE 4-1
A periodic extension of a time sequence results when a spectrum is sampled. Case for N
samples of spectrum over 0 S w < 2.n-. Bracket indicates Npoint DFr sequence.
=8
120
hen) =
hen + mN)
(4.3)
m=-oo
The sequence {hen)} is called the periodic extension of {hen)}. The number of
sample points in one period of the spectrum N is also equal to the period of
{hen)}.
The importance of this result is apparent when we employ the DFf for
signal processing and filtering in the frequency domain, for it is {hen)} that is
the corresponding sequence that is being used in the time domain. This chapter
describes the implications and pitfalls that accompany this result.
We are free to choose the value of N, the number of samples of H(eio
over O::s: co < 2.1t'. Since N is also the period of {hen)}, we must be careful not
to choose N too small. We now illustrate the considerations involved in
choosing the value of N. Let {hen)} be a causal finite-duration sequence
containing M samples. Infinite-duration and noncausal sequences are discussed
later. As shown in Fig. 4.2, if M ::s: N, then
hen) =
{~(n)
forO::s:n::S:M-l
for M::S:n::s:N-l
(4.4)
Two points are noteworthy about this result when M ::s: N. The first is that
the finite-duration sequence h (n), for O::s: n ::s: M - 1, can be recovered
uniquely from the first period of {hen)}. The second point is that the excess
number of points in one period of {h(n)}, or those for kM::s: n ::s:
keN -1) for any integer k, are equal to zero.
{h(n)} (M = 5)
..... rIIr
-10-1-2345
000
{h(n)} (N=5)
-1 0 1 2 3 4 5
{h(n)} (N=8)
{ii(n)}
4 567,8
(N = 4)
I I I I
1 1 11I 1I I I I 1 I 1
n
FIGURE 4-2
Relationship of duration of sequence M and number of sample
points in spectrum N. When N <
M, a time-aliasing elIect occurs.
Underbar indicates sequence produced by inverse OFf.
121
shown in Fig. 4.2. This overlap results in an error when we try to retrieve
{h(n)} from the first period of {h(n)}. In this case, time-aliasing is said to
occur. To prevent time-aliasing, we must sample H(ejOO) over 0:5 OJ < 23f at
least as many times as there are elements in {h(n)}, or N? M times. Clearly,
this poses a difficulty when trying to apply this result to infinite-duration
sequences. These problems will be considered below.
=..!.
N
H(k) ej'br1cnIN
(4.5)
k=-oo
2:
(4.7)
To determine the values of H(k), for 0 s k:5 N -1, we multiply both sides of
Eq. (4.7) by e-i'brnrIN and sum over OSn:5N -1, to get
2: h(n)~-i27rnrIN=_1 2: 2: H(k)ei27rnkIN
N-l
n~
N-l [N-l
Nn~
k~
e-j'brnrIN
(4.8)
Changing the order of summations and noting that R(k) is not a function of n,
we get
(4.9)
The sum in the square brackets can be evaluated by applying the finite
2:
ncO
1 _ ei2Jr(k-r)
ei2Jrn(k-r)/N = -~.:---.,-;---,-=
J2Jr
1- e
(4.10)
(k-r)/N
Since (k - r) takes on only integer values, the numerator term is zero for all
values of k and r. However, for k = r + mN, where m is an integer, the
denominator is also zero. In this case, each term in the sum is equal to 1, and
the sum evaluates to N, or
2:
N-l
ei2Jrn(k-r)lN =
{N
0
n-O
for k=r+mN
otherwise
(4.11)
Since k lies in the range from zero to N -1 in Eq. (4.9), we can apply this
result for k = r, or for m = O. This results in the desired solution for R(r) given
by
N-l
R(r) =
2: hen) e-
j2JrnrIN
for OSrsN-l
(4.12)
n=O
H(ej01)
= 2:
,,-0
hen) e- j01n
(4.13)
H(ej01) =
2:
hen) e- j01n
(4.14)
,,=0
Sampling H(ej01) at N equally spaced points over 0 s co < 2.7r produces the
sequence
N-l
2:
h(n) e- j2:rrknIN
Os k s N - 1
(4.15)
n=O
Since the number of sample points N is equal to the number of elements in the
original discrete-time sequence, the first N samples of {hen)} are equal to
{hen)}, or hen) = hen), for OSn sN i-l. Only the first N values of {hen)}
are needed in the sum in Eq. (4.12). Comparing (4.15) with (4.12), we note
that H(k) = H(k), for 0 s k s N -1. Applying this r.csult to (4.7), we get
1 N-l
h(n) = - 2: H(k) e j2:rr"kIN
for OSnsN-1
(4.16)
N k=O
123
H(k)
=L
h(n) e-i2mtkIN
for OsksN-1
(4.17)
n=O
for OSnsN-1
(4.18)
k=O
Equations (4.17) and (4.18) form the basis for the computer algorithms that
evaluate the Off, and are directly applicable to causal, finite-duration
sequences. The number N of frequency points in one period of the Off is
equal to the number of elements in the discrete-time sequence. To obtain more
points in the Off sequence, we can always increase the duration of {h(n)} by
adding additional zero-valued elements. The procedure is called padding with
zeros. These zero-valued elements contribute nothing to the sum in Eq. (4.17),
but act to decrease the frequency spacing ei2nkIN. We will encounter this
padding operation in the computation of the convolution below.
Example 4.1. DFf of the caU$81 3-sample averager. Let
h(n)={~
To compute the N-point DFf, where
for Osk sN -1, is given by
N-l
H(k)
=L
for OSn s2
otherwise
N~3,
h(n) e-i2nnkIN = L
l e-i2nnkIN
+ e-i2KkIN + e-j4Jrk/~
= l e-i2KkIN(ei2nkIN + 1 + e-i2nkIN)
= l(1
e-J2nklN
1 + 2cos(21tk/N)
3
Comparing this result with Example 3.9, we see that the magnitude and phase
values of {H(k)} are samples of H(ei "') at N points equally spaced over
Os w < 21t. The DFf sequences for different values of N are shown in Fig. 4.3.
The Off is specified over the range 0 s (J) < 23r, rather than -3r s (J) <
the range used for the Fourier transform in the previous chapter. This is the
accepted convention for all the Off algorithms. It is convenient for interpreting the results of computer processing, since the de value, i.e. (J) = 0, then
corresponds to the first element of the Off sequence.
3r,
124
{h(n)l
~III. "1.111. .
01234
l........--....
IH(k)1
......
,. ,.
",
.-
/
I
(h(n)}
III
012
;.
IH(e"') I
f\cL.
11
211' w
Arg[H(eJ"')]
:~""'~"~
IN=81
{ h(n)}
IH(k)1
012345678
I
-11
III I Ii
012
3 4
5 6 7
;.
Arg[H(k)]
{121
I
5
1
I6
-11
FIGURE 4-3
Relationship of Fourier transform and discrete Fourier transform for a causal sequence. Cases for
N = 4 and N.,. 8 are shown.
(h(n)
125
(M=5)
... 11111 .
-3-2-10 1 23
{ii(n)l (N=5)
IIIIIIIIII!1!!I1I!!1111!! ~
,012345,
{ii(n)l (N=8)
(N =4)
,0 I 2 3 4 5 6 7,8
IIdlldIIIIIId"rlIlI11,
,0 1 2 3 ,
FIGURE 4-4
Relationship of duration of noncasual sequence M and number of sample points in spectrum N.
The discrete-time sequence is conventionally taken as the first N samples of the inverse OFf
When N < M, a time-aliasing effect occurs.
hNc{n
+ mN)
(4.19)
".=_00
as shown in Fig. 4.4. However, the conventional definition of the IDFf given
by Eq. (4.18) indicates that the first N samples of the periodic extension are
obtained, or h(n), for 0 ~ n ~ N - 1, when the IDFf is evaluated. The
noncausal part of {hNc{n)} will then appear at the end of the reSUlting
sequence, being the noncausal part of the second period of the periodic
extension, as shown in Fig. 4.4 for N = 8.
Eumple 4.2. 11ae OFf of DODcausal3-S8Dlple avenger. Let
h(n)={~.
for -l:Sn:S 1
otherwise
In the definition of the OFT pair, the time sequence used in the computation is
equal to h(n), for O:s n :s N - 1. Hence, as shown in Fig. 4.5, the sequence that
must be used for evaluating an N-point OFT is
h(n)= {~
for n = 0, 1, N - 1
otherwise
126
{/lIn):
IN=41
ILIILIII
IH(k)1
,,
,,
2 3 ,4
10
{h(n)}
.II 1.
-1 0 1
IH(e'W)1
AcRH{~:[
FIGURE 4-S
Relationship of Fourier transform and discrete Fourier transform for a noncausal sequence.
Cases for N = 4 and N = 8 are shown.
Then
H(k) = j(l + e-ibrklN + e- i2(N-I)",kIN)
Since adding 2Jr to the exponent of the complex exponential does not change its
value, we find
e-1br(N-I)1rkIN
= e- j (2(N-I),..kIN+2J1cNINJ = efb<klN
127
and
H(k) =
hI + e- i2
"kIN
= I
+ eJ2"kIN)
+ 2 cos(2Jlk / N)
3
These are samples of the Fourier transform of the 3-sample averager, as shown in
Fig. 4.5.
We would have obtained the same result if we allowed the DFT sum to
range over negative index values, to include the h( -1) term. But, since the
standard computer algorithms that evaluate the DFT are defined in tenus of
non-negative index values, these equivalent tenus from the next period of
{h(n)} are included in the sum. This convention is often a source of confusion
when interpreting the results of the DFT and IDFT computations.
INFINITE-DURATION SEQUENCES. For infinite-duration sequences, there is
always some amount of time-aliasing which results when the DFT relationships
are applied. In practice, the value of N is usually chosen to be large enough to
make this error negligible for a particular application. We will consider the
effects of choosing the proper value of N in the chapter on IIR filter design.
Example 4.3. DFf of an infinite-dw'lltion sequence. Let us consider the
familiar infinite-duration unit-sample response of the first-order recursive filter,
given by
for all n
g(n) = a"u(n)
for 0 s k s N-l
N-l
L
1
h(n)=N k=O
eJz"kniN
[ L~
L [N-l
Le
= -1 ~ a'
N ,-0
a'e- j2"k"N
forOsnsN-l
,-0
I2"k(n-,)IN
k-O
+ mN, where m is
128
{h(rz)}
.111111
J t
-I 0 1 2 3 4 5
(~ ~) I[1111111 [1111111111
-I I 0 1 2 3 I 4 5
FIGURE 4-6
Time-aliasing effect for an infinite-duration sequence. Underbar indicates sequence
produced by inverse DFT when N = 4.
h(n) =
L:
,=0
for
O~n ~N-l
r=n+mN
For r to be greater than zero, m must also be greater than or equal to O. Summing
over the infinite number of values of m, we have
for
O~n ~N-l
h(n) =
L:
an+mNu(n
+ mN)
for
O~n ~N-l
for
O~n ~N-l
129
TABLE 4.1
2:
H(k) =
hen) e- J2 J<knIN
for O:s k :S N - I
(DFT)
for O:Sn:sN-I
(IDFT)
"=0
and
I
h(n)=-
N-j
2:
H(k)e J2 J<knIN
k-O
2. Periodic extension:
00
2:
hen) =
hen
+ mN)
+ Ht(k)
then
{yen)} = {hen)}
* {x(n)}
A linear convolution of {hen)} and {x(n)} results when Ny-point DFT sequences are computed
for {hen)} and {x(n)}, where Ny is the duration of {yen)}. Otherwise, a circular convolution of
{hen)} and {x(n)} results.
8. Fourier transform of the product of two sequences:
if
{yen)} = {h(n)x(n)}
then
Y(k) = H(k)@X(k)
(circular convolution)
9. For the real-valued sequence hen), for O:Sn:sN -I:
N-j
HR(k) =
2:
hen) cos(2:rckn/N),
for O:sk:sN-l
n=O
N-j
HI(k) = -
2: hen) sin(2:rckn/N)
for 0 :S k
:S N
- 1
n=O
(a)
(b)
(c)
(d)
(e)
(f)
(g)
Complex-conjugate symmetry:
H(k) = H(N - k)
Real component is even function:
HR(k) = HR(N - k)
Imaginary component odd function:
HI(k) = -HI(N - k)
Magnitude function is even function:
IH(k)1 = IH(N - k)1
Phase function is odd function:
Arg[H(k)] = -Arg[H(N - k)]
If {hen)} = {h(-n)} (even sequence), then H(k) is purely real.
If {hen)} = {-h( -n)} (odd sequence), then H(k) is purely imaginary.
130
y(n) =
2: h(k)x(n -k)
for all n
(4.20)
k=O
yen) =
2:
h(k)X(n - k)
forO:Sn:sN-l
(4.21)
k-O
(4.22)
forn=O
for n = 1
otherwise
0.5
forn=O
forn=l
otherwise
and
h(n)= { ~
= {x(n)} * {h(n)}
{x(n)}
I'r:
:" r.
o1
-1
{h(n)}
(a)
-1 0 1 2
(y(n)}
r~
O~5 I .
r:
... -1 0 1 2 ...
{iz{n) }
ddddd
Idddd,
~~I IIIIIIII
~2
{h2 (n)}
(b)
~2
{Y2(n)}
131
...
~2
(c)
FIGURE 4-7
(a) Linear convolution of two finite-duration sequences. (b) Circular convolution result when
2-point DFf sequences are used for the sequences shown in (a). The minimum size of the DFf in
this example is 3. (c) Circular convolution result when 3-point DFf sequences are used for the
sequences shown in (a).
132
LiDear convolution. By performing the linear convolution with the finiteduration sequences in the time domain, we get the desired {y(n)} as shown in
Fig.4.7(a).
Circular convolution. Since both {x(n)} and {h(n)} have durations of two
samples, it may be reasonable (but wrong!) to take two 2-point DFfs. Let us
consider the consequences of doing this in both the frequency and time domains.
Frequency domain. Performing the 2-point DFfs we get
and
Multiplying {X(k)} by {H(k)} to compute {Y(k)} and evaluating the product for
k =0,1, we get Y(O) = 2.25 and Y(I) = -0.25.
Applying the inverse DFf, we get the sequence y(O) = 1 and y(1) = 1.25,
which is not the same as the desired linear convolution result. This sequence is
shown in Fig. 4.7(b).
Time domain. Since we computed 2-point DFfs, the corresponding
periodic convolution was between periodic sequences {.i2(n)} and {h2(n)} having
a period of two samples, which were obtained from {x(n)} and {h(n)} by
periodic extension. Performing the periodic convolution, we get
:MO) =.i2(0) h 2(0) + .i2(1) h 2( -1) = 1
.M1) = 2(0) h2(1) + 2(1) h2 (0) = 1.25
.M2) = 2(0) h2(2) + 2(1) h2(1) = 1
The sequence tMn)} is periodic with period 2 and the first period has the same
values as those produced by the 2-point IDFf above.
1
00.5
forn=O
for n = 1
otherwise
133
and
0.5
h(n)= { ~
for n =0
forn=1
otherwise
and
and
and
H(O) = 1.5
= H(k) X(k)
for 0:sk:s2
we get
Y(O) =2.25
Y(I) = 0.5 + 1.25 e- j2><13 + 0.5 e- j4,.13
Y(2) = 0.5 + 1.25 e- iU13 + 0.5 e- jlln13
y(l) = 1.25
and
y(2) = 0.5
These are the same values as the linear convolution result obtained in the
previous eJfample.
Time dolUiD. Since we have calculated 3-point DFrs, the result should be
the same as the periodic convolution between {i3(n)} and {h3(n)}. The values of
the result for different values of n are equal to
Y3(0) = i3(0) h3(0)
The sequence {Y3(n)} is periodic with period 3 and the first period has the same
values as those produced by the 3-point IDFr, as shown in Fig. 4.7(c).
134
=L
L [hR(n) sin(2.7rknIN) -
-j
hI(n) cos(2.n-knIN)
(4.24)
n=O
The DFf sequence can also be expressed explicitly in terms of its real and
imaginary parts as
H(k)=HR(k)+jHI(k)
forOsksN-I
(4.25)
1 N-l
hen) =H(k) ei2n:nkIN
N k-O
1 N-l
for O:sn:sN-I
+L
N
(4.26)
k=O
Except for the difference in the signs of the exponents and the II N
scaling factor in the inverse, the same operations are performed in both
transforms. Both the Off and IOFf computations require 4N real-valued
multiplications per point, and 4N2 such operations are necessary to compute
the N-point transform. To obtain a simple, but still reasonably accurate,
estimate of the operation count, we ignore the observation that the first real
and imaginary terms are multiplications by 1 and 0 respectively, and hence, not
true multiplications. We then find that for large values of N, the number 4N~,
is a good approximation for the required number of real-valued multiplications
to compute an N -point discrete Fourier transform or its inverse. For
complex-valued sequences, the symmetries of the real and imaginary components, which are valid for real-valued sequences, no longer hold.
In the next section we describe the implementation of a program to
135
directly evaluate the Off from (4.24) and the 10FT from (4.26). Because of
the similarity in the operations for computing the Off and IOFf, if an
algorithm were found to perform the evaluation in an efficient manner, the
benefits would be applicable to both the transform and its inverse. Later in this
chapter, we will consider an alternate algorithm to the direct evaluation, called
the fast Fourier transform (FFT). This algorithm requires N to be a power of 2
and takes into account the periodicity of the Off to reduce the number of
multiplications from 4N1 to 4N log2 N.
where
NLOG2
HR
HI
NTYPE
(integer input) is the log to the base 2 of the size of the arrays
(real input and output array) is the array of real values
(real input and output array) is the array of imaginary values
(integer input) is the operation to be performed: NTYPE = 1
causes the Off to be computed, NTYPE = -1 produces the
10FT
To compute the Off, the HR and HI arrays contain the real and
imaginary parts of the discrete-time sequence, padded with zeros if necessary.
If the sequence is real, all the elements of HI should be set to zero. After the
routine has been accomplished, HR and HI contain the real and imaginary
parts of the Off sequence. To compute the 10FT, the HR and m arrays
contain the real and imaginary parts of the OFT before the call. After
execution, HR and HI contain the real and imaginary parts of the discrete-time
136
for 1 sKsNOFf
(4.27)
TR(K) =
M=l
137
transform (FFf) algorithm that produces exactly the same results in N logz N
operations. For certain applications, however, the FFf may not be the best
way to proceed. For example, som~ applications require only a small number
of frequency points, say at the M frequencies (01' (Oz, , and (OM, where
M N, rather than at the full set of N frequency values (Ok = 2nklN, for
O::s; k ::5 N - 1. A second example is when the M frequency points are
, not
harmonically related, but rather an arbitrary collection of interesting frequencies. In this case the FFf will, in general, not evaluate the spectruin at
these exact frequency values, but only at the harmonic frequencies that
approximate these.
In this section, we discuss programming and implementation procedures
to improve the speed of the N Z computations that are required for the N -point
DFf. These programming techniques save computation time by storing the
sine and cosine coefficients in a table and accessing the discrete-time array
values efficiently. The discussion below illustrates the general principle of
computer processing of a memory / speed tradeoff, that is, a given computation
can be done more quickly if more memory is allowed.
To illustrate the various points below, let us consider computing the OFf
of a real-valued sequence x(n), for 0::5 n ::5 N - 1. The ideas discussed below
can be extended to complex-valued sequences in a straightforward way. The
kth value of the OFf sequence is given by
N-l
X(k)
= L x(n) e-j2JrnkIN
N-l
N-l
L x(n) sin(2nkn/N)
n=O
\
~
(4.29)
+...
One way to reduce the computation ti~Je is to note that successive values
of the complex-exponential sequence differ by a constant factor e-jZ1rkIN, or
e- j21rk (n+l)/N
= e-j21rknIN e-j21rkIN
(4.30)
Hence, for each frequency point k, successive values of the sine and cosine
coefficients can be determined by evaluating the constant factor
e-j21rkIN
= cos(2nk/N) -
j sin(2nk/N)
(4.31)
138
139
CTAB VALUES
NPNTR
(NCPNTR)
3N
4
+1
STAB VALUES
t
NPNTR
FIGURE 4-8
Cosine (crAB) and sine (STAB)
coefficent values for evaluating
N-point DFf. Case for N = 32 is
shown.
Pointers
NPNTR,
NCPNTR and NSPNTR indicate
the coefficient values that are
needed for a particular computation step.
h(n)=cos(2nkn/N)
forn~O
(4.33)
This filter is not stable by our definition, but we will use it for only a finite
number of time points, to insure that the output does not become infinite.
Such a filter can be obtained from Example 2.13 by letting r = 1. The filter
140
structure is shown in Fig. 4.9(a). If the input to this filter is the real-valued
sequence x(n), for O:s n :s N - 1, the output value at time n = N can be
determined by the convolution equation and is given by
N-l
yeN)
x(m) heN - m)
m=O
N-l
(4.34)
m=O
(a)
x(n) <>-_._--------3>(
} - - - - - - - - . . . . . - - y ( N ) = XR(k)
x(n)
}--------~---y'(N)
(b)
=-XI(k)
(c)
x(n)
FIGURE 4-9
Filter structures for evaluating the DFT of a sequence x(n), for O:s n :s N - 1, with the Goertzel
algorithm. a) yeN) equals the real part of X(k). b) y'(N) equals the negative imaginary part of
X(k). c) Real and Imagmary parts computed simultaneously at n = N.
141
Since
cos[2Jlk(N - m)/N]
we can write
N-J
y(N) =
2:
x(m) cos(2JTkm/N)
(4.35)
m=O
Comparing this equation with the definition of the OFT, we find that by
putting the finite-duration sequence x(n), for O:Sn:sN -1, through the filter,
the output at time n = N is equal to the real part of the OFT element X(k).
This result is true when the filter has a zero initial condition. In a similar
manner, consider a second filter whose unit-sample response is given by
h'(n)=sin(2JTkn/N)
forn~O
(4.36)
This filter is shown in Fig. 4.9(b) and discussed in Example 5.4. If {x(n)} is
applied to this filter, the output at time N is given by
N-J
y'(N) =
2:
x(m) sin(2JTkm/N)
(4.37)
m=O
Comparing this equation with the definition of the OFT, we find that by
putting the finite-duration sequence x(n), for O:s n :s N - 1, through the filter,
the output at time n = N is equal to the negative imaginary part of the OFT
element, or -Xj(k).
These two filters are combined in Fig. 4.9(c). By changing the recursive
and nonrecursive parts and including the sequence {w(n)} that is common to
both filters, we find that the kth OFT element is equal to
X(k)
= w(N) -
(4.38)
142
H(k)
2:
n=O
N-l
hen) cos(2nnk/N) - j
2:
n=O
hen) sin(2nnk/N)
for 0 ::S k
::S
N- 1
(4.39)
To compute this N-point DFf sequence requires 2N2 real multiplications. The
set of values for the sine and cosine coefficients required for evaluating each
H(k) term are shown in Fig. 4.10 for N = 8. The coefficients for computing the
terms k and (N /2) + k, for O::s k ::S (N /2) - 1, exhibit a curious similarity. The
coefficients for even-valued n are the same, while those for odd-valued indices
have the same magnitude, but are of opposite sign. To exploit this similarity,
we break up the original sequence {h(n)} into two subsequences: {hE(n)},
containing the elements indexed by the even-values of n; and {ho(n)},
containing the elements indexed by the odd-values. These sets of coefficients
are shown in Fig. 4.1l.
Two features of the even-indexed coefficient set are noteworthy. First, the
set of coefficients for frequency points k and (N /2) + k, for O::s k::s (N /2) - 1,
are identical. Hence, their contribution to the terms H(k) and H(N /2 + k) will
be the same. Only one of these terms need be computed, the other being
obtained for free. The second feature is that this set of coefficient values is
exactly that required for computing the N/2-point DFf of {hE(n)}. To
compute this N /2-point DFf, we need to perform 2(N /2)2 = N 2 /2 real
multiplications. A similar result, except for a sign inversion in the coefficients,
occurs for the odd-indexed sequence. To compute the N /2-point transforms
for the even and odd-indexed sequences requires N 2 multiplications, which is
smaller than the original 2N2 Hence, splitting, or decimating, the sequence
143
cosme coefficients:
tIIIIIIL
2
k=O
sine coefficients:
I r
k=!
I t
:=21
I
1
k=3
I
J
1
1
1
r
1
I
k=4
.n
1 2 3 4 5 6
1
k=5
k=6
r r
r
1
k=7
1
n
7
1
t
I r J
ftGURE ....10
The set of cosine and sine coefficient values for evaluating the kth element of an 8-point DFf
sequence.
144
EVEN-INDEX
ODD-INDEX
t0 I2 I4 1
t0 I2 I L tI I3 I5
6
4
k=O
2 4 6
k=l
k=O
k=4
..
IJ
t
k=5
k~ k~
1 1 1 In
I I
k=! I I
t t
k=)
11 11
k=2
k=3
I 3 5
5 7
k~ k~ A
."1 r.
7k=4
n
7
I T
k=6
~
ks-r
11 1 I
rr
FiGURE 4-11
The set of cosine and sine coefficient values for evaluating the kth element of an 8-point DFf
sequence broken up into the even-valued indexed and odd-valued indexed sub-sequences.
ODD-INDEX
EVENINDEX
III
2
.11
k=l
k=2
k=3
t1
III
3
.11
k=O
145
~
1
.-~
FIGURE 4-12
The set of cosine and sine coefficient values for
evaluating the kth element of a 4-point DFI'
sequence broken up into the even-valued indexed and odd-valued indexed sub-sequenccs.
pedormed. At this level, however, all the coefficients are either 0 or 1, and
do not require a multiplication. This can be observed from Eq. (4.39) by
letting N = 2 and setting k = 0 or 1. Hence, by merely adding and subtracting
elements at this lowest possible level of decimation, we can compute 2-point
DFfs. Since the original sequence had N = 2NLOG2 elements, it could be
decimated into subsequences NLOG2 - 1 times, and there are 2NLOG2- 1
2-point DFfs. This procedure is called the decimation-in-time FFI'
algorithm, since the discrete-time samples are continuously split into two
groups. There is also a decimation-in-frequency FFr algorithm. It will not be
covered here, but can be found in the references.
Having described the decimation operation and indicating why there is a
net reduction in the number of computations, we now describe the analysis to
indicate the procedure of combining the N /2-point DFfs to form an N-point
DFf and determine the operation count.
146
L hen) e-j2nnkIN
hen) e-j2#nkIN +
"even
II
(4.40)
odd
H(k) =
h(2r) e-j41frlcIN +
(N~-l
r-O
(N~-l
r-O
(N~-l
~
h(2r + 1) e-j2nrkl(NI2)
(4.41)
,-0
Both sums appear in the form of an N/2-point OFT. Let us define {hE(n)} as
the even-valued index sequence and {ho(n)} as the odd-valued and {HE(k)}
and {Ho(k)} as being, respectively, the OFT of {hE(n)} and {ho(n)}. Since
{HE(k)} and {Ho(k)} are the OFTs of N/2-point sequences, they are periodic
in k with period N /2. These two will be combined to form the N-point OFT
{H(k)} by
~
,~O
=HE(k -
;B---o
h(O)~
147
HE.E(O)
h(Nj2) r.C.----~
"'>----:Ol
HE E(1)
FIGURE 4-13
The butterfly pattern (G = 1).
for k = 0, 1
(4.44)
and
This last operation is shown graphically in Fig. 4.13, and is called a butterfly
pattern. The steps for combining the DFfs of the decimated subsequences are
shown as a sequence of butterflies in Fig. 4.14 for N = 8.
h(O)
H(O)
h(4)
H(l)
h(2)
H(2)
11(6)
H(3)
hell
H(4)
h(5)
H(5)
h(3)
H(6)
h(7)
H(7)
-1
FIGURE 4-14
Decomposition of an N-point OFf into butterfly patterns. Case for N", 8 is shown.
148
TABLE 4.2
5
6
7
8
9
10
32
64
128
2S6
512
1024
DFT(W)
4096
16384
6S536
262144
1048576
4194304
J!'FI' (4 N IoIz N)
640
1536
3584
8192
18432
40960
149
TABLE 4.3
Rowuaber
DedmIII
0
1
2
3
4
5
/6
7
Biliary
DeclmaI
(000)
(001)
(010)
(011)
(100)
(101)
(110)
(111)
0
4
2
6
1
5
3
7
Decimal
(000)
. (100)
(OlO)
(110)
(100)
(101)
(011)
(111)
of length 2 are obtained. The index values on the left side of the
computation graph shown in Fig. 4.14 indicate an unusual ordering of the
input sequence. This ordering has an interesting interpretation, that can be
extended to arrays of any duration, when the index value is expressed as a
binary number. In Table 4.3, we list the number of the row in the computation
diagram and the index of the input sequence that occupies that row. Comparing
the binary representation of the row and index values, we note that the index
value appears as the reversed-bit order of the row number. This reversed-bit
transformation of the index values is valid for any size N-point DFf, where N
is a power of 2. This is commonly observed in decimation-in-time FFf
subroutines, in which the first step involves placing the input sequence values
into the appropriate row location. An algorithm to pedorm this bit reversal by
using the decimal index values is left as a problem for the student.
MEMORY REQUIREMENI'S. In the direct computation of the DFf using
X(k) =
N-l
2: x(n)
e-j2nnkIN
for O:sk:sN-1
(4.45)
n=O
all the values of x(n) are needed for each value of X(k). If the computation is
pedormed by sequentially computing the X(k) values, as in the DFf routine
described in Section 4.8, these spectral values must be stored in a temporary
buffer array. After the computations, the contents of this buffer are transferred
to the arrays passed in the argument of the subroutine. From the computation
diagram for the FFf shown in Fig. 4.14, the data flow is consistently directed
from left to right. This indicates that after the values of a particular column are
used, they are no longer needed in the computations. Hence, those memory
locations can be used for storing the results of future computations. If the
computations are pedormed column by column, the results can be stored at
the same memory locations, and no significant buffer memory is required. This
150
the OFT, a memory/speed tradeoff also exists for the FFT. As noted from the
computation diagram, there are only a finite number of coefficients needed to
evaluate the FFf. These coefficient values can be computed as they are
needed, directly from the function or recursively, as described previously, or
they can be pre-computed and stored in a look-up table. In this case the table
look-up procedure is more complicated than for the OFT, since the input
sequence values are in reversed-bit order. Many FFT decimation-in-time
subroutines exist in standard scientific subroutine packages. As a general rule,
the length of the program, in lines of code, and its memory requirements are
inversely related to the execution speed. That is, the longer programs operate
more quickly and the simple programs require more time. But any FFT
subroutine is much faster than the direct method of evaluating the OFT.
4.14 SUMMARY
In this chapter we have defined the discrete Fourier transform (DFT) as the
sequence obtained by sampling one period of the Fourier transform over
O!5 0 < 2.1t' at N frequency points, where N is an integer. The OFT was
shown to be the Fourier series expansion of the periodic extension of a
discrete-time sequence, obtained by repeating the original sequence with a
period of N samples. After defining the DFT and its inverse, the IDFT, we
examined some of its properties relevant to signal processing. The OFT
relations could be used without modification to achieve the desired results
when applied to causal, finite-duration sequences. For noncausal sequences,
the inverse OFT produces the causal part, followed by the noncausal part. For
infinite-duration sequences, an inevitable time-aliasing error occurs, whose
effect decreases as N is increased. When attempting to perform the convolution operation in the frequency domain with the OFT, the equivalent
time-domain operation is the circular convolution. The desired linear convolution result can be obtained by computing the OFT at a sufficiently large
151
number of frequency points. The fast Fourier transform (FFf) algorithm was
presented as an efficient computational procedure for evaluating the DFf. The
FFf algorithm was described in both an intuitive and analytical form using the
decimation-in-time approach. Some general remarks were made regarding the
implementation of the FFf algorithm.
FURTHER READING
Bergland, G. D.: "A guided tour of the fast Fourier transform," IEEE Spectrwn, 6: 41-52 (1969)
Blahut, R. E.: Fast Algorithms for Digital Signal Processing, Addison-Wesley, Reading, MA,
1984.
Braoewell, R. N.: The Fourier Transform and Its Applications, McGraw-Hill, New York, 1978.
Burrus, C. S., and T. W. Parks: DFT/FFT and Convolution Algorithms, Wiley-Interscienoe, New
York, 1985. [This book provides a description of the various algorithms to implement a
discrete Fourier transform. Program listings are given in FORTRAN and assembly
language for the Texas Instruments TMS32010 signal prooessing chip.]
Childers, D. G., (ed.): Modem Spectral Analysis, IEEE Press, New York, 1978. (This is a book of
reprints which presents a historical perspective of the evolution of spectral analysis.]
Cooley, J. W., and J. W. Tukey.: "An algorithm for the machine computation of complex Fourier
series," Math. Comp., 19: 297-301 (1965).
Elliott, D. F., and K. R. Rao.: Fast Transformations: Algorithms, Analysis and Applications,
Academic Press, New York, 1982.
Oppenheim, Alan V., and Ronald W. Schafer: Digital Signal Processing, Prentioe-Hall,
Englewood Cliffs, NJ, 1975.
Peled, A., and B. liu: Digital Sgnal processing: Theory, Design and Implementation. Wiley, New
York,1976.
Rabiner, Lawrenoe R., and Bernard Gold: Theory and Applicalion of Digital Signal Processing,
Prentioe-Hall, Englewood Cliffs, NJ, 1975.
Schwartz, Mischa and Leonard Shaw: Signal Processing: Discrete Spectral Analysis, Detection and
Estimation, McGraw-Hill, New York, 1975.
PROBLEMS
4.1. Evaluate and compare the 8-point DFf for the following sequences.
l
for -3sn s3
(a) x(n) = { 0
otherwise
forOSns6
(b) x(n) = {~
otherwise
4.2. V~rify the properties of the DFf relationship given in Table 4.1.
4.3. When discussing the Fourier transform, it was shown that an even discrete-time
sequence, or one for which h(n) =h( -n), has a Fourier transform that is
real-valued. Since the DFf sequence as produced by the computer algorithm can
have only positive index values, indicate the symmetry property of a discrete-time
sequence whose DFf sequence is real.
4.4. Let us consider the finite-duration sequence {x(n)}. It is common to process
sequences that are defined over index values that do not correspond to the range
Os n s N - 1 required for the DFf computations. In these cases, the {h(n)}
must be periodically extended to form {h(n)} , and the sequence h(n), for
Os n s N - 1 is processed to produce the desired results. Determine and sketch
152
the discrete-time sequence to be processed to find the 8-point OFf, when the
following sequences are given.
(a) x(n) = {OI
for n =-1
otherwise
3- ln l
for-3:S:n:s:3
(b) x(n)= { 0
otherwise
for -3:s: n :s: 3
(c) x(n) = 0
otherwise
4.5. Consider the sequence {x(n)} and its N-point OFf {X(k)} where N is an even
number.
(a) Show that if (z(n)} is an even sequence, then X(N /2) = O.
(b) Show that if {x(n)} is an odd sequence, then X(O) = o.
4.6. Compute the N-point OFf of each of the following sequences. Let N = 8 and
M=5.
for OSn:s:N-1
(a) x(n) = {~
otherwise
for O:s:n:s: M -1,
(b) x(n) = {~
otherwise
for n =0
(c) x(n) =
forn=N-1
forn=O
(d) x(n) =
forn=M,
4.7. The OFf sequence {H(k)} represents samples of the Fourier transform H(el"') at
equally-spaced frequency intervals, or
, {n
{_!
{_!
for Osk:s:N-1
4.8. Perform the linear convolution of the two sequences below in the time domain.
Compare with the result obtained by using the OFf relations.
h(n) =
{~
and
z(n) =
{~nl
for -I:s:n:s:I
otherwise
153
4.9. Show the symmetry properties of the DFf sequence by computing the 8-point
DFf of the real-valued sequence given by
for -1 Sn sl
otherwise
4.10. Computing the DFf of two real-valued sequences with one execution of the FFT
algorithm. The FFf algorithm can operate on a complex-valued sequence. When
transforming a real-valued sequence, the imaginary part is set to zero. We can
transform two real sequences' simultaneously by letting the real part of the
complex-valued input be set equal to one real sequence, and the imaginary part
equal to the second real sequence. The complex-valued output of the algorithm
must then be manipulated to achieve the desired result, consisting of the two
DFf sequences of the two real-valued input sequences.
Let xt(n), for OsnsN-l be a real-valued sequence having the DFf
sequence whose real and imaginary parts are given by Rt(k) and It(k), for
OsksN-1, or
N-t
Rt(k) =
L xt(n) cos(2:rckn/N)
forOsksN-l
"-0
and
N-t
It(k) = -
L xt(n) sin(2:rckn/N)
for OsksN-1
forOsnsN-l
(a) Find the real and imaginary parts of the DFf of {y(n)}, denoted by R,.(k)
and Iy(k) in terms of Rt(k), R 2 (k), I\(k) and 12(k).
(b) From the above relationships, find the inverse relationship to obtain R\(k),
R2(k), I\(k) and I2(k), to produce the desired DFf sequences.
4.1l. Determine the reversed-bit order of the input sequence to compute a 16-point
DFf with the FFf algorithm.
4.12. Develop the reversed-bit reordering algorithm based on the decimal number of
the sequence index. Demonstrate your algorithm for 8-point DFf and 16-point
DFf calculations.
COMPUTER PROJECfS
4.1. 'Program to evaluate the DFf
Object. Write a subroutine that evaluates the
rete Fourier transform and
compare the results with the Fast Fourier tran.. m (FFf) algorithm given in
Appendix A. It is not necessary to be familiar wi ne FFf algorithm to perform
this project. We consider the FFf to be just like any other packaged program and
simply want to verify that it works correctly.
154
as described in the text. The call to the FFf has the identical arguments as above,
given by
FFT ( NLOG2, HR, HI, NTYPE).
forO:5n:5NDFT-l.
Use the DFT subroutine with NDFT = 64,128,256 and 512 to determine the time
required for each array size. Do not plot or print your results. Use the TIME
function on the computer. Your dimension statements should allow for 512element arrays.
Construct a table of the programming times and compare with those
required by the FFT subroutine to compute the same transforms.
Remark. The results produced by DFT and FFT should be identical, but the
speed of the FFf is much greater. Hence, we will use only the FFf subroutine for
the remainder of the projects in the course.
4.1. DFf of &nite-duration sinusoidal sequences
Object. Investigate the effect on the DFT when varying the period of a
discrete-time sinusoidal sequence and the length of the sequence.
Computer results. For the problems below, let NLOG2 = 7 (NDFT = 128) and plot
the first 65 points of the magnitude sequence corresponding to 0:5 W :5 n with
PLOTMR. Generate the discrete-time sequence
x(n) = {COOS( won)
for 0:5 n :5 K -1
for K:5n:5NDFT-1,
15S
{y(n)}
= {h(n)} * {x(n)}
where
={~
for OSn s5
otherwise
h(n)={~
for OSn s5
otherwise
x(n)
and
Computer results
(1) Performing the 11netU" convolution with the OFf. List the steps in performing
the linear convolution by using the smallest possible number of points NDFf in
the DFf, that is still a power of 2. Plot the following by using PLOT:
(a) the original time sequence {x(n)} (plot NDFf points),
(b) the magnitude spectrum of (a),
(c) the magnitude spectrum of the product of the two DFf sequences,
(d) the inverse DFf sequence and compare with {y(n)}.
(2) Performing the dmdar convolution with the OFf. Demonstrate the timealiasing phenomenon produced by choosing NDFf too small. Produce the plots
listed in part (1). Explain the results on the plots.
4.4. laterpolating the OFf by padding the time-domain sequence with zeros
Object. Compute the DFf at a denser set of points in the frequency domain by
padding the time-domain sequence with zeros.
Computer results Let
x(n) = r" cos(01on)
forOSns63
with r = 0.9 and 010 = 9fr/64. Compute the 64-point DFf and plot the 33 points of
the magnitude spectrum corresponding to 0 s 01 S fr. Use the PLOT subroutine.
Generate the 128-point sequence {y(n)} by padding {x(n)} with zeros:
y(n)=
{~(n)
Compute the 128-point DFf and plot the 65 points of the magnitude ~pectrum
corresponding to 0 s 01 S fr. Compare the two plots.
4.5. OFf of the product of two sequences
Object. Verify that the product of two time sequences results in the convolution
of their Fourier transforms.
Consider the following sequence: y(n) = w(n) x(n), for all n, where
x(n) =
{COSo(frn/8)
156
and
wen)
~ {~
Analytic results. Determine and sketch the discrete Fourier transforms {Y(k)},
{X(k)} and {W(k)}, and compare with the computer results. (Hint: {X(k)} has
only two nonzero points: use the finite geometric sum formula for {W(k)}, and a
convolution with an isolated point produces only a shift and a scale change.)
Computer results. Compute and plot the magnitudes of the 128-point DFfs for
the three sequences, using PLOTMR.
4.6. IDterpoiatiag time-domain sequences by padding the DFf with zeros
Object. lIIustrate how a time-domain sequence can be interpolated by modifying
the frequency-domain function.
Computer results. Let x(n) = cos(Jrn/4), for O~n ~31.
(1) Plot this sequence. All the plots in this project should be performed with
PLOT.
(2) Compute the 32-point OFf of {x(n)} and plot the real and imaginary
sequences Xa(k) and XI(k), for 0 ~ k ~ 31.
(3) Pad these sequences with 32 zeros to produce Ya(k) and Yi(k). To retain the
symmetry properties of the real and imaginary sequences, the zero-padding is
performed as follows:
Ya(k)=
Xa(k)
0
{
Xa(k-32)
for
for
for
0~k~15
16~k~47
48~k~63
and
for O~ks15
for 16sk s47
for48~k~63
CHAPTER
5
THE
z-TRANSFORM
5.1 INTRODUcnON
The z -transform is the primary mathematical tool for the analysis and synthesis
of digital filters. Procedures for determining the z -transform of a discrete-time
sequence are described. The system function of a digital filter is defined as the
z-transform of its unit-sample response. The complex z plane is employed to
display the configuration of the poles and zeros of the system function. The
circle centered at the origin of the z plane and having radius equal to unity is
called the unit circle. The region of convergence (ROC) in the z plane
determines the values of z for which the z-transform is defined. The form of
the ROC is also related to the properties of the discrete-time sequence.
The. location of the system function singularities in the z plane is
exploited in several ways. The stability of the discrete-time system can be
determined by inspection, since stable causal systems have all their poles inside
the unit circle. Stable noncausal systems are allowed to have poles at infinity.
The Fourier transform is shown to be the evaluation of the z-transform along
the unit circle in the z plane. The discrete Fourier transform can be
determined by evaluating the z-transform at a set of equally-spaced points on
the unit circle. Finally, the digital filter coefficients can be determined from the
locations of the poles and zeros. The chapter concludes by considering three
157
158
H(z) ==
h(n)z-n
(5.1)
n=-oo
X(z)= Lx(n)z-n
(5.2)
n=-OO
for -lsns1
otherwise
Applying the definition of the z-transform, we have
z 1 Z-I
H(z}="3+"3+"T.
Example 5.2. 1he z-transform of the first-order recursive filter. Let
a"
h(n}= { 0
forn~O
otherwise
00
11-0
.. -0
H(z} = 1- az-I
lHE zTRANSFORM
159
h(n) = {~oos(won),
The z -transform is given by
for n ~O
otherwise
,,-0
Applying the Euler identity and the infinite geometric sum formula, we get
H(z) =
..
(ei"'O" + e-j.,O")
,,-0
L r"
z-"
,,-0
_![
1
+
1
]
- 2 1- r &"'OZ-I 1- r e-j"'oz-I
j
1[
2-r(&"'o+e- .,0)z-1
]
=2 (1- r &",oz-I)(l- r e-i"'Oz-l)
1- r oos(WO)Z-1
for n ~O
otherwise
..
H(z) =
L r" sin(won)z-"
,,-0
1
1]
=2j1 [
1-r&"'Oz-I-1-re iOloZ- 1
r sin( WO)Z-I
160
...
= L
x(n)z-n
co
= L
[ahl(n) + bh 2(n)]z-n
n=-oo
...
co
n~-o:>
=aH1(z) + bH2(z)
(5.3)
...
L co
H(z) = n __ h(n)z-n
z.
3. Linearity:
(y(n)}
=lx(n -
no)}
then
Y(z) = z-NOX(z)
(y(n)}
= {h(n)} * {x(n)}
then
Y(z) = H(z)X(z)
THE ,TRANSFORM
161
= L""
Hk(z)
hk(n)z-n
n=-oo
=n -
hen - k)z-n
(5.4)
n=-tXl
k, we have
00
Hk(z)
""
=L
00
h(m)z-(m+k) = Z-k
h(m)z-m
= z-kH(z)
(5.5)
m=-oo
m=-oo
y(n)=
h(k)x(n-k) ..
(5.6)
k=-""
= L""
y(n)z-n
n=-oo
(5.7)
From this last equation, we want to determine Y(z) in terms of H(z) and
X(z). The required infinite sums are present, but we need a Z-k for the h(k)
terms and an additional Zk for the x(n - k) terms. Multiplying Eq. (5.7) by
ZkZ-k and changing the order of the summations, we get
Y(z) =
k)z-(n-k) ]
(5.8)
= H(z) X(z)
(5.9)
162
= {~n cos(won)
for n ~O
otherwise
for n ~O
otherwise
x(n)
into
1- 2r cos(WO)Z-l + r2z- 2
1- r cos(WO)Z-l
this filter.
TIlE :TRANSFORM
163
Y(z}
= 2:
y(n}z-n
n=-aCI
k) +
k~NF bk x(n -
k) ]z-n
~1 akL~oo y(n -
k}z-n] +
k)z-n ] (5.12)
Y(z}
= 2:
k=l
ak Z-k Y(z}
2:
k=-NF
bkz- k X(z}
(5.13)
Since Y(z) and X(z) are not functions of k, they can be factored out to give
M
Y(z) [ 1- ~1 ak z -
k]
Np
=X(Z}k=~NF bkz-
(5.14)
Applying the definition for the system function H(z), we have our desired
result, or
(5.15)
+ z-IX(z)]
+ z-I/3
Example 5.7. System function of the first-order recursive filter. For the
164
or
H(z)=-~l
l-az-
PARALLEL COMBINATION
V(z)
X(z)~
'X(z)~
H,(z)H 2 (z)
Y(z)
~Y(z)
X(z)
X(z)O---+,(z)+H 2 (ziJ----oy(z)
FIGURE 5-1
Cascade and parallel combinations of linear systems.
Y(z)
THE z-TRANSFORM
165
= H 1(z) X(z)
Y(z)
= H 2(z) V(z)
(5.16)
Combining these two equations, the output Y(z) can be expressed in the terms
of X(z) as
Y(z)
(5.17)
(5.18)
This result can be generalized to the cascade connection of any finite number
(5.19)
,,=1
Thus the system function of the total filter composed of cascaded components,
denoted by Hc(z), is simply the product of the system functions of each of the
individual series components, or
Hc(z) =
n H,,(z)
N
(5.20)
,,=1
Eumple 5.9.
where
and
(5.21)
166
H1(z) is the nonrecursive part of the general filter, while H2(z) is the recursive
part. This result will be useful later for deriving an alternate filter structure
that reduces the number of delays required for implementing a digital filter.
Example S.10. Two ways of bnplementing a second-order recnrsive filter. From
Example 5.3, let us consider the following system function:
1- r cos(a>O)Z-l
(z) = 1- 2r cos(a>o) Z 1 + r2z
and
H2(z) = (1- 2r cos(a>O)Z-l + ~Z-2)-1
The desired filter can be implemented by either H(z) = H1(z) H 2(z) or H(z) =
H 2(z) H1(z), as shown in Fig. 5.2.
} - - - -__-o y(n)
x(n) 0 - . . , . . - - - - - ; . (
Ha(z)
~
_ _~A~____~
HI(z)
____~A~______~
x(n)
"GURE 5-2
Two digital filter structures that implement the same system function.
y(n)
TIfE zTRANSFORM
167
Yiz)
= Hk(z) X(z)
(5.22)
The output response for each of the parallel sections is added to produce the
composite filter output response, given by
,
N
Y(z)
=L
k-l
Yk(z)
=L
k-l
Hk(z) X(z)
=X(z) L Hk(z)
k-l
(5.23)
From this last equation, it is apparent that the system function of the total filter
composed of parallel components, denoted by Hp(z), is given by
Hp(z) =
L Hk(z)
k=l
(5.24)
1
1-bz- 1+1-az- 1
2-(a+b)z-1
1
1
(z) =1- az- + 1- bz- =(1- az- 1)(1- bz 1) 1- (a + b)Z-1 + abz- 2
1
When combining the two first-order recursive filters, the overall system is
second-order and has a nonrecursive component, if a :/= -b.
k=l
DkZ-k Y(z)
+ }:
bkz- k X(z)
(5.25)
k=-~
168
STEP!
X(z)_
--oY(z)
STEP 2
.~1!'~X(z)
L:Jo
NF
zX(z)
X(Z)
X(z)
STEP 3
D_NF
~b~NFX(Z)
I
X(z)o--.......- - - t
----11.---<1
boX(z)
Y(z)
STEP 4
I
X(z)o-O
btz-tX(z)
-~:B b
~~---<o Y(z)
L-y-J
f QtZ-l,y(z)
t-I
FIGURE 5-3
Steps in implementing a digital filter from the system function H(z).
TIlE zTRANSFORM
X(z) _ _
169
t-----_-y(z)
---~
FIGURE 54
Implementation of a second-order filter from the system function.
1m
GJ
z=re Jf
----~-~---Re
FIGURE 5-5
The complex z plane.
170
/ M
II (1 -
dkz- 1)
(5.27)
k=l
These points are summarized in Table 5.2 and illustrated in the following
examples.
Example 5.13. Pole/zero pattern of the 3-sample avenger. From Example 5.1,
the system function is given by
TIlE zTRANSFORM
171
TABLE 5.2
z plane
1Mn
(l-dkz- I )
k-I
A = 1/3,
CI=
and
C2=
-1 -
jV3
=e
-j2J<13
The first term, z, generates a pole at z = 00 and a zero at z =O. The two terms
containing Z-1 generate zeros at z = CI and z = C2 and two poles at z = O. One of
these poles cancels the zero at z = O. The pole/zero pattern is shown in Fig. 5.6.
The number of poles is equal to the number of zeros. Notice that the gain term A
does not affect the locations of the singularities.
eJl13_-1+i,j3
- -2-
l'
C?------liI
I
I
X at z=oo
FIGURE 5-6
Pole/zero pattern for
H(z) = Hz + 1 + Z-I).
172
1m
eI2.'3
__
0 _
'--2_ _ Re
FIGURE 5-7
Pole/zero pattern for
H(z) = 1(1 + Z-1 + Z-2).
r =z/(z -a)
H(z) = [l-az- 1
In this case, there is a pole at z
Hz) =
(
1- 'cos(I"IIO)Z-1
1 - 2r cos(1"110) Z-1 +
rz 2
_
1-, cos(l"IIo) Z-1
-1-,(el:-O+e-J:-o)z-l+ rz
_
1-,cos(l"IIo)z-1
- (1-, el:-Oz 1)(1_, e-Jo>oz 1)
The numerator generates a zero at z = r cos( 1"110) and a pole at z =0, while the
denominator generates two zeros at z = 0 and poles at z = r eJaoo, as shown in
Fig. 5.9.
1m
---~:r--""*"- Re
FIGURE 5-8
Pole/zero pattern for H(z) = 1/(1 -
QZ-l).
TIlE zTRANSFORM
173
1m
----------~~--~------Re
rcos(wo)
iI
FIGURE 5-9
Pole/zero pattern for H(z) =
(l-rcos(wo)z-I)/(l- 2rcos(WO)Z-1 + rZ z-z).
;/(re-''''
-1 + jV3
-j2J<13
2
=e
and
'The first term, zZ, generates two poles at z = 00 and two zeros at z = o. The two
terms containing Z-I each generate two zeros at z = CI and z = Cz and two poles at
z =0. The net pole/zero pattern is shown in Fig. 5.10.
The zeros of H(z) occur at values of z for which Z-N = 1. Since H(z) is an Nth
order polynomial, there are N roots. To find these roots, let
where m is an integer
1m
X
z at z=oo
---t--Re
FIGURE 5-10
Pole/zero pattern for H(z) =
zZ+ 2z + 3 +2z- 1 + z-z.
114
rm
-1
- -.....-Re
FIGURE 511
Pole/zero pattern for H(z) = 1 - z-N. Case is showr:
for N=8.
-j
Hence, the zeros occur at z = ei2nmlN, for m = 0, 1, 2, ... , N -1. These zeros lie
on a circle having unit radius. They start at z = 1 and are separated by angles
equal to 21C/N. The case for N = 8 is shown in Fig. 5.11.
Since H(z) becomes infinite at the locations of the poles, the poles
cannot lie in the ROC. In fact, it is the location of the poles that determine the
boundaries of the ROC, as illustrated in the following examples. The ROC is
important for determining whether the filter is stable, and is related to the type
of the time sequence, causal or noncausal, finite-duration or infinite-duration.
These relationships are listed in Table 5.3 and discussed below.
Eumple 5.19. ReKion of convergence for 3-sample averager. Let
h(n) =
{~
for -1 sn s 1
otherwise
Then
~ Ih(n )z -illizi
liz-II
=-+-+-=
3 3
3
.J
11 _ _
THE zTRANSFORM
175
TABLE 5.3
Izl>p
p < Izl < 00
(p>l)
(p < 1)
This sum is finite for Iz I < co and Izl > O. Hence, the ROC contains alI values of z
for which 0 < Izl < co, or the entire z plane except for z = 0 and z = co.
Example S.2O.
an
h(n) = { 0
for n 2: 0
otherwise
Then
~
2:
Ih(n)z-"I =
2: laz-II" = [l-Iaz-Ilr
,. ... _00
The sum converges for laz-II < 1 or Izl > 14 Hence, the ROC is the outside of a
circle of radius lal in the z plane as shown in Fig. 5.12.
L Ih(n)1 <00
n=-et;
(5.29)
FIGURE SOU
Region of convergence (ROC) for first-order recursive filter.
176
H(z)
1/1- ~l
ak
z-k
(5.30)
To show explicitly the locations of the poles, we factor the denominator into
the product-of-terms form and perform a partial fraction expansion to obtain
M
H(z)
-ak
= ~11- dkz-1
(5.31)
where both crk and dk may be complex-valued. Since the z-transform is linear,
the unit-sample response is equal to the sum of that produced by each term in
the sum, or
M
h(n)
= L hk(n)
for n ~O
(5.32)
k=l
(5.33)
For the system to be stable, each component sequence {hk(n)} must satisfy the
infinite sum condition, or
(5.34)
Applying this condition, we have
00
00
00
n=O
(5.35)
n=O
For the last sum, composed of a geometric series, to be finite, the magnitude
of each term must be less than.unity, or Idkl < 1. Hence, we have shown that
each pole of a stable system must lie within the unit circle in the z plane. This is
illustrated in the following examples of two unstable systems.
Example 5.21. First-order uustable system. Consider the unit-sample response
given by
h(n) =
{~
forn~O
otherwise
TIlE z-TRANSFORM
177
L Ih(n)l= L 1
,.-0
n-O
which is not finite by inspection. Hence, the system is not stable. The system
function is gjven by
~
n-O
,.-0
L h(n)z-n = L z-n
H(z) =
-z
{~S(.8n)
for n:2: 0
otherwise
L Ih(n)1 = ,.-0
L Icos(,Bn)1
.
n-O
which is not finite by inspection. Hence, the system is not stable. The system
function is given by
~
H(z) =
L h(n)z-n = L cos(,Bn)z-n
H(z)
= L
n=-Np
h(n) z-n
(5.36)
178
For such a polynomial system function, poles can exist only at z = 0 and z = 00,
with those at z = 00 being present only for sequences that are noncausal, i.e.
for NF > O. For infinite-duration sequences extending for n ;::: 0, typified by the
unit-sample response of a recursive filter, the system function will contain at
least one denominator term producing a finite pole in the z plane in the region
0< Iz I < 00. Then the ROC is outside the pole having the largest radius.
Infinite-duration sequences extending into negative time result when the ROC
is inside the smallest pole in the z plane. Since these have little practical utility,
they will not be considered in this book.
1. A single zero on the real axis at z = ro, where 0 < Irol < 00, with the
corresponding pole at z = O. The system function of the nonrecursive filter
that generates this pattern is given by
H1(z) = 1- ToZ- 1
(5.37)
Z. A single pole on the real axis at z = ro, where 0 < Irol < 1, with the
corresponding zero at z = O. The system function of the recursive filter that
generates this pattern is given by
= [1- roz-1]-1
A pair of complex-conjugate zeros at z = ro ejroo,
H2 (z)
3.
(5.38)
(5.40)
nm
z-TRANSFORM
179
1m
- - - - l__-o-Re
o-Y(n)
Z-I
-TO
1m
SECOND-ORDER
x(n)
9 r oe ;'"
y(n)
IRe
OrOe- JCdIl
1m
RECURSIVE FILTERS:
FIRST-ORDER
x(n)
}-----.--oy(n)
1m
SECOND-ORDER
x(n)
~--_--y(n)
--_o---Re
2
nGURE 5-13
Relationsbips of simple filters to their pole/zero patterns_
Having implemented the singularities lying in 0 < Izl < 00, those remaining at
z = 0 and z = 00 are then considered. There will always remain an equal
number of opposite singularities at z = 0 and z = 00. If the system is noncausal,
recognized by the unit-sample response starting at n = - NF , then there will be
NF poles at z = 00_ The elementary system function component is then
Hs(z) = ZNF
(5.41)
If the system is causal, but has a delay in the unit-sample response, starting at
=M > 0, then there will be M zeros at z = 00. The elementary system
function component is then
n
(5.42)
The system function of the total filter is then proportional to the product
180
H(z)=An Hk(z)
(5.43)
k=l
where A is the filter gain constant, which cannot be determined from the
pole/zero pattern, and K is the number of elementary systems: By breaking up
a given z plane pole/zero pattern into these elementary types, the coefficients
of the filters generating these singularities can be determined by inspection.
If a pole or zero is needed at z = 0, but not available, a pole/zero
pair can be created there. Then the singularity that is needed is taken, leaving
the opposite singularity at z = 0. The singularities remaining at z = 0, after all
those located in 0 < Izl < co have been taken, have mates at z = co. If there are
N excess poles at z = 0, then these cause a net delay of N samples in the
system function, or z -N. If there are N excess zeros at z = 0; then these cause
a net advance, or ZN.
Example 5.23. Filter coefficients from the z plane singularities. Consider the
pole/zero pattern shown in Fig. 5.14. The system function will be represented by
= 0 to produce
= 0,
1m
Z= 00
-----4--~------~----------+_--~~Re
F1GURE 5-14
Pole/zero pattern to be
implemented by a digital
filter.
THE ,TRANSFORM
181
Since there were no existing poles at z = 0, two pole/zero pairs were created at
z = 0, the poles were taken and the zeros remained, leaving three zeros at z =O.
(4) The poles at z = band z = b* and two zeros at z = 0 produce
H4(Z) = [(1- bz- 1 )(1- b*Z-lW 1 = [1- (b + b*)Z-l + IW z- 2
The system function gain factor A cannot be determined from the pole/zero
pattern, but must be given separately.
ZERO(R,DEG,BCOEF,NB)
where
R
DEG
POLE(R,DEG,ACOEF,NA)
where
R
DEG;
182
H(z) = 1- roz- I
The call to ZERO(R, DEG, BCOEF, NB) should generate BCOEF(l) = 1,
BCOEF(2) = -ro and NB = 2. The corresponding pole is generated at z = O.
Example 5.25. Coefficient for a real-valued pole. We want the filter coefficients
that implement a pole at z = roo Then R = Irol. If ro> 0, then DEG = 0, or if
ro < 0, then DEG = 180. The subroutine should determine that the pole is
produced by the filter having the system function
+ r~z-2
+ r~-2rl
TIlE zTRANSFORM
183
=AzNFNrr;NF
l!l (l- Ck Z - I ) /
DI(l-dk z-
(5.44)
has NF + Np finite zeros located at Cb 1::; k ::; Np + NF, M finite poles located at
dk , 1::; k::; M, and M - N p zeros at z = O. The value of R(z) at some point
(5.45)
/K
(5.46)
where D[x, y] is the distance between the points x and y in the complex z
plane. The square of this distance is computed by
(5.47)
1m
FIGURE 515
Geometric evaluation of the system function
H(z) at point z = zoo
184
Arg[H(Zo) =
Kp
(5.48)
k=l
where L[x, y] is the angle between the positive real axis and the line
connecting points x and y. This angle can be computed by
L[x, y]
Im(y) - Im(x)
(5.49)
The value of A cannot be determined from the pole/zero pattern, since the
pattern is not affected by a constant multiplier of the system function. We will
apply this evaluation procedure to determine the Fourier transform in the z
plane in the next section.
H(r eiaJ)
=L
h(n)r- n e-iaJn
(5.50)
n=-CIO
Note the similarity of this analytic form and the definition of the Fourier
transform of {hen)} given by
H(eiaJ ) =
..
L hen) e-icon
n=-oo
(5.51)
In fact, the two definitions are identical when r = 1. In the z plane, this
corresponds to the locus of points for which Izl = 1. This locus defines a circle
about the origin with radius equal to 1, called the unit circle. Hence, H(e iaJ ) is
equal to H(z) evaluated along the unit circle, or
(5.52)
iaJ
For H(e ) to exist, the ROC of H(z) must include the unit circle. As
shown previously, the ROC for a causal filter system function is the region
outside the pole having the largest radius. Since the Fourier transform is
evaluated on the unit circle, this implies that all the poles of a causal, stable
filter must lie inside the unit circle.
To determine the Fourier transform at a particular frequency 0 = 00, we
TIiB .TRANSFORM
185
must evaluate the system function at the point z = ei"'o. In the z plane, this
point is located at the intersection of the unit circle and the line passing
through the origin and making an angle Wo with respect to the positive real
axis. The evaluation is illustrated in the following examples.
Example 5.28. Evaluation of the Fourier transform in the
firstorder recursive filter. Let
Example 5.29. Evaluation of the Fourier transform in the zplane for the
3-sample averager. Let
1m
arctan (
sin(wo) )
IlGs(w o)- a
-I
nGURE 516
-j
186
1m
Xz=;x
-+---7'Yi-----'---+- Re
-}
FIGURE 5-17
-j
From Example 5.13, there are zeros at z = ei2"/3 and a finite pole at z = 0, as
shown in Fig. 5.17. The distance from the pole to eJw is
D2[0, eJW ] = cos 2 ( w) + sin2 ( w) = 1
The product of the distances from each of the zeros to eJw is
D2[ ei2>T/3, el 01] D2[ e - j2,,/3, eJW]
= [2 - ei(W-2lr/3) _ e- J(w-2"13)][2 _
eJ(w+2"/3)
e- J(w+2"/3)]
+ cos(2w)]/2) + 4 cos(w)
This result is 9 times the value for IH(e iw )12 in Example 5.13. Hence, A =~.
The angle from the pole at z = to eiw is equal to w. The angle from each
of the zeros is equal to
L [e
)2,,/3
-i2lr /3
'W]_
,el
(Sin(2;r/3)-Sin(W))
- arctan cos;r
(2 13) -cos ()
w
(-Sin(2;r/3) - Sin(W))
- arctan cos;r
(2 13) -cos ()
w
JW] _
,e
Then
Arg[H(eiW )] = L[eiZ"/3, eiW ] + L[e- i2 ,,/3, eJW ]
A,g[H(~)l ~ { -;
TIlE zTRANSFORM
187
Izl=l
<[e'(''',e''''''-]
FIGURE S18
Evaluation of the phase response around a zero
located on the unit circle.
The same analytic results could have been obtained with much less effort
by merely substituting eiw for z in H(z) to obtain the Fourier transform. The
justification for this geometric evaluation is that the approximate shape of the
magnitude response of a complicated Fourier transform can be readily inferred
from the pole/zero pattern. For example, if a singularity is located close to the
unit circle, it will dominate the frequency response in the frequency range
adjacent to the singularity. This is true because the magnitude response is determined by the ratio of distances, given in Bq. (5.46). If the singularity is close
to the unit circle, then the distances from it can change radically for small
changes in frequency, which are increments along the unit circle, as shown in
Fig. 5.19. This dominant singularity idea is helpful not only for determining the
approximate shape of the frequency response, but also for the placement of
poles and zeros to achieve a desired transfer function, as demonstrated in the
following chapters.
188
DOMINANT POLE
1m
DOMINANT ZERO
1m
~'~
~-."
reJ(t)u
re Jwn
Re
Re
/H(e'''')/
/H(e'''')/
1\ ,
,,
\
,
W
1T
Wo
Wo
1T
FIGURE 519
Magnitude response'features for dominant zeros and poles. (r = 0.99).
S.12 mE zT~ANSFORM OF
SYMMETRIC SEQUENCES
In this section, we consider the pole/zero pattern for linear, time-invariant
systems hav.ing unit-sample response sequences that exhibit a point of
symmetry. In Chapter 3, symmetric and antisymmetric sequences were
discussed, with special cases being the even and odd sequences. To simplify the
analysis, we first consider these speci~l cases and then extend these results to
the general symmetric and antisymmetric cases.
EVEN SEQUENCES. Let us consider an even sequence, denoted by {hE(n)},
having duration N = 2M + 1, for some integer M. By the definition of an even
sequence, h(n) = h( -n). The z-transform of {hdn)} is given by
M
HE(z)
= L
n=-M
-1
=
Substituting k
n=-M
h(n)z-n
h(n)z~n
+ h(O) + L h(n)z-n
n=l
(5.53)
HE(z)
=L
k=1
h(k)Zk + h(O) +
M
=h(O) + L
n=1
h(n)[zn
L h(n)z-n
n=1
+ z-n]
(5.54)
1HE zTRANSFORM
189
h(-l) = -2.5
h(O) = 5.25
h(l) = -2.5
h(2) = 1
and h(n) = 0, otherwise
Z-2
at z =
00
--~----~-L--~--Re
FIGURE 520
Pole/zero pattern for an even sennen"'"
190
1m
at z=oo
--~----~~---+---Re
FIGURE 521
Pole/zero pattern for an even sequence having
zeros on the unit circle.
This last equation indicates that delaying a sequence by M time units generates
M poles at z = 0 and M zeros at z = 00. These M zeros at z = 00 cancel the M
poles of the even sequence that were there. Hence, all the poles of the
z-transform for a causal finite-duration sequence are located at z = O. The
ROC is then defined by the entire z-plane, except z = 0, or Izl > O.
Example 5.32. Pole/zero configuration for a symmetric sequence having an odd
number of elements. Let
h(O) = 1
h(1) = -2.5
h(2) =5.25
h(3) = -2.5
h(4) = 1
and h(n) = 0, otherwise
TIlE z-TRANSFORM
191
1m
-4----------~~~----~--Re
FIGURE 5.22
Pole/zero pattern for a causal symmetric sequence.
shown in Fig. 5.23. Let us now consider the square of the system function, or
H'(z)
= Hs(z) Hs(z)
(5.56)
H'(z) has the same singularity locations as Hs(z), although there are now
twice as many at each point. The equivalent time-domain operation is the
linear convolution of {h(n)} with itself, or
{h'(n)}
= {hs(n)} * {hs(n)}
(5.57)
_ 0--,----:,--1-L-...I.I
1_0_ _ _
;0 II
-I
{h'(nJ}
3 4
3 4
= {h(n)}.:h(II)1
-I
5 6
1/
FIGURE 5-23
The self-convolution of a symmetric sequence that has its point
of symmetry between sampling
points produces a sequence tha,
has its point of symmetry on a
sampling POIDt.
192
Im
~--------~~3--------~~Re
Iz I= 1
FIGURE 5-24
Pole/zero pattern for N-point symmetric
sequence, where N is even integer.
n+l
h'(n)=
~-n
Note that {h'(n)} is symmetric about n = 3. Hence, H'(z) has zeros that are
complex-conjugate quadruplets with an even number of zeros at each singularity
location. The z-transform of {h'(n)} is equal to
1- 2z- +
4
H'(z) =
Hence,
Z-8
I - 2z- 1 + Z
(1 _
Z-4)2
= -1- Z_-l
l-z- 4
Hs(z) = - 1
-I
-z
The numerator and denominator terms produce the pole/zero pattern shown in
Fig. 5.24. Note that a pole/zero cancellation occurs at z = 1.
Hs(z)
(5.58)
n=O
Note that when n is even, (N - 1 - n) is odd. Hence, when z = -1, the term in
the brackets is zero. This demonstrates that when N is even, Hs(z) will always
have a zero at z = -1.
ODD SEQUENCES. Applying the same analysis as for the even sequence to an
odd sequence, and recalling that ho(O) = 0, we obtain
M
Ho(z)
= ~ ho(n)[z-n - zn]
n=l
(5.59)
TIlE ,TRANSFORM
193
Ho(1/z) =
2: ho(n)[zn -
z-n]
= -Ho(z)
(5.60)
n=1
Since multiplying the z-transform by the constant A = -1 does not change the
locations of the singularities in the z plane, the result here is the same as the
case for the even sequence: if there is a zero at z = Zo, then there is also one at
z = l/zo. Hence, the zeros for an odd sequence also occur in complexconjugate quadruplets.
Example 5.34. Pole/zero pattem for an odd sequence. Let
h(-3) = 1
h(-2)=2
h(-1)=3
h(O) = 0
h(3) =-1
h(1) =-3
h(2) =-2
and h(n) = 0, otherwise
Z3
(h(n)}
----~~----~~----~~----Re
ftGURE S25
Pole/zero pattern for an odd-symmetric
seouence.
194
Then
HA(z) = z-MHo(z)
The M zeros at z = 00 produced by Z-M cancel all the poles of the odd sequence
that were there. As expected, all the poles of a causal finite-duration sequence
are located at z = O.
Again, we must consider the two cases when the point of antisymmetry
falls on an index value and when it falls between index values. The results are
exactly analogous to the causal symmetric results above. We present an
example of the latter, more complicated, case.
Example 5.35. Pole/zero pattem for an antisymmetric sequence. Let
h(O) = 1
h(1)=2
h(2)=-2
h(3)=-1
andh(n)=O,
otherwise
h'(1)=4
h'(2) = 0
h'(3) =-10
h'(6)"; 1
h'(4) = 0
h'(5) = 4
and is shown in Fig. 5.26. The sequence {h'(n)} is symmetric about n = 3. Hence,
H'(z) has zeros that are complex-conjugate quadruplets with an even number of
zeros at each singularity location. The z-transfol'Ill of {h'(n)} is equal to
{h'(n}}={h(n}}
* {h(n)}
4
-1
0 1 2
4 5 6 7 8
-10
FIGURE 5-26
The self-convolution of an antisymmetrc sequence that has its
point of symmetry between sampling points produces a sequence
that has its point of symmetry on
a sampling point.
THE ,TRANSFORM
l.95
1m
H'(z)
Izl=1
2
~~--------r-----~~--~---'2~Re
-2.618
1m
~----------~----~~------~--Re
-2.618
nGURE 5-rI
Pole/zero pattern for an
antisymmetric
sequence
whose point of symmetry
falls between sample points.
-2.618
and
-1/2.168
and six poles are at z = 0, as shown in Fig. 5.27. Hence, the z-transform of the
original sequence, given by
HA(z) = 1 + 2Z-I- 2z- 1 - Z-3
has zeros that occur in reciprocal pairs (zeros on the unit circle form their own
reciprocals) .
196
H(z) = az + b + cz- I
From the definition of the z-transform, we find by inspection that h( -1) = a,
2: 2 and n 5 -2.
need only to expand H(z) into a polynomial in powers of Z-l. The coefficient
of z-n is then equal to h(n). We illustrate the application of this method to
various types of sequences in the following examples.
Example 5.37. Long-division method for causal sequences. Let
H(z)=l"
-az
-'. z
_I
z-a
ROC:lzl>a
Since the ROC is outside the pole, we should obtain a right-Sided sequence, i.e. a
polynomial in z-n for n 2: O. To accomplish this, we perform the following
division:
TIlE .1RANSFORM
197
a"
h(n) = { 0
for n?:O
otherwise
ZK+l
z-b
ROC: b<lzl<oo
Since the ROC is outside the pole, we should obtain a right-sided sequence, but
because there are K poles at z = 00, the sequence starts at n = - K. To accomplish
this, we perform the foilowing division:
ZK+l
__ = ZK + bZ K- 1+ b2z K- 2 + ... + bK + b K+1Z- 1+ bK+2Z- 2+ ...
z-b
for n?:-K
otherwise
ROC:
Izi > a
Since the ROC defines the region outside the pole, we should expect an infinite
duration sequence extending for positive values of n. To obtain such a right-sided
sequence, we perform the division to obtain
H(z) = 1- (a 2 + b2)z-2 + a2(a 2+ b2)z-4 - ..
Equating the coefficient of Z-II )vith h(n), we have
h(O) = 1
h(1) = 0
h(2) = _(a 2 + b 2 )
h(3) = 0
h(4) = a 2 (a 2 + b 2 )
~ )~"'-~a' +.)
h(n) - { -1
forn=O
for n > 0 and even
otherWise
198
below provide analytic expressions for h(n), from which any element of the
sequence can then be determined.
TAYLOR SERIES EXPANSION, MEmOD. Recall that for a complex number
c, where
lei < 1,
2:
(5.61)
inverse
z-
-az
In the ROC, laz- 1< 1. Hence, the formula can be applied directly to express
H(z) in the following form:
~
~
2
H(z) = L (az- )" = L a"z-2n
"=0
PI-O
h(n)= { 0
1- b 2z- 2
H(Z)=1
22
+az
ROC:lzl>a
b 2 z- 2
l+a2z 2
~
mE ,TRANSFORM
199
Z- I
H(z) - ---""----'-'--:-----::---::
-1- 2, cos(wo) z 1+ ,2 Z 2
Factoring the denominator into the product of two terms and then performing the
partial fraction expansion , we get
for n 2: 0
othenvise
= ~ 1 H(z)zn-l dz
2JrJ jc
(5.62)
200
1m
Re
FIGURE 5-28
Contour of integration in the region of .convergence
for determining the inverse z-transfonn.
Residue theorem. If H(z)zn-l has N poles, denoted by PI' P2, ... PH. then
h(n) =
L Res[H(z)zn-l
at pole PI]
(5.63)
1-1
H( z )z n-l = ( P(z))m
Z-Zo
(5.64)
=Zo.
at z = Zo] = (
1
dm-lp(z)
-1)1 d m-l
m
.
Z
z-zo
(5.65)
(5.66)
H(z) = z + a + Z-I
The contour C is located in the ROC, which is the entire z plane except for z = 0
and z = 00. Then
"'7
mE zTRANSFORM
201
h(-2)=~ d P\z) I
3
3. dz
=0
z-o
P(z)
7
There is only a third-order pole at z = O. Hence
h(-l) =1-d-P(z)
2=1
2 dz
z=o
For II =0
P(z)
7
There is only a second-order pole at z = O. Hence
h(O) = dP(z)
= a
dz z-o
For 11=1
H(z)=z+a+z- 1 =
z2+az + 1 P(z)
=-
H(z) z =
Z2
+ az + 1
There are no poles inside C. Hence h(2) = O. This is also true for n
1
H(z)=l_az
2.
ROC: Izl>a
To enclose all the poles, the contour C is situated in the region of convergence, as
shown in Fig. 5.29. Then
z"
for n >0
202
1m
-+-----.--*--f-- Re
FIGURE 5-29
Contour of integration for the. first-order recursive
filter.
1
z(z-a)
H(Z)Z"-l=~_...,.
Then,
P(z)=z-a
The residue at z
P(O) = -l/a
=a is equal to
P(a) = l/a
P(z) = l/z
h(-l) =0
In a similar manner, it can be shown that h(n) =0 for n < O.
Example 5.45.
H(z)=1+a 2z
ROC: Izl>a
(Z2 _ b 2)z,,-1
=-:-,--,.....,..:--...,.
(z + ja)(z - ja)
= 0,
= 0,
TIlE zTRANSFORM
residues is
2
Z2 _ b 1
h(O) =-2--2
Z
+0
z-o
+b
(Z2 _
+ JO)
O~ + b 2
Z(Z
b 2)
z-ja
b 2)
(Z2 -
.)
Z(Z - JO
203
I
z=-ja
=-1
2 +-2 +--=
2
20
20
For n > 1, H(z) Z,,-l has poles only at Z = jo and -jo. Hence, for n > 1
h(n) =
(Z2 _
b 2)z"-1
(Z + JO.)
(Z2 -
+ (Z
Z-JI'
b 2 )z,,-1
-
.)
JO
2
= (0 -: b ) [( _jO)"-l _ (jO)"-l]
2Jo
z=-ja
for n > 1
Evaluating this equation produces the same values for {h(n)} as given in
Example 5.39.
5.14 SUMMARY
In this chapter, procedures for determining the z-transform of a discrete-time
sequence and for performing the inverse operation have been described. The
system function of a digital filter has been defined as the z-transform of its
unit-sample response. Cascade and parallel combinations of elemental digital
filters can be formed by factoring the system function.
The complex z plane was defined. The configuration of the poles and
zeros of the system function in the complex z plane were used to determine
whether the filter is recursive or nonrecursive. Stable causal filters were found
to have all their poles inside the unit circle, while stable noncausal filters also
had poles located at z = co. The region of convergence (ROC) was employed to
determine the type of the discrete-time sequence, either causal or noncausal,
finite-duration or infinite-duration. The Fourier transform was shown to be the
evaluation of the z-tr~sform along the unit circle in the z plane. Three
methods to determine the discrete-time sequence from the z -transform were
also presented.
FURTHER READING
Antoniou, Andreas: Digital Filters: Analysis and Design, McGraw-Hill, New York, 1979.
Hamming, R. W.: Digital Filters, 2d ed., Prentice-Hall, Englewood Oiffs, NJ, 1983.
Jong, M. T.: Methods of Discrete Signal and System Analysis, McGraw-Hill, New York, 1982.
Jury, E. I.: Theory and Application of the z-Transform Method, Wiley, New York, 1964.
Oppenheim, Alan V., and Ronald W. Schafer: Digital Signal Processing, Prentice-Hall,
Englewood CIi1Is, NJ, 1975.
Peled, A., and B. liu: Digital Signal Processing: Theory, Design and Implementation, Wiley, New
York, 1976.
Rabiner, Lawrence R., and Bernard Gold: Theory and Application of Digital Signal Processing,
Prentice-Hall, Englewood Cliffs, NJ, 1975.
204
REFERENCE TO TOPIC
Complex variables
Churchill, R. V.: Complex Variables and Applications. McGraw-Hill. New York. 1960.
PROBLEMS
5.1. Given the following unit-sample response sequences, compute the z-transform,
sketch the pole/zero pattern in the z plane and the filter block diagram.
(a) h(-I) = 1, h(I) = 1, h(n) =0, otherwise
(b) h(O) = 1, h(I)=-I, h(n) =0, otherwise
(c) h(-I)=I, h(0)=-2, h(I)=I, h(n)=O, otherwise
(d) h n)={r"Sin(won), forn~O,
(
0 otherwise. Let Wo = n/8 and r = 0.9
5.2. For the following difference equations, compute the z-transform of {h(n)},
sketch the pole/zero pattern in the z plane and the filter block diagram.
(a) y(n)=x(n)-x(n-N). LetN=5
(b) y(n)=x(n)+x(n-N). LetN=5
(c) y(n) = 2rcos(8)y(n -I)+r2 y(n -2)+x(n). Let (J=n/4 and r=0.9
5.3. For the digital filter structures shown in Fig. PZ.ll, compute the z-transform,
sketch the pole/zero pattern in the z plane and the filter block diagram.
5.4. For the following magnitude and phase functions, compute the z-transform,
sketch the pole/zero pattern in the z plane and the filter block diagram.
(a) IH(eiw)1 =2sin(w/2)
for O:s w :s2n
iW
Arg[H(e )] = n/2 - w/2
for 0 < w < 21r
(b) IH(eiW)I=[5+4cos(2w)]112,
Arg[H(ei",)] = arctan[ -sin(2w) ],
2+cos(2w)
Arg[H(eiO)) = 0
Arg[H(ei?)] = 0
Arg[H(ei~] =
5.5. For the z plane pole/zero patterns shown in Fig. P5.5, compute the z-transform,
sketch the filter block diagram, determine the transfer function and sketch the
unit-sample response sequence. Let the filter gain A = 1.
5.6. Determine the pole locations of the systems having the following unit-sample
response and determine whether they are stable.
(a) h(n) = {O(-l)"
(b) h(n) = {O(-l)"
forn~O
otherwise
TIm zTRANSFORM
(a)
1m
(b)
Izl=1
1m
...().---l~--4--+--<l
ROC:lzl>a
1m
ROC: Izl>O
1m
(Ii)
--~--~~---4-Re
--~--4~-~-Re
z=-1
ROC: IzI>O
1m
ROC: Izl> 0
1m
z=oo
-+---.......--~.Re
ROC: O<lzl< 00
Re
-2
(c)
205
Re
Izl=1
ROC:lzl>o
FIGURE PS.5
Pole/ufO patterns.
5.7. Determine the possible values of the phase response at I) = O. Indicate the
pole/zero pattern that can cause it. Repeat for I) = n.
5.8. Demonstrate that the z-transform of any antisymmetric sequence has a zero at
z=1.
5.9. Consider the z-transform given by
X(z) = sin(1/z)
Find a sequence {x(n)} that has this z-transform by performing a Taylor series
expansion.
5.10. Consider the sequence {x(n)} and its z-transform X(z).
206
= {a"x(n)}
where
11'
in terms of X(z).
(b) If X(z) has a pole inside the unit circle at radius r, what is the value of 11',
such that the pole of Y(z) falls on the unit circle?
5.11. Consider the filter with unit-sample response {hen)} and input {x(n)} given by
h(n)=
1
-01
forn=O
forn=8
otherwise
and
forn~O
x(n)=l
=0
otherwise
for O<p< 1
COMPUTER PROJECfS
5.1. DetermiDing the filter coefficients from the t: plane singularity location
Object. To determine the filter coefficients and the time-domain sequence from
the singularities in the z plane.
ZERO(R,DEG,BCOEF,NB)
and
POLE(R,DEG,ACOEF,NA)
Verify the operation of your subroutines by generating the coefficients for the
following causal filters. For each filter provide the following:
(i) the sketch of the block diagram of the digital filter
(ii) the sketch of the z plane pole/zero pattern
TIlE zTRANSFORM
2fY1
Use ZERO and POLE to determine the filter coefficients for the following
singularity locations. Use NONREC or REC to determine the unit-sample
response (since all the filters are causal, use the unit-sample sequence without any
delay). Use FFf to find the 128-sample Fourier transform, followed by MAGPHS
to find the magnitude and phase response over the 65 points covering 0 s w s n.
Use PL01MR and PLOTPR to plot the curves.
For each part below include the following:
sketch of the filter block diagram
plot of the unit-sample response
analytic form of the transfer function and system function
sketch of the pole/zero pattern in the z plane
the magnitude and phase response plots
(1) Real zero at z = i and pole at z =O. Repeat for zero at z = t. Explain the
difference in the two phase responses.
(2) Complex-conjugate zeros at z = 0.9 ejJJl8 and two poles at z = O. Repeat for
zeros at z = 1/(0.9 ejJJ,,) and two poles at z = O. Explain the difference in the
two phase responses.
(3) Real pole at z = -0.9 and zero at z = O. Repeat by moving the zero from z = (')
to z = -1/0.9.
(4) ~mplex-conjugate poles at z =0.95 ej..18 and two zeros at z =O. Repeat by
moving one of the zeros from z = 0 to z = 0.95 cos(n/8).
CHAPTER
6
DIGITAL
FILTER
STRUCTURES
6.1 INfRODUcnON
In this chapter, we describe the most commonly employed methods to
impleme~t a digital filter structure from either its di~erence equation, its
unit-sample response, or its z-transform. We start by defining the terms
conventionally used for describing digital filters and relating them to the
system functiQn coefficients. The digital filter structure determined directly
from either the difference equation or the system function is called the Direct
Form I. An alternate view of the same equations results in the memoryefficient structure, called the Direct Form II. Digital filters structured as
cascade and parallel combinations of second-order components are shown to
have advantages in terms of hardware implementation and numerical sen.sitivity. The above methods are employed to implement the general filter
structure, one that contains both poles and zeros. An all-zero filter having a
linear-phase response is shown to have a special nonrecursive structure that
reduces the number of multiplications by approximately one-half. The
frequency-sampling structure is presented as an alternative to the tapped-delay
line structure for all-zero filters.
209
2::""
yen) =
h(k)x(n - k)
(6.1)
k=-tIC
y(n)=faky(n-k)+
2 bkx(n-k)
(6.2)
k=-~
k=l
In the z-transform domain, the system function can be expressed in two useful
forms. The first is the sum-of-products form given by
H(z) =
~
k=-~
bk Z-k/1-
ak Z-k
(6.3)
k=l
H(z) =Az~
(6.4)
k-l
210
The digital filter structures implemented with the procedures described in the
previous chapters provide separate delay buffers for both the input and output
sequences, as shown in Fig. 6.1. This implementation is caIled the Direct Form
x(n)_-+---i
wen)
ftGURE 6-1
Direct Form I implementation of a digital filter.
~---_... y(n)
211
I. Since it shows explicitly the delayed values of the input and output, the
Direct Form I structure is a convenient way to implement a digital filter with a
computer program. One subroutine (NONREC) is used to implement the
zeros of the system function, followed by a second (REC) to implement the
poles. However, this form does not make the most efficient use of memory. A
second structure that performs the same transformation but uses fewer
memory elements is considered next.
This alternate structure is most easily achieved by considering the system
function expression given in Eq. (6.3).
The system function is then divided into two parts connected in cascade,
the first part containing only the zeros, followed by the part containing only
the poles. As shown in Fig. 6.1, we can introduce an intermediate sequence
{w(n)} representing the output of the first part and the input to the second.
Hence, we write
(6.5)
and
M
y(n) =
L ak y(n -
k)
+ w(n)
(6.6)
k=l
bkz- k
(6.7)
k=-iYF
and
(6.8)
Since we are dealing with linear systems, the order of these two parts can be
interchanged, as shown in Fig. 6.2(a), to generate the same overall system
function, but through a different intermediate sequence {u(n)}. The equations
for this second system are then given in the time-domain by
M
u(n) =
L ak u(n -
k) +x(n)
(6.9)
k=l
and
Np
y(n)
= L
bku(n - k)
(6.10)
(6.11)
k--iYF
k-l
akz-k
212
(a)
x(n)
yIn)
nGURE 6-2
Two step procedure to obtain the Direct Form II digital filter structure. a) Interchange recursive
and nonrecursive parts. b) Combine common delays.
213
and
Np
Y(Z)
= U(Z) 2:
bkz- k
(6.12)
k--Np
By examining the outputs of the delays in Fig. 6.2(0), we note that their
contents are identical. Hence, we can eliminate one set of delays, as indicated
in Fig. 6.2(b), to obtain a filter structure that uses fewer delay elements. This
filter structure, called the Direct Form II, uses a smaller number of delay
elements, equal to the maximum of M or Np + Np , than the Direct Form I,
which uses M + Np + Np elements. Since we need K delays to implement a
system function term containing Z-K, the Direct Form II uses the minimum
number of delays required to implement 0 given system function. It is therefore
said to be a canonical structure.
EuIapIe 6.1. Dired Fona n secoad-order filter Implementation. Let
y(n) = 2r cos(coo) y(n -1) - r2 y(n - 2) + x(n) - r cos(coo)x(n -1)
Y(z)
X(z)
The Direct Form I structure is obtained by factoring the system function to give
where H 1(z) is the numerator of H(z) and H 2(z) is the remainder. The
intermediate sequence {w(n)}, having z-transform W(z), is introduced between
these two sections as
H 1(z)
and
H 2(z)
and
214
zen)
y(n)
FIGURE 6-3
Implementation
of
second-order filter as a
Direct
Form
structure.
These latter two systems' are implemented as two Direct Form I filters and the
common delayed values of {u(n)} are combined to eliminate one set of delays, as
shown in Fig. 6.3. The result is the Direct Form II structure implementation of
the system function H(z).
+ Hp,
2lS
H(z) =Az*
n Hk(z)
(6.13)
k-t
where
(6.14)
The constant A is a gain term, ZNp is the noncausal advance component and
[M 12] is the integer obtained by rounding up M 12 to the next integer value.
For example, if M=5, then [MI2] =3. H IVp+Hp>M, then the upper limit
would be [(Np + Np )/2].
For the filter coefficients to be real, two complex-conjugate zeros of the
system function H(z) are combined to form each numerator term and two
complex-conjugate poles are combined for each denominator term. Two
real-valued singularities can also be combined to form a second-order term as
wen. H the number of poles or zeros is odd, the remaining single singularity is
implemented by making b2lc =0 or a2lc =0 for one of the sections. Each Hk(z)
term describes a coscade second-order section (CSOS), that c::an be efficiently
implemented using the Direct Form n, as shown in Fig. 6.4. The defining
equations for the kth CSOS are given by
Yk(z) = alkz - 1 Yk(z) + a2lcz-2 Yk(z) + Xk(z) + blkz- 1 Xk(z) + b2lc z- 2Xk(z)
(6.16)
Configuring a digital filter in this cascade form allows us to put an the
IIGURE 6-4
Cascade second-order section (CSOS) structure.
216
The filter can be implemented in two ways, depending on which numerator term
is combined with the denominator to form a CSOS. The first is
1
H(z) = 3" z(1
1 + -1 +
z-I/4) 1- Z-!/2
+;
-2
2/4
217
(/I)
Y(II)
y(1I)
ftGURE 6-S
Two implementations of a digital filter using CSOS structures.
Z18
(6.17)
k-l
where
_
gOA: + guz - 1
Gk (z ) -1
-1
-auz
-alkZ
-2
and [.] indicates the next largest integer value. This filter configuration is
shown in FIg. 6.6. For Np + Np > M, the upper limit of the sum becomes
[(Np + NF)/2]. The defining equations for the kth PSOS filter are given by
Yk(n)
(6.18)
(6.19)
Since the input sequence {x(n)} is applied simultaneously to all the PSOS
sections, a scale factor is necessary for each section. This scale factor is
included in the numerator eoemcients gOA: and glk' The poles in the PSOS
system function Eq. (6.17) are the same as those of the CSOS given in Eq.
(6.14). However, there is only one zero in each PSOS, as opposed to a pair of
complex-conjugate poles in the CSOS. This occurs because additional zeros
are generated in the total system function in making the parallel connections,
as shown in the following example. In general, determining the locations of
the zeros of a parallel combination of filters is not a simple problem.
It(lI)
I1GUIlE 6-6
Parallel second..order section (PSOS) structure.
219
2-(a+b)z-1
H2(z) = (1- az-l)(I- bz 1)
H2(z) contains the same poles as the individual terms of H1(z), but there is a zero
at z =(a + b)/2 that is explicitly expressed in H 2(z). Of course, this zero is also
present in H 1(z), but is not obvious by inspection.
EuIIIpIe 6.5. Geaeratioa of COaaplell-coaJ...te zeros. Let us consider the
implementation of the system function given in Example 6.2 as a combination cif
PSOS structures. Let
H( ) = z/3 + 5/12 + 5z- 1/12 + z-2/12
1- z 1/2 + z- 2 /4
7 Z-1
7/3 + 5z- 1/4 ]
H(z)=z [ 3+T+l-z- 1/2+z- 2 /4 .
The PSOS implementation is shown in Fig. 6.7.
.t(n)
nGURE 6-7
Digital filter implementation using PSOS structures.
y(n)
220
H(z)=
,,--M
h(n)z-"
(6.20)
The Direct Form I implementation of this filter shown in Fig. 6.8(a) requires
2M + 1 multiplications. For an even unit-sample response, the equal-valued
coefficients can be combined to give
H(z) = h(O) +
L h(n)[z" + z-"]
(6.21)
This last equation illustrates that the coefficient h(n) can be applied to tile sum
of the outputs of two delay elements, as shown in Fig. 6.8(b). This requires
only M + 1 multiplications to accomplish the same result as before.
Eumple 6.6. Lineu-phase FIR stradare. Let
H(z) = 1 + [z + z-I]/2
and implement,this filter with only one multiplication, as shown.
The same procedure can be applied to a causal FIR filter. The causal
filter is first implemented as a Direct Form I structure. The contents of the
delays leading to multipliers having the same coefficient magnitudes are then
routed to summing junctions before the multiplication, as in the next example.
Example 6.7. Causal 6near-phase FIR filter structure. Let
l!21
h(M)
y(n)
(b)
x(n)
y(n)
nGURE 6-8
(a) Nonrecursive Direct Form I structure of a noncausal FIR filter; (b) efficient noncausal
linear-phase FIR structure that reduces the multiplications by approximately one-half.
H(z) =
Z-l
+ [1 + z-2]/2
6.8 FREQUENCY-SAMPLING
STRUcrURE FOR THE FIR FILTER
In this section, we consider an alternate method of implementing an FIR filter.
This structure is interesting in that it employs the cascade combination of a
221:
x(n) o-----.---~
x(n) o---.....-~--...c
y(n)
y(n)
FIGURE 6-9
Two equivalent structures for a noncausallinear-phase FIR filter.
(6.22)
Ho(z)
=;
N-l
~o z-n
x(n) 0---.......--+---,.,
(6.23)
y(n)
FIGURE 6-10
Two equivalent structures for a causal linear-phase FIR filter.
(-
223
L----------T~---------JIlL-------------l~-----------J
COMB FILTER
RESONATOR
FIGURE 6-11
Comb filter followed by a resonator to implement an FIR filter.
Using the finite geometric sum formula, this sum can be evaluated to give
Ho(z)
Go 1- Z-N
= N 1- Z-I
(6.24)
This analytic form of the system function suggests a novel way to implement
the above filter: as the two-stage cascade structure shown in Fig. 6.11. The
system function of this cascade combination can be written as
Ho(z)
= Hdz) HR,o(z)
(6.25)
where
Hdz)=
1 -z -N
N
and
Go
H R,O( z-1
) - - -I
-
-z
Hdz) is the system function of the comb filter; the reason for this
name will become apparent shortly. The comb filter has the (N + I)-point unitsample response, only two elements of which are nonzero, h(O) = I/N and
h(N) = -1/N, as shown in Fig. 6.12 for N = 8. These nonzero elements of
FIGURE 6-12
FIR filter implementation using the comb filtl> with resonator structure.
224
FIGURE 613
Magnitude response of comb filter (N = 8).
2
N
(6.26)
which is shown in Fig. 6.13 for N = 8. HdeiW ) has N zeros equally spaced over
the frequency range O:s OJ < 2;r. Because the magnitude response resembles a
comb, this filter has become known as a comb filter. This form of the transfer
function can also be explained by considering the pole/zero pattern of the
system function Hdz). This is most easily seen by expressing Hdz) as
1 N-l
.
Hdz)=(l_ el 2n"kINz -l)
N k=O
IT
(6.27)
This last form explicitly indicates that there are N equally spaced zeros over
the unit circle with the first zero at z = 1 and all the poles are at z = O. This is
shown in Fig. 6.14 for N = 8.
HR,k(Z) is the system function of a resonator, or a filter that has poles on
the unit circle at frequency OJk = 2;rk/N. Here HR,o is the resonator at OJ = O.
1m
Izl=l
~------~------~Re
ei'
FIGURE 6-14
Pole/zero pattern for comb filter for N
= 8.
-225
The resonator HR,o(z) has a pole on the unit circle, at z = 1. Since this pole is
not strictly within the unit circle, this filter is not stable, in that its unit-sample
response does not decay to zero with time. One common application of such a
filter is to implement an oscillator.
When this resonator is cascaded with the comb filter, however, the zero
of the comb filter located at z = 1 cancels the resonator pole, making the
combination stable, since the unit-sample response of the total filter has a finite
duration.
The transfer function of this two-stage filter is equal to
U( j<u)::c: Go 1- e-j~
uoe
N l-e-lro
= GOe_i(N_l)rol2sin(Nw/2)
N
(6.28)
sin( W /2)
FlGURE 6-15
Magnitude response of comb filter plub
resonator (N =8).
226
by
(6.29)
(6.30)
HR,N-l ( Z )
= 1 -e -J'7J<IN-I
z
(6.31)
Hence, ~-l = G;. Connecting these two resonators in parallel, the resulting
system function is given by
HR.1(Z)
G1
GN - 1
+ HR,N-l(Z) = 1 - ei21rINZ -I + 1 -e-j21rIN-I
Z
G1+ Gi - [G1e- j21rIN + Gi ei21r/,z-l
1- 2 cos(21c/N) Z-l + Z-2
_ 2 Re[G11- 2 Re[Gl e- j21r/,z-l
- 1- 2 cos(21c/N) Z 1 + Z-2
real-valued.
This procedure can be generalized to include a complex-valued resonator
at each of the N zero locations of the comb filter. These resonators are all
connected in parallel and this parallel combination is then connected in
cascade with the comb filter to produce the total filter H-r(z), given by
(6.34)
h(O) =!
h(l) = 1
h(2) = ~
hen) = 0,
otherwise
227
= (1- z-3)/3
Hc{z) has three zeros, located at z = ei:brk/3, for k =0, 1 and 2. The zero at z = 1
Hc(z)
will be canceled by a real resonator, and the zeros at z = e:tj:br/3 will be canceled
by a pair of complex resonators. The gains of the resonators are equal to
Go = H(eiD) = 2
G1 = H(~/3) = l e-I:br/3
G2 = H(eJ4'</3) =
Note that Go is real and ~
function is given by
=Gr.
! ~/3
2
HRo(z)=-.
1- Z-1
The system function of the parallel combination of the complex-valued first-order
resonators is
l e-j:br/3
Hll,l(Z) + H...,2(z) = 1 -c.1:br/3Z
! ~/3
+ 1 -e-j:br/3z -1
1-2cos(2Jr/3)z-1+Z-l
cos(2Jr/3) - cos(4n/3) Z-1
= 1-2cos(2Jr/3)z-1+Z-Z
-i(1-z- 1)
= 1 +Z-I+ Z -2
The coefticients of the resUlting second-order resonator are real. The filter
structure is shown in Fig. 6.16. The unit-sample response of the two resonators
are shown in the figure. Their sum is equal to the desired unit-sample response.
6.9 SUMMARY
In this chapter, we have described several common methods to implement a
digital filter structure from either its difference equation, its unit-sample
response or its z-transform. We started by defining the terms commonly used
for describing digital filters and then considering the various structures. The
structure determined directly from either the difference equation or the system
function is called the Direct Form I. An alternate view of the same equations
results in the more memory-efficient Direct Form II structure. Digital filters
.TIT.
x(n)
o--iH~~
FIGURE 6-16
Implementation of FIR digital filter using the comb filter with a bank of resonatoD.
PROBLEMS
6.1. Implement the following system functions in the Direct Form I, Direct Form II,
cascade and parallel structures. All coefficients are real.
1
(a) H(z) =(1 + az-I)(I- bz I)
1
(b) H(z) =(1- az-I)3
()
C
H()
z
I-bcos(8)z-1
(1- az- I )(I- 2b cos( 8)' z 1+ b2Z-~
1
1
(d) H(z) =(1- az- I)2 + (1- bZ-I)2
6.2. Implement the following system functions as Direct Form I, Direct Form II,
cascade, parallel and frequency-sampling structures. All the coefficients are real.
(b) H(z)=1_2rcos(O)z-2+rz-4
1-z-2
(c) H(z)=(l-2rcos(O)z l+rz-~2
6.3. Implement the following difference equations in structures indicated by Direct
Form I, Direct Form II, cascade of second-order sections and parallel of
second-order sections. Assume all the coefficients in the difference equations and
filter are real.
(a) (See Example 7.5)
1 +Z-1
1 +2z- 1+z-2
H(z) =A 1-0.8z-11-1.6z 1+0.8z- 2
(e) (See Example 8.11)
1-z~
1-z~
1-z~
H(z) =A--..........,..---=---...,.----=-:--":""":'--:---:--:---::;
1- 0.4z- 1 + 0:9z-2 1 +0.lz- 1+0.7z- 21 +0.6z 1+ 0.9z-2
(f) (See Example 8.12)
CHAPTER
7
FROM
ANALYSIS
TO SYNTHESIS
7.1 INTRODUcnON
In this chapter we extend the analytic techniques discussed in the previous
chapters to be useful for the synthesis of digital filters. We then begin the filter
design section of the book by considering some general issues that should be
addressed at the initiation of a filter design. An alternative to designing the
filter analytically is the intuitive approach of pole/zero placement considered in
this chapter. Intuition dictates that the dips and peaks in the desired magnitude
response can be accomplished by suitable placement of zeros and poles in the z
plane. However, even though a filter can be designed in this manner, there is
no guarantee that another filter, having fewer delays or operations, may not
alSo satisfy the same requirement. This intuitive approach will form the
starting point for the optimal filter synthesis procedures described in the
following chapters. This intuitive and interactive procedure provides a fundamental understanding of the effects produced by poles and zeros on the
frequency transfer function.
An additional benefit of this interactive procedure is that it solves two
problems that exist With the conventional design procedures, described in the
next chapter. The first is that the filtet magnitude response resulting from
conventional design approaches can often be improved by proper placement of
231
additional poles and zeros. The intuitive procedure helps to place such
additional singularities. The second problem occurs when the filter poles lie
very close to the unit circle. Filter design computations require a high precision
in the calculations. If the precision is not sufficient, the locations of the
singularities deviate slightly from those desired and can significantly alter the
magnitude response. The intuitive design procedure offers an alternative. It
indicates how to shift the resulting singularities in the z plane to satisfy the
specification without repeating the tedious computations.
7.2 INTERRELADONSIUPS OF
ANALYTIC METHODS
As an overview, let us consider the flow of information given in Fig. 7.1, in
which the five main categories of analytic techniques are shown interrelated by
the solid arrows. In principle, the results presented in the previous chapters
should allow us to start at any category, the starting point being the
specification to be met by the digital filter, and to determine any other. The
end point for synthesis is usually the digital filter structure and coefficient
values. As the figure implies, the easiest path is usually through the
z-transform. The numbers in the figure indicate examples in the book that
illustrate the corresponding path.
The important practical case in which only the desired magnitude
response is specified is shown connected by a broken arrow to the z plane and
to the complex frequency transfer function. In general, finding the z plane
(h(II)}
5.1- 5.4
FILTER
STRUCfURE
5.36 -45
5.5 - 5.8
7.1-2
H(e"")
H(z)
5.28 - 29
5.10,5.12
5.23- 27
7.3
5.13 - 5.18
POUYZERO
PATTERN
IN
1+ - -7.5.7.6
---:-
111.5
1
~
I
I
(JO>
He)
PLANE
FIGURE 7-1
Relationship of analytic methods. Numbers refer to Examples in the book that illustrate each path.
232
usually given in terms of the magnitude and phase response functions, which
cart be expressed as
ane
(7.1)
(7.2)
Any common factor in H1(ei"') and HR(ei"'), such as the filter gain, has usually
been eliminated in the argument of the arctangent function through cancellation. The following procedure can then be employed to retrieve this common
factor.
OJ
Let N(ei ) and D(ei "') represent the numerator and denominator
polynoIoials in Arg[H(ei"')] that have any common factors removed, or
Arg[H(e iOJ)) = arctan[N(eiOJ)/D(ei"')
(7.3)
Then the imaginary and real parts of H(ei "') are given by
HI(ei "') = aero) N(ei"'),
HR(eiOJ) = a(ro)D(ei"')
where aero) is the real-valued common factor, that may be a function of ro.
We can find a( ro) from the specified magnitude response by substituting these
forms of the real and imaginary parts into Eq. (7.1), to find
IH(ei "') 12
+ D2(ei
a2(ro) = N2(eiw)
W)
(7.4)
the value of aero), the sq,""e root must be taken, allowing both
Phase=O @ro=O
233
Phase = in @ro=O
1m
1m
H,=O
----~~----~-Re
---~-----Re
H.<O
Phase =
-! @Ol = O
1m
----t------Re
H,<O
FIGURE 7-%
Possible values of phase at co = 0 or co = 0+ and the corresponding relationship of the real and
imaginary parts of the Fourier transform.
a(co) as equally valid solutions. The correct sign must be determined from
the value of the phase at co = 0 or co = 0+, as shown'in Fig. 7.2. If the phase is
0, then H I(eiO) = 0 and the sign of a( co) should be taken to make H R( ei~ > O.
If the phase is n, then HI(e iO) = 0 and the sign should be chosen to make
HR(eiO) < O. If the phase at co = 0+ i~ n/2, HR(ei~ =:! 0 and the sign should be
chosen to make HI(ei~ positive and if the phase is - n /2, H I(ejO) must be
negative.
The complex-valued Fourier transform is then equal to
H(ei"') = a(co)D(ei "') + ja(co)N(ei"')
(7.5)
where a( co) contains the correct sign. The Euler identiti~s can then be applied
to convert the sine and cosine functions in the analytic expression of H(ei"')
into complex exponentials. The z-transform is then obtained by replacing
a e-iOJll with aZ-n.
EumpIe 7.1. From Fourier traDsform to z-tnosform. Let
4
jOl 2
IH(e )1 -1z,a cos(co) + a 2
with
lal < 1
234
and
. = arctan [ -a sine w)
Arg[H(e''')]
( )]
l-acosw
. I De'''')
(. ]
= arctan[
N(e'''')
This result must equal the specified magnitude response. Equating the two and
taking the square root, we get
a(w) =
1 - 2a cos( w) + a 2
HI(~
H(ei
W
)
= a(w)D(eiw)
+ ja(w)N(ei "')
-2(I-a ei"')
-2
l-ae
i'"
-2
-az -1
(7.6)
The term in the square brackets can then be simplified by converting the
trigonometric terms into complex exponentials by applying the Euler identities. Then the squared magnitude of the riglit hand side of Eq. (7.6) can be
computed and compared with the specified IH(eimW to find a(c.o).
235
Example 7.2. Alternate approach to solving Example 7.1. From the numerator
and denominator terms of the phase response in Example 7.1, we have
H(ej ",) = (O)[l-a cos(o) - ja sin(O)]
= (O)[l-a
ei"']
1MIT
(1-d/cz-l)
(7.7)
/c-l
where A is the gain constant. Since the pole/zero pattern is not effected by a
constant gain factor in the system function, the value of A must be specified
separately to determine a unique system from the pole/zero pattern.
To find the system function from the pole/zero pattern, the singularities
in the z plane should be considered one by one. When the singularities at z = 0
and z = 00 are included, the number of poles is equal to the number of zeros.
Let us first consider the singularities in the z plane that are not located at z == 0
and z = 00. A zero located at z = Cb for C/c =1= 0 or 00, produces a numerator
term (z - c/c) in the system function. Each such zero should be combined with
a pole at z = 0, to produce the term (z - c/c}/z, or (1- C/cZ-l), for one of the
terms in the numerator of Eq. (7.7). If there is no pole at z = 0, then a
pole/zero pair should be created there and the pole paired with the zero at
z = CIe, leaving the zero at z = O. A pole located at z = d/c, for d/c =1= 0 or 00,
produces a term 1/(z - die}' Each such pole should be combined with a zero at
z = 0, to produce the term z/(z - d/c} = 1/(1- d/cz-l} in Eq. (7.7). If there is
no zero at z = 0, then a pole/zero pair should be created there and the zero
paired with the pole at z = die, leaving the pole at z = O.
After all the singularities lying in 0 < Iz 1< 00 have beeQ eliminated, an
equal number of singularities of opposite types will remain at z = 0 and z = 00.
If there are Mp poles at z = 0, each of them produces a Z-1 term, or a z-Mr
term in the numerator of Eq. (7.7). Hence, Np = -Mp, indicating that the
236
1m
Z= OCJ
jO.9
~~------~------~~Re
nGURE 73
Pole/zero pattern to be implemented as a
digital filter.
pole/zero pattern is that of a causal filter whose first nonzero term in the
unit-sample response is h(Mp). If there are Mz zeros at z = 0, each of them
produces a z term, or a ZMz term in the numerator of Eq. (7.7). Hence,
NF = M z , indicating a noncausal filter whose unit-sample response has its first
nonzero term as h(-Mz ).
Example 7.3. From pole/zero pattem to z-traasform. Let us consider the z
plane pole/zero pattern shown in Fig. 7.3. Applying the procedure described
above first to the zeros in 0 < Izi < 00, then to the poles in 0 < Izl < 00, and finally
to the singularities at z = 0 and z = 00, we have
H(z) = z(1 + O.9Z"1)(1- O.9Z"1)
(1 + jO.9Z"1)(1- jO.9Z"1)
= -3 z(1- O.81z"2)
(1 + O.81z"2)
237
(a)
\H(eJ")\
IT
It)
STOPBAND
PASSBAND
(b)
\H(eJOl)\
VV'flf----------- --..,
It)
__r.__~I~\--~.--~I\~--~.r--J
PASSBAND
TRANSmON
BAND
STOPBAND
FIGURE 7-4
(a) ldeallowpass filter magnitude
response; (b) practical specification to be satisfied by a digital
filter_
Z38
1m
,H(e''''> ,
20
,H(e'''> ,
400
L-=:::::======:::::I
IT
co
'H(e'' >'.B
oI\.
-20
"-'=
oLO...::::..----------IIT co
-20
-40
-40
-60
-60
I
-80 0
co
'H(e">'.B
!\
\
'",
--I
co
IT
FIGURE 7-S
Comparison of magnitude and log-magnitude response curves for first- and second-order recursive
filters.
239
equal to 0 dB. The curve then shows the degree of attenuation and is simple to
interpret. When the gain A of the filter is included in the response, it produces
only a vertical shift without otherwise changing the shape of the curve.
A problem in the evaluation of Eq. (7.8) arises when IH(eiQ)1 = 0, which
results in an infinite logarithmic value and an execution error in the computer
program. This can occur when a zero is located on the unit circle in the z
plane. This problem can be avoided by checking for small values of IH(eiQ)1
and limiting them to be no less than some suitably small positive number. A
value equal to 10- 4 times the maximum value of IH(eiQ)1 over O:s (i):S 1r is
usually adequate. This procedure prevents the argument of the logarithm
function from being zero without significantly affecting the response of most
practical filters. This value of the constant allows the magnitude response to be
plotted over an 80 dB range, from 0 dB to -80 dB, which is adequate for the
filter designs in this book.
To show clearly both the passband and stopband characteristics, the
log-magnitude response must usually be plotted on two different scales: an
expanded dB scale to show the response in the passband, where the
attenuation is small-typically between 0 and -4 dB-and a compressed dB
scale to show the response in the stopband, where the attenuation is
high-typically IH(eiQ)ldB < -60 dB.
The practical design utility of the log-magnitude response comes in
cascading filter sections. The total filter log-magnitude response IH-r(eiOldB is
then equal to the sum of the log-magnitudes of the individual sections
IH/(eiQ)ldB. If there are N sections, then the overall filter response is given by
IHT(eiQ)ldB =
2: IHj(eiQ)ldB
(7.9)
Functions that have relatively simple forms, like those produced by single and
complex-conjugate singularities, are more readily visualized when added than
when they are multiplied. This observation will prove to be useful for the
intuitive filter design procedure presented later in this chapter.
240
lIDB
for IsNsNH
(7.10)
This equation is invalid when HMAG(N) = 0 which can occur when a zero lies
on the unit circle at WN = 1C(N - 1)/(NH -1). Hence, values of HMAG(N)
less than some small number E should be set to E. The value E = 10-6 (equal to
-120 dB) is adequately small.
This output of LOGMAG should be plotted twice, once in expanded
vertical scale for the passband specification, and a second time in compressed
scale for the stopband specification. This plot is performed with the subprogram given in Appendix A named
PLOTLM(HTOT,DBVAL,SPEC,IFl,IF2,NPRNT)
where
IITOT
a-
UI'8 ...
1....
I:~;!!ft
I
pole at ae
L ... M
_
_ l _. _ _ _ _ _ _ _ _ _ _ _
I _ _ _-.
-I."
II
.....Ij
..
MrO,t .........
tr~eAC1
L ... 00
.. _ _ _ _ _ _ _--::=-.
.
-----I
II
-lO.'I
"'j
I
I
I
.....!--_._----_.._ - - -
'S.O+
I
I
I
I
I
-10."
-15.e+
-U.'-I
II
-1.....-_.-
tIMid
"'1
~I----~--~---~I
~.~
I
I
1
-u.~
I -21 ,,_
-1....I
I
I
I
-M.'
.......................
treq\l.ac:)'
-!S." I
N.N
1:~;'~I..' - - - - - - . - - - - - -
I
I
'.
I
I
I:~:!!ft
I
'.Nt L
241
"
-..
j-'-'
I
I
__
.!
_ _ _ __.
_ _ _ __
FIGURE 7~
Log-magnitude response curves produced with PLOTLM subroutine for elemental sections. a)
zeros. b) poles. DBVAL= -20, SPEC = -3, IFl=IF2=O.
Z42
poles and zeros in the z plane, the gain constant A of the filter must be
computed to meet the specification. In this section, we describe how this gain
constant is determined.
For illustration, let us consider how the gain constant of th-e digital filter
is computed in order that the maximum value of its magnitude response is equal
to one. We start with a digital filter pole/zero pattern whose magnitude
response satisfies the specification to within a gain constant. For the pole/zero
pattern having zeros at z = ek, for 1:s; k :s; N, and poles at z = db for
1 :s; k :s; M, the transfer function is given by
(7.11)
=AHpz(ei"')
where H pz(ei "') is the transfer function computed directly from the poles and
zeros by assuming that the gain constant is equal to one. The gain constant A
needs to be determined, such that the maximum value of IH(ei"')1 is equal to
one. ~o find the exact value of A, we must find the frequency lI)m for which
IHpz(e'QI)1 takes on its maximum value. Then the gain factor is equal to
(7.12)
The standard way to find lI)m is to compute the derivative d IHp.. (eiQl)I/dll), find
the values of lI) for which it is equal to zero, and evaluate IHp .. (ei "')1 at these
values to find the global maximum over O:s; lI) :s; n. In practice, however, the
procedure is very tedious because of the complicated analytic form of the
typical IHp ..(ei QI) 1 and of the presence of multiple maxima and minima.
Fortunately, there are two methods to find reasonably accurate approximations to the exact gain value that are usually satisfactory in practice.
FIrst, it may be sufficient to let the filter magnitude response be equal to one at
some convenient frequency in the passband and disregard the maximum value,
which may be slightly greater than one. For examJ>le, for lowpass filters, it is
reasonable to specify that the magnitude response at lI) = 0 be equal to one.
This can be easily accomplished by setting
A = 1/IHp.. (eiO)I.
(7.13)
The gain is readily evaluated since
(7.14)
For highpass filters, the magnitude response at lI) = n can be set to one in a
243
similar manner. For bandpass filters the evaluation is slightly more complicated
because the terms in Eq. (7.14) are complex-valued.
The second method of determining an approximate value for A involves
computing the DFT sequence {Hpz(k)} , finding t1)e maximum value of the
magnitude response sequence {IHpz(k)l}, denoted by IHpzlmax, and setting
= 1/IHpzlmax.
(7.15)
= lO-HMAXI2O
(7.16)
Determining the gain constant value from the DFT sequence is reasonably accurate if the DFT is computed at a sufficiently dense set of points, or
such that the form of IHpzC ei 0I is readily apparent from a graph of the DFT
sequence {lHpz(k)l. Then IHpzlmax will be approximately equal to the maximum value of IHpz(eiOI. Since computing the DFT is readily accomplished on
a computer, we will use this latter approximate method for determining the
value of A in the filter designs in this book.
X(eIO
(7.20)
244
This separation is performed such that the desired part of {x(n)}, given by
{xl(n)}, lies in the passband of the filter, while the undesired part {x2(n)} lies
outside the passband. That is, XI(eiQ is nonzero only for WI:i w:i W2, and
X 2(ei Q is zero in this range. For example, {Xt(n)} may be the signal on a
desired radio channel and {x~n)} represents the signals on the other channels.
Since only X1(eiQ passes unattenuated through the filter, the output
spectrum is given by
Y(eiQ =X1(eiCO ) e i Ars(HCel-
(7.21)
H the filter has a linear phase response in the passband, or
Arg[H(ejQ] = -kw
for Wl:i W :i W2
(7.22)
= X1(ejCO) e-ikco
Y(eill
(7.23)
meet
then
{y{n)}
= {cos coo{n -
= e-;.t..
k + cos(2coo{n - k}
As shown in Fig. 7.7, the shape of the signal is maintained but only a delay of k
samples is experienced.
Now consider a filter having the same magnitude response, equal to 1, but
having the phase response given by
Arg[H{ejOl)] =
f -rc/4
.1.-rc
for 0 $: co $: 3coo/2,
for 3coo/2 < co $: rc
24S
(x,(n))
...
LINEAR-PHASE OUTPUT
..
FIGURE 7-7
Illustration of phase distortion.
246
(7.25)
This IIR system function has Np + NF relevant zeros at z = Ck> for l::s; k ::s;
Np + NF , that can lie anywhere in the z plane, and M relevant poles at z = dk ,
for l::s; k::s; M, that must be located within the unit circle for stability. The FIR
filter system function is more restricted, in that it is expressed as only a
polynominal in
or
Z-I,
Np+NF
HFIR(Z)=AzNp
IT
(l-CkZ- I )
(7.26)
k=1
This FIR system function has Np + NF relevant zeros that can lie anywhere in
the finite z plane, and no relevant pales.
We now give some general observations regarding digital filter design.
Let us' consider a specification that can be satisfied e~ther by an IIR filter
having M poles and N zeros, where N = Np + NF in (7.25), or by an FIR filter
having K zeros, where K = Np + NF in (7.26). Then the following general
observations apply.
247
Obseroation 1. The IIR filter is usually the more efficiellt design in terms
of computation time and memory requirements. The IIR filter is faster because
M + N will typically be less than K to satisfy a desired specification. The
number of multiplications for an IIR filter is equal to M + N compared with K
for the general FIR filter. As shown in Chapter 6, for a linear-phase FIR filter,
a special structure can be employed that requires only (K/2) + 1 multiplications. Since K delays are required to implement an FIR filter, while only the
maximum of NF + M or NF + N p in (7.25) for an IIR filter, the IIR filter also
requires less memory.
Obseroation 2. The practical specification can approach that of the ideal
filter by making E, 6, and (os - Op) in Fig. 7.4 all approach zero. However,
the values of both K and M + N increase as the specification approaches the
ideal. This, in turn, increases the computation time and memory requirements
of the design. Hence, there is tradeoff between the accuracy of the approximation and the computation time.
Obseroation 3. FIR filters are always stable, since the poles of the FIR
system function are located at z = 0 (and at z = 00 for noncausal filters). The
design of IIR filters with poles close to the unit circle must be designed with
care to ensure that instabilities do not occur. It is not uncommon to have poles
that were intended to be close to the unit circle actually fall outside the unit
circle in the implementation, owing to round-off errors in the calculations. In
this case, the implemented filter is unstable.
These general rules are illustrated in the design methods described in this
and the following chapters. The first method is the interactive and intuitive
procedure for designing a filter described in the next section. This procedure
does not generally result in an optimal filter, or one that has the minimum
number of delays or multiplications. However, it does lead to an intuitive
understanding of the effects of poles and zeros, and provides a better
appreciation of the conventional design procedures described in the following
chapters. An additional benefit of this interactive procedure is that it solves a
problem that exists with the conventional design procedures. The filter
magnitude response resulting from conventional design approaches can be
improved by proper placement of additional poles and zeros. The intuitive
procedure helps in deciding where to place such additional singularities.
248
specification. The final filter structure is then the cascade connection of the
elemental filter sections that generate these real and complex-conjugate
singularities.
To assist in the design procedure, the following rules form the basis for
pole/zero placement:
Rule 1. The magnitude response specifications will consist of passband
and stopband regions. These bands are mapped onto the unit circle, as shown
in Fig. 7.8, to assist in the placement of the singularities. If a complex
singularity is specified, then it is understood that the complex-conjugate
singularity is alsO required, The log-magnitude response of the singularities are
computed and compared to the specification at 65 points equally spaced over
0:$ W :$ Jr. For easier interpretation, the angles of the singularities with respect
to the real axis will be given in degrees, rather than radians .
. Rule 2. All the poles in the design will have a radius rp lying in the range
0.6:$ rp < 0.96. The upper limit guarantees that the unit-sample response of
each elemental section will not have significant values beyond the 128th point.
This prevents truncation errors from affecting the log-magnitude response of a
particular elemental filter section. The lower limit is meant as a guide to avoid
poles having anemic magnitude responses.
Rule 3. The filter design is performed interactively by examining the
log-magnitude response after each additional singularity is added. In some
cases, the singularity position must be modified or removed. The effect of an
existing singularity can be canceled by specifying the opposite singularity at the
same position. Of course, such pole/zero cancellation pairs are not included in
the final filter design.
HIGHPASS SPECIFICATION
IH(e'''')1
LOWPASS SPECIFICATION
IH(el"') I
1-
!~~?'llllJ
1-
1m
1m
Izl=1
~--------~--------~Re
BANDPASS SPECIFICATION
BANDREJECf SPECIFICATION
IH(e!"')1
IH(el"') I
1
1-
I-~~~~
W/UiH/iJ4
~~--~----~~""aA~~w
II
1m
~----~~~------~Re
FIGURE '-8
Mapping frequency regions in the specification opto the unit circle in the z plane.
t
249
150
band. For maximum a~enuation, the zero is placed on the unit circle.
Hint 3. When the log-magnitude responses of two singularities are added
together, the location of the peak (for poles) or of the valley (for zeros) may
shift owing to their interaction. This effect is shown in Fig. 7.9. In general,
when two poles are close to the unit circle or distant from each other, there is
<a)
(b)
pole at
0._ L
00
pol'. at p
I
I
..
I
.."_
_------------_
sa e._ L
o
__
-D.,";,--------~-__
dO.OO
-I
I
-1100;
_A~.----------~.-q-
------I
L IOO.GO
1:~:)la
':~I.
~1
."~
-
-~'i
U~
1,1
III
I
--t
-........---------:-..---------------!
L 10.00
aZII1 at 0.100
-::1
"
- . I
-".0.I
- .
-~'L.-
-10.0+
I
I
I
I
. ..
-"j
~'i
pole - '
0.100 L 10.00
,:,:,10
I
~~ldB
L 100.00
I
I
i - II
-15.0.-
II
II
-JO.~-------,_--------!
I:~'IGI
lac.J1a
00'1
~I----~--------I
~~
II
II
-10'"
-'''OJ
I
I
I
I
I
-~-------------o
I
I
I
....""
~I-----~--~-----~
-t'j
I
-11.0+
-u.o;
-"
-~~~.---------~-~-.---------
FIGURE 7-1)
Interactions of two poles. a) Interaction produces two peaks when poles are close to the unit
circle. b) Interaction produces one peak when poles are farther from the unit circle.
251
little interaction. When the poles are far from the unit circle or close together,
their interaction is greater.
Two eamples of performing the filter designs are given next. An
algorithm for programming this procedure is suggested in Ute next section.
Example 7.5. Interactive design of a Iowpass filter. Let us consider the
following lowpass specification:
passband:
for 0 ~ I) ~ 1t/4
stopband:
lin
(a)
./'" PASSBAND
--~------------~'-~~----*----r--Re
FIGURE 710
Interactive design of lowpass filter. a) Pole/zero pattern in z plane. b) Sequence of log-magnitude
response curves. c) Digital filter structure.
252
I:~!s.
1:~:'la
I
I
,-!
>"'1
>"j
__
- .ot'
I
I
~.,~.i~. ______~~~MMMM~~~M_MM~_~"~"~"""""~!
IIlap1.&ntJ "
. . . UI'O . , . . 1.000
--
,. u
pole
as ..
,I
. I,
I
I
I
I
....., ---"
, ,
I
I
I
..... 0.
a1IIplaritJ' "
18
UI"O
>1'' ,1
I
-'.0+
-j--
-I-
--
-40.0
-I
at .. 1.000 L 121.00
~1!s._
18(.".
,,
......,
I
--
I
I
I
I
-I
I
-I
-JCl.O+
I
I
,
I,
I
>Ui
-1.0
-J.o.
I
I
I
I
I
I
I
I
-" ,
--
I
I
...0.0
I
I
I
I
I-
~~.
0.0
>"',
I
I
I
I
I
I
I
I
I
I
I
I
-II
-II
I
0.100 L 10.00
lat-J1a
I-
--
.......
-'.0+
'1
- -II
I
-I
-..~.'--------I,--------~
I
I
I
I
I
I
-10.0.
II
I
I
I
I
-1.0+
"',,-
.......I
~"
,--
~"'j
I
I
I
I
-lI.o.
I
I
I
I
II
.....0
>U'j
I:~
I
II
I
-1.0
I,
--!-
L 00
lae.llem
0.0
,
I-
-I
I
~..I---1
.. :----~~*~*------**~----~
DGURE MOb
>U'j
,I
--
--
.. j
-,
.....'j
--I
~I-----------------~~---------------~
______________ ____MM__________
I~
dIplWItr "
...
1:~:)t91
t:~:)la
I
I
I
I
!..
-. a!
...
-u.o+
-i
-10.0+
-fJ.o+
- . .,
III
.o----i------------.;
--
-4....
~"""'.poHllta-O.@L
--
~A
..- - - - - - -____~........................__~
11I1."g
'.'\
"1J.Oj
-"'1
I
I
I
-....I
-..
..
..oa
I:~-t---------------110
Z53
-10.0+
. t_
I1
-4 ....- - - -
---~-....- -....- - - - . ;
-00'I
--
~------~~--------~
.I
....--....-----w
.qA~~------------~--
0.0027
z(n)
y(n)
FIGURE 7tOe
2S4
Singularity 3: A zero is placed at the edge of the stopband on the unit circle.
Singularity 4: A pole is placed at z = 0.ge~j5O" to boost the magnitude
response in the passband. A mmPmum is produced slightly past the edge of the
passband. Having such a maximum at the edge simplifies the procedure to satisfy
the passband requirement.
Slnplarity 5: A zero is placed on the unit circle at the location of the
maximum of the response in the stopband. The stopband specification is then
nearly satisfied, but the response at the edge of the passband has been reduced.
SingularIty 6: A pole is situated at z = O. 75e~j4O" to boost the response at the
edge of the passband.
SIDgularity 7: A pole is added at z =O.6e#J8" to boost the response in the
middle of the passband. A check of the stopband indicates that it too is satisfied.
The final filter system function is given by'
0.0027(1 + z-I)(1 + z-~(1 + 1.03z- 1 + Z-2)
H(z) = (1-0. 7z- 1)(I-1.16z- 1 +0.81z-2)(1-1.15z- 1 +O.56z 2)(1_ 0.95z- 1 + 0.36%-2)
The filter structure is shown in Fig. 7.1Oc. The gain constant 0.0027 was
determined by finding the maximum value of the ~og-magnitude response
sequence and applying Eq. (7.16).
-1 < IH(ei"')ldB s O.
for O.42n' s
l.r)
S 0.61.1r.
stopband:
l.r)
S.1r.
25S
_STOPBAND
STOPBAND'"-.
--~------------~~~~-L--------6---Re
<a)
=::::::::=::::1
'!::'
a ..
abpbrttJ 0
"""I..
1.1
I
-s
b ....0
1.1iOO
L lID
~I
I
II
.I
I" '.1
I
!
I
I
I'
-1."
I
I
-I ...
....I
~
--
:1
.......----.
1.c.,I.
I
I
I
I
-u ...
--
I
I
I
II
0
1 0
J..-
-I
I
I
I
-11.01>
-<J.G<I
__.LI
10
II
II
I
I
I
I
I
I
I
I
'0
II
il
I I
--I I
"-
01
01
II
I1--0II
71..,
.
: ............... L
III pole at .. 1.110 L w
~ "
lat.J1ca
rl
I
I
-u.j
-SOo-;
I
I :
"I
I
0_0
--
I-I
I II
0-1
1-
I'
I
I
I
I
I
I
1
I
I
I
-to.O;-li----_------,I~
-<J.Oj:
0
(b)
FIGURE 711
Interactive design of bandpass filter. a) Pole/zero pattern in z plane. b) Sequence of log-magnitude
response curves. c) Digital filter structure.
256
II1IIp1....str "
~tr
,., b
&W'O al . .
a N at. . .
1.000 L tn.OII
1.000 L 11.00
.
-1"1
I
-a.OtI
I:~~I'--~--~--I
I
I
1II
_~
-10."1
I
I
I
......!
-'.04-I
--
...
0 --.:~-.--~I__
I---""';
I
I"
,-
I
.
I
I
I'
I.
I.
I
-, .
-I
I'I
I
1
I
I
I
I
.I
-I
-,-
1-
~.,~~~~-------------
y(n)
x(n)
FIGURE
'Dc
yes
no
I indicate subroutines
FIGURE 7-U
Logic diagram for interactive filtet design
prog~jlID.
257
258
sections are computed and accumulated in {HTOT}. The values in the HTOT
array are superimposed on the specification curve with PLOTLM.
The interactive filter design procedure should perform the following
steps.
Step 1. Input the desired singularity type (pole or zero) and position.
Step 2. Compute the corresponding filter section log-magnitude response
7.11 SUMMARY
In this chapter, the analytic techniques discussed in the previous chapters were
summarized in such a way as to be useful for the synthesis of digital filters. The
filter design section of the book began by considering some general issues that
should be addressed, before: a filter design is initiated. A procedure for
designing a digital filter by intuitive placement of poles and zeros in the z plane
was described. This procedure provided an understanding of the effects of
poles and zeros on the transfer function and an appreciation of the conventional filter design techniques to be studied in later chapters.
In the next two chapters, we will present the theory for placing the poles
and zeros in the z plane from the magnitude response specification. This
theory will help to formalize the intuitive procedure.
PROBLEMS
7.1. Determine the system function H(z) for each of the following .magnitude and
phase responses (Let Arg[H(ei<)] =0):
a) IH(ei",W= 1/[5 -4cos(w)]
Arg[H(ei"')] = arctan[-2 sin(w)/(2cos(w) -1)]
b) IH(ei OJ)1 2 = 17 - 8cos(2w)
Arg[H(eJ"')] = arctan[4sin(2w)/(1-4cos(2w]
c) IH(ei"')1 2 = 4/[1- 2a 2 cos(2w) + a4 ]
Arg[H(eij] = arctan[-a 2 sin(2C1)/(1- a 2 cos(2w]
7.2. Determine the system function H(z) for each of the following magnitude and
phase responses:
a) IH(ei"')1 =2[1-cos(w)]
Arg(H(eiCD)] = -re, for all w
b) IH(ei")1 = 2Isin(w/2)1
Arg[H(ei"')]=(re - w)/2, for 0< w:s re
=(-re - w)/2, for -re < w <0
c) IH(eICD)I=4Isin(w)1
Arg[H(ei"')]=-re/2, for 0 < Ql < re
=re/2, for --re < w < 0
7.3. Determine a valid system function H(z) for each of the following magnitude
responses:
a) IH(eJaJ)1 = Icos(w)1
b) IH(ei"')1 = Isin(2w)1
7.4. Implement three digital filters that have the same structure but different coefficient
v8Iues and that have the same magnitude response, given by
IH(ei"')1 = 1 +cos(w)/2.
Hint: assume zero phase and determine the pole/zero pattern.
7.5. Implement the digital filters in Examples 7.5 and 7.6 in the following forms: a)
Direct Form II structure, and b) parallel connection of second-order sections.
7.6. Consider a second-order all-pole filter having poles at z = re~i8 and zeros at z = O.
Find a general analytic expression for the frequency at which the magnitude
response is a maximum. Evaluate this frequency and the maximum magnitude
when (J =rc/6 and re/2 and r =0.5 and 0.9.
COMPUTER PROJEcrs
7.1. Magnitude response curves fqr poles and zeros
.
Object. Determine the log-magnitude response curves for single and complexconjugate singularities as a function of radius and angle in the z plane.
260
LOGMAG(HMAG,NH,HDB).
ADaIytic results
(a) Determine the log-magnitude and phase response for first and second-order zeros
and poles given below.
(b) Determine the maximum value of the magnitude response.
(c) Verify the locations of the half-power frequencies for the singularities below.
Convert these frequency values to the nearest index values in the DFf sequence
and indicate these on the computer plots below.
Computer results
(a) Compute and plot the log-magnitude responses using PLOlLM with
DBVAL= -20., SPEC = -3. and 1Ft =1F2=0.
(b) For each singularity draw the digital filter block diagram. Determine and
include the filter gain A that makes the maximum of IH( ei")1 over O:S; Cl) :$ .1t'
equal to 1. Indicate the procedure you used to determine A.
zero at z = t
zero at z = -0.75
pole at z = 0.96
pole at z = -0.6
261
CHAPTER
8
INFINITE-IMPULSE
RESPONSE
FILTER
DESIGN
TECHNIQUES
8.1 INfRODUcnON
Infinite-Impulse Response (UR) filter design procedures are extensions of
those originally developed for analog filters and start with the design of the
appropriate analog filter in the analog frequency domain. In fact, IIR digital
filters are commonly used to replace existing analog filters. The complexvalued Laplace variable, s = (J + jQ, plays the same role for the analysis of
analog filters as the variable z for discrete-time filters. The three most
commonly used analog filter synthesis techniques for designing a lowpass filter
in the s plane are the Butterworth, Chebyshev and elliptic techniques. These
three are described and their advantages and disadvantages are compared. The
impulse-invariance and the bilinear transformation methods are then presented
for translating the s plane singularities of the analog filter into the z plane. A
digital filter can then be implemented from these z plane singularities using the
methods described in the previous chapters. Frequency transformations are
employed to convert lowpass digital filter designs into highpass, bandpass and
bandreject digital filters. All-pass filters are employed to alter only the phase
response of the IIR digital filter to approximate a linear phase response over
the passband.
262 .
263
(8.2)
The analytic form of the last identity indicates that the singularities of
H(s) H( -s) in the s plane are symmetric about the jQ axis. To obtain a stable
system function from H(s)H(-s), the poles that lie in the left half of the s
plane are assigned to H(s). The assignment of the zeros is arbitrary.
Eumple 8.1. Analog lowpass filter. Let us consider the lowpass power transfer
function given by
IH(jQ)12 = (a 2 + Q2)-1
H(s) = [s + a]-l
264
IHun) IdB
-1-~~
Op
(14041t)
Os
(82681t)
(8.3)
where Qe is the cutoff frequency. When s = jQe, we have IHB(jQdl z = !, or in
logarithmic units, IHB(jQdldB = -3. Since the highest power of s in the
denominator of Eq. (8.3) is 2N, HB(S) HB( -s) has 2N poles. These are located
in the s plane at the values of s for which
(s/jQd 2N = -1
The roots can be found by mUltiplying both sides of Eq. (8.4) by (jQd
give
(8.4)
2N
to
(8.5)
Since the value of a complex number does not change when it is multiplied by
eiZ"m, for integer values of m, we have
S2N
o.t! ei,,(N+2m+l)
(8.6)
265
jn
11
=3
,,
n=4
\
\
\
\
\
\
~~-----/~/\-\--+-~*-~a
I
I
--~----~~--~-+~a
... '
.......................
\
........
\
\
FlGURE 8-2
Pole pattern in the s plane for HB(S) HB ( -s) for N = 3 and N = 4.
The distinct locations of the poles are found by taking the 2Nth root, to give
Sm
. (N +2m
= gcexP [ )11"
2N +
1)J
for 0 $ m $ 2N - 1.
(8.7)
IHBOQ)I' ~
(~
1+ Qc
(8.8)
For large g, the magnitude response decreases as Q-N, indicating the lowpass
nature of this filter. The log-magnitude response is computed as
IHB(jQ)ldB = 10 loglo IHB(jQ)12
= -10 loglo [1 + (Q/Qc)2N]
266
_~r---=:::::,....
N= I (-6 dB/octave)
'~:---~~--
-20
-40
-wr-------r-------------------~~~----
_~~------L-------------------------__.
Oc
radls
FIGURE 8-3
Analog log-magnitude response curves for Butterworth lowpass filters of order N.
-1 < IH{jO)ldB:s 0
stopband:
IH(jO)ldB < -60
(-60 dB)
267
-6N = -59/2.56
or
= 3.8
Since the order f the filter must be an integer, we choose the next higher integer
value, or N = 4.
We must qow compute the value for the cutoff frequency Qe, which is also
the radius of th~ Butterworth circle. One value for Q e is obtained by solving the
inequality at thel stopband edge with N = 4, or
IHBUQsW = [1 + (Q s/Qc)2Nrl < 10- 6
or
Qe < Qs X 1O-- 6I2N = Qs/5.62 = 1470.3Jr
Let us choose de = 1470Jr. This inequality assures that the stopband specification
will be met with! these values of Nand Q e . We need to test whether the passband
specification is ~lso satisfied, that is, we must test whether
'fBOQpW = [1 + (QpfQc)2Nrl :> 0.794
( = -1 dB)
Evaluating, we jind
[1 + (1404/1470)8r 1 = 1/1.692 = 0.59
The result is be~ow the passband specification. Hence, a fourth-order filter is not
sufficient. This is not unreasonable, since we employed a large Q argument to find
a first guess for N.
Let us inQrease N to 5. The stopband specification gives the Q c value:
Qe < Q s X 1O- 6I2N = Qs/3.981 =2076.8Jr
Using Q e = 2076Jr to test the passband specification, we get
,lHBUQpW = [1 + (1404/2076) lOr 1= 1/1.02 = 0.98
Hence, the stdpband specification is met and the passband specification is
exceeded with N= 5 and Q e = 2076Jr.
We could .also obtain a filter in which the passband specification is met and
the stopband specification is exceeded by using N = 5 and solving the passband
specification for: the value of Qe . Doing this we get
IHBUQpW = [1 + (Qp/Qc)1'1-1 > 0.794
or
10glO Qe > 10glO Qp -
1~ 10g(0.;94 -
1)
to give Qe> 1607Jr. We then use this value to find the stopband attenuation
IHt.jQS)12 = [1 + (Q s/Qc)2Nrl = 7.69 x 10-& (= -71 dB)
Both filters m et or exceed the specification. The particular one to choose
depends on ot er considerations in the design. To continue the example, we
choose N = 5 and Q e = 2076Jr.
Butterwot pole locations. The locations of the N poles on the Butterworth
I
268
circle of radius
Sl
Qc
= -2076Jr,
These are shown in Fig. 8.4(a). The system function is then given by
R (s) _
B
(2076Jr)S
[s + 2076Jr][S2 + 3359ru + (2076Jr)2][s2 + 1283ru + (2076Jr)2]
The log-magnitude and phase responses for this filter are shown in Fig. 8.4(b).
There are several interesting features that are peculiar to the Butterworth
magnitude response:
1. It decreases monotonically as the frequency 0 increases from 0 to 00. This
characteristic is evident from the functional form given in Eq. (8.8). It is
due to the configuration of the poles lying on a circle in the s plane. The
other two analog filter design procedures described below will not have this
smooth magnitude response charactersitic.
2. The magnitude response is maximally flat about 0 = 0, in that all its
derivatives up to order N are equal to zero at 0 = O. To illustrate this, let u~
make Oc = 1 and N = 1 for simplicity. We then have
IHB UO)1 2 =
(1 + 0 2)-1
(8.10)
jn
j20761t
(
(a)
/
FIGURE 8-4
Fifth-order Butterworth analog
lowpass filter results. a) Pole/zero
pattern in the s plane. b) Logmagnitude and phase responses.
269
PASSBAND:
IHB(jn)ldB
o
-I~-~-+----------
-2
-3
4L-__
L-~~
________________
1404n
10,000 It
n (radls)
STOPBAND:
IHBun)ldB
0----
-10
-20
-30
-40
-50
-rol~---~-----~~~--
-70
_801L-_ _ _ _ _-------~-----J
8268n 10,000 It
n (radls)
Arg[HBun)]
It
_ _ _...;;.;10;,,::,000 It
-It
FIGURE 8-4b
which is zert at Q
= 0_
-2Q
(1 + Q2)2
(8.11)
d2 1H80 Q
dQ 2
e~ual
to -2 at
= O.
270
3. The phase response curve approaches - N:n: /2 for large 0, where N is the
number of poles on the Butterworth circle in the left half s plane. When the
value of N is large, the discontinuities in the principal value of the phase
response occasionally cause difficulties in the interpretation of the phase
curve.
The Butterworth filter is the easiest one to design. It is commonly used
because the smoothness of the magnitude response. This smoothness is bought
at a price, however. The Butterworth characteristic requires a relatively large
transition range between the passband and stopband. We next consider the
Chebyshev filter design that has a smaller transition band, but its magnitude
response will not be monotonically decreasing with frequency.
CHEBYSHEV FILTER DESIGN PROCEDURE. The Chebyshev filter is optimum in that for the given passband and stopband levels, it has the smallest
transition region, Os - Op, of any filter that consists only of finite poles. Such
all-pole filters have all their zeros at s = 00. The Chebyshev filter is defined by
(8.12)
where fJ is a measure of the allowable deviation in the passband, as shown
below, and
(8.13)
is the Nth-order Chebyshev polynomial. The corresponding power transfer
function is given by
(8.14)
The Chebyshev polynomials can be determined from the following recursion
formula:
for N;;:: 1
with Co(x) = 1 and C 1 (x)
Table 8.1.
= x.
TABLE 8.1
CN(x)
0
1
2
3
4
5
x
2x 2 -1
4x 3 -3x
8x 4 _8x2 + 1
16x s - 20x 3 + 5x
(8.15)
271
forOsOsOp
(8.16)
Whereas the frequency value important for the design of the Butterworth
filter was the cutoff frequency Oe, the relevant frequency for the Chebyshev filter is the edge of the passband Op. This allows the Chebyshev filter
to be specified directly in terms of the two important design parameters
consisting of the passband frequency and the allowable deviation in the
passband.
2. For Ixl 1, ICN(x) I increases as the Nth power of x. This indicates that for
0 Op the magnitude response decreases as O-N, or the log-magnitude
response decreases by 6N dB/octave. This large-frequency result is identical
to that for the Butterworth filter.
Where the Butterworth filter poles lie on a circle in the s plane, it can be
shown that the poles of Hc(s) lie on an ellipse. The ellipse is defined by two
circles determining the major and minor axes, as shown in Fig. 8.5a. If we
define the parameter p as
P=Jl-1+Y1+Jl 2
then r, the radius of the circle defining the minor axis, is equal to
r = Op(pliN _ p-lIN)/2
(B. 17)
(8.18)
where N is the order of the filter. The radius R of the circle defining the major
axis, is equal to
(8.19)
The locations of the poles on the ellipse are found by first finding the
Butterworth pole locations. These are then projected onto the ellipse by
keeping the frequency constant, as shown in Fig. B.Sb.
The locations of the Chebyshev poles can be determined without actually
constructing the ellipse. As shown in Fig. 8.Sb, the ordinate (jO) locations of
the poles are defined by the intersections of the N lines with the larger circle.
The abscissa (0) locations are defined by the intersections of the lines with the
smaller circle. For example, let us consider the line that makes an angle 8 with
respect to the positive real axis. The corresponding pole of the Chebyshev
filter is located in the left half-plane at s =Sp, where
Sp = r cos( 8) + jR sine 8)
(8.20)
As with the Butterworth filter, the poles of Hc(s) Hc(-s) that lie in the
left half of the s plane are assigned to the system function Hc(s), and all the
zeros of the Chebyshev filter lie at s = 00.
272
"""""UCfiON
ro DK>IT"-
""~""""""
(a)
"!l
CHEBYSHEV
ELLIPSE
-+------~----~~----~----_++u
(b)
jn
BUTIERWORTH POLES
\
ftGURE 8-S
Chebyshev ellipse. a) Construction of ellipse. b) Pole pattern in the s plane for
He<.s) He<. -s) for N = 3.
Example 8.3. Chebyshev lowpass analog filter design. Consider the same
lowpass specification given in Example 8.2:
passband:
-1 < IH(jQ)ldB :s 0
stopband:
IH(jQ)ldB < -60
273
Value of fl. The value of /1. is determined from the passband ripple, or
10 10g(1 + /1. 2)-1 > -1 dB
This gives the value as
/1. < [10. 1 _1]112 = 0.508
We will take /1. = 0.508.
Value of N. The order of the Chebyshev filter is determined from the
stopband inequality
114
and
r = 1404n (4.17 114 - 4.17- 114) = 702n(1.43 - 0.67) = 533n.
2
jn
(a)
FIGURE 8-6
Fourth-order Chebyshev analog lowpass
filter results. a) Pole/zero pattern in the
s plane. b) Log-magnitude and phase
responses.
274
PASSBAND:
IHc(fil)ldB
-2
-3
-40
1404 It
10.000 It
n (radls)
b(i)
STOPBAND:
IHcun) IdB
n (radls)
b(ii)
Arg[Hc(fil)]
It
10.000 It
n (radls)
-I[
ftGURE 8-6b
b{iii)
Pole IocatiollS. Since there are four poles, the four lines dividing the s-plane
have angles equal to 7:Jr/8 and 5:Jr/8 as shown in Fig. 8.6(a). The four poles of
the Chebyshev filter are then at
SI.2
and
S3,4
275
L06Jt'4 x 1012
[S2 - 490Jt's + (748Jt')2][S2 - 203.4n:s + (1376nY]
R~)-~---------=~------~~=
C
The log-magnitude and phase responses for this Chebyshev filter are shown in
Fig. 8.6(b).
Owing to the closer proximity of the Chebyshev filter poles to the jQ axis
illan those in the Butterworth filter, the magnitude response of the Chebyshev
filter exhibits a ripple in the passband. There is a peak in the passband for each
pole in the filter, located approximately at the ordinate value of the pole. Even
though the passband contains ripples, the magnitude response beyond the
passband is a smooth function that decreases monotonically with frequency.
But, of importance of implementing the filter having the smallest number of
components, the Chebyshev magnitude response exhibits a smaller transition
region to reach the desired attenuation in the stopband, when compared to the
Butterworth filter.
The Chebyshev phase response is similar to that of the Butterworth filter,
in that it decreases monotonically to -NJr/2. In the example, this asymptote is
equal to -2Jr.
Because of the proximity of the Chebyshev filter poles to the jQ axis,
small errors in their locations, caused by numerical round-off in the computations, can result in significant changes in the magnitude response. This is
especially true in the passband. Choosing a smaller value of IJ will provide
some margin for keeping the ripples within the passband specification.
However, too small a value for IJ may require an increase in the filter order.
In *e Butterworth and Chebyshev filters, we were constrained to use
only finite ~les to achieve the magnitude specification. It is reasonable to
expect that if relevant (finite) zeros were included in the system function, a
lower-order filter can be found to satisfy the specification. These relevant zeros
.could serve to achieve additional attenuation in the stopband. The elliptic
filter, described l1ext, does exactly this.
ELLIPTIC FlLTE, DESIGN PROCEDURE. The elliptic filter has thp smallest
transition band of the three approaches described here, but is the most
complicated analytically. The elliptic filter is defined by
(8.21)
276
tor of HE(S) HE( -s) and its roots would then become the zeros of the system
function. For example, although simpler than the first Jacobian elliptic
function, let us consider the following rational function,
(S2 -1)
(s) = (S2 + 1)
(8.22)
Then
(8.23)
The system function is then given by
H(s)H(-s) =
1
2(3'2-1)2
1 + (S2+ 1)2
_
(S2+ 1)2
- (S2 + 1)2 + (S2 - 1)2
(8.24)
Note that H(s) has zeros at s = j, and that these zeros came from the
denominator of (s).
The elliptic filter follows an obvious extension of the pole/zero placement
procedure of the Butterworth and Chebyshev filters. The Butterworth transfer
function decreases monotonically over the entire frequency range. By a1lo~g
ripples to occur in the passband with the Chebyshev filter, the transition region
is reduced and the attenuation decreases monotonically in the stopband.
Following this logic, the transition region can be reduced still further by also
allowing a ripple to occur in the stopband. This ripple is accomplished in the
elliptic filter by placing the zeros on the jQ axis in the stopband. For the
Butterworth and Chebyshev filters, all the zeros were located at s = 00.
The zeros of HE(S) HBC -s) appear in sets of pairs on the finite jQ axis.
One of each pair is assigned to HE(s), when HE(S) H E( -s) is factored and the
singularities are distributed between HE(S) and HE( -s). In addition, for the
coefficients to be real-valued, the zeros must also occur in complex-conjugate
pairs. Hence, if there are two zeros at S = jQo, then there are also two at
s = -jQo. If the order of the system function N is odd, BE(S) has one zero at
s = 00. For a lowpass filter, there are no zeros at S = O.
This additional complication with the placement of the zeros makes the
design of the elliptic filter very complicated analytically. To circumvent the
mathematics, but yet achieve an approximate elliptic filter magnitude response, we use the insights gained by the intuitive pole/zero placement
described in the previous chapter. The elliptic filter design will be approximated by initially designing a Chebyshev filter, to determine the approximate
location of the poles. Then the pole/zero pattern is modified by placing zeros
on the jQ axis to achieve additional stopband attenuation. These additional
zeros, however, also reduce the magnitude response in the passband. If the
passband specification is not meyafter these additional zeros are included, the
277
stopband:
for 02: 826&r rad/s (Os = 8268n).
and
r
=1~n (4.17
113
Pole 1ocadoIIs. Since there are three poles, the three lines dividing the 5
plane have angles equal to n and 231:/3, as shown mFig. 8.7(a). The poles are
then located at
= -694n
52.3 =694n 008(231:/3) j1566n sin(23I:/3) = -347n j1356n = 1400n ejl04.,
51
The log-magnitude response for this Chebyshev filter is shown in Fig. 8.7(b}. N.
expected, the stopband specification is not met with this third-order filter,
although the passband specification is satisfied.
Zero Iocatioas. To achieve the stopband specification, we move two of the
three zeros of the Chebyshev filter, which are all located at 0 = 00, to finite values
on the jO axis. An interactive pole/zero placement procedure, similar to that
described in the previous chapter, was employed to place the zeros at
5 Z1 Z2
= j9000n
These zeros also reduced the magnitude response in the passband, such that the
passband specification is not met. The locations of the complex-conjugate
Chebyshev poles were changed, uptil both the passband and stopband specifica-
278
jO
(a)
PASSBAND:
IHcUo)ldB
-2
-3
10,000 It
o (radls)
STOPBAND:
IHc(jO)ldB
o
-20
-40
-ro~--------------------+_--~
-SO'';:o-----------...,,.-J.----,J
8268lt 10,000 It
(radls)
(b)
OGURE 8-7
Approximate elliptic filter
design results. a) Thirdorder Chebyshev analog
lowpass filter pole/zero
pattern in the s plane. b)
Log-magnitude response of
third-order filter. c) Logmagnitude and phase responses after zeros are included at s = j90001r.
PASSBAND:
IHEUO)lcIB
-2
-3
-40
1404x
10,000 It
n (radls)
STOPBAND:
IHEUO)lcIB
n (radls)
x
10,000 x
n (radls)
FIGURE 8-'c
-x
= -7501r
[s
%79
280
281
H(ejO)/T,)
= L'"
HA(jw/T. + j2lrk/T.)
(8.27)
k--oo
otherwise
The analog system function is defined as the Laplace transform of hA(t), or
HA(jQ) = (a + jQ)-1
X(.)~)
II
Q.. JlllllflllllfllJ
IIUltm tn,
FIGURE 8-8
Comparison of analog and digital filters using the impulseinvariance method. Filter
structures and time-domain respoFS we shown.
282
MAGNITUDE:
00
Q-
10.000 It
(radls)
wIT' -+-
PHASE:
It
."
QT'-
(radls)
IO.!XXI It
Arg(HA(jQ)
Arg(H(e..... I ..)
(a)
MAGNITUDE:
iH(eJ<o>'T')i
iH.UQ)i
4O.!XlOlt
PHASE:
It
Q-
,." _
(radls)
T,
[~
40'<)()(llt
Ol~~~
\
-It
Arg[H(e..... T')
Arg[HAUQ)
(b)
FIGURE ..,
Comparison of frequency responses of digital and analog filters.
a)
= 10-4 seconds. b)
=
0.25 x 10-4 seconds.
:r.
:r.
283
for n ~o
otherwise
H(ei OJ/1i) =
"-0
H(z) =
..
The digital filter that replaces the RC lowpass filter is shown in Fig. 8.8.
Comparing the values of the analog and digital frequency responses at zero
frequency, we find that HA(O) is lla and H(ej~ = 1/(1- e-T,). For small values
of T., H(el"):= I/(aT.).
A comparison of IH(eIOJ/T,)1 and IHAGQ)I is shown in Fig. 8.9 for different
values of T.. As T. approaches zero, {hen)} appears more similar to hA(t),
indicating that the aliasing is less severe, which, in tum, implies that H(eiOJ/T,)
approaches HAGQ) over the range -nlT.::s wiT. < niT..
Relationship of the s plane and the % plane. We now relate locations of the
singularities in the s plane to those in the z plane when the impulse-invariance
method is employed. In the z plane, the frequency "axis" corresponds to the
unit circle, with co =0 located at z = 1. In the s plane, the frequencies are
located on the vertical axis with Q = 0 at the origin. These zero-frequency
points in the two planes should coincide. By equating individual frequency
points in the range -nIT. ~ Q ~ nIT. with -nIT. ~ colT. ~ nIT., as shown in
Fig. 8.10, we find that the jQ-axis wraps around upon the unit circle.
FIGURE 8-10
Relationship of the s plane to the z plane for the impulse-invariance method.
284
Continuing this point-by-point mapping, we find that the interval (k1)JrIT.::s Q < (k + 1)JrIT., for any integer k, maps onto -JrIT.::s wiT. < JrIT..
With this mapping, the left half of the s plane becomes the inside of the unit
circle and the right half of the s plane becomes the outside of the unit circle.
This relationship between the s plane and the z plane is reasonable, since, for.
stability, the poles of the analog filter must lie in the left half of the s plane,
while those for stable digital filters must lie within the unit circle.
Pole-mapping procedure. We now derive the mapping rule that transfers the
poles from the s plane to the z plane. Let us factor HA(S) into the sum of
first-order system functions given by
HA(S)
=L
_k_
(8.28)
k=l S +ak
where ak may be a complex number. The total impulse response is then equal
to the sum of the responses of the individual first-order systems, or
N
hA(t) =
ak e-aJ<l
(8.29)
k=l
ak e-aknT,
(8.30)
k=l
H(z)
= ~l 1- e~:kT,z-l
(8.31)
By comparing the pole locations in this last equation with those in (8.28), we
arrive at the pole-mapping rule of the impulse-invariance method. This rule
can be stated as
a pole located at s = Sp in the
plane located at z = eS'T,
= O.
28S
We now consider an
s+a
HA(S) = (s + a)2 + b 2
s+a
(s + a + jb )(s + a - jb)
The inverse Laplace transform yields
for t 2:0
otherwise
Sampling this function produces
h(nT.) =
{~-""r, cos(bnT.)
for n 2:0
otherwise
FIGURE 8-11
Second-order digital filter implementation using ~pulse-invariance method.
y(n)
l86
were found to be
S 1.2
= -492n
j564n
We must now choose a value for 7;. The frequency responses for the analog filters
were plotted over the frequency range from 0 to IO,OOOn rad/s. To set the
discrete-time frequency range [0, n/7;] equal to this analog range, we choose
7; = 10- 4 seconds. With this value for 7;, the poles are mapped to
ZI.2 = e$1.2r. = e-o.ISSjo.ln = 0.857ejIO.2Z3.4 = ell . r. = e- o 064jO.428 = 0.938ej24.S-
00
7.23 x 10- 3
H(z) = (1-1.687z-1 + O. 734z- 2 )(I-1. 707z 1 + O.88z 2)
The pole/zero pattern, the digital filter structure, the log-magnitude and phase
responses are shown in Fig. 8.12. The gain of the digital filter is set so that that
maximum value in the passband is equal to 1 (0 dB).
1m
(a)
-r------------~~~----------~Re
7.23
x(n)
lO.l
t----_- y(n)
(b)
HGURE 8-12
Chebyshev digitallowpass filter results when using impulse-invariance method. a) Pole/zero
pattern for Hdz). b) Digital filter structure. c) Log-magnitude and phase responses.
1Jf1
PASSBAND:
IH(eJOllTs)ldB
-2
-3
10,000 It
"" T.
(radls)
STOPBAND:
IH (ejoolTs)ldB
-~~o--------------------~--~
8268 It 10,000 It
"'Ts (radls)
Arg(H(eJOllT,)
"Irs (radls)
-It
ftGURE 1-l2c
288
HA(jQ.)
(a)
III
"n
{}
HA(e""'T,)
(b)
I
0
-2,/Ts
311
CJJ/n
"'ITs
:II WITs
2'1f.ITf>
HA (ell" TS+21t1Ts
-2J[/
I
0
Ts
2./
'Ts
HA(ellli> TS-2><iT.
I
-2'1(/Ts
2KITs
II
H(e""'T')
(c)
---,
n
I
-2J[/Ts
I
0
I
2x/ T<:.
'"Irs
FIGURE 8-13
Aliasing effects prevents the application of the impulse-invariance method to implement bighpass
filters. a) Original analog bighpass filter frequency response. b) Components in the periodic
extension after sampling the impulse response. c) Resulting digital filter magnitude response.
uniquely onto the unit circle, for -H / To < w / To < H / To. This is accomplished
by the bilinear transform method described in the next section.
BILINEAR TRANSFORM METHOD. The bilinear transform method provides
a nonlinear one-to-one mapping of the frequency points on the jQ axis in the s
plane to those on the unit circle in the z plane. This procedure also allows us to
289
2z-1
s=--T.z+1
(8.32)
sT.12 + 1
z = ---:;-:---sT.12 - 1
+ 1).
(8.33)
ei2 arctan[QT,I2)
(8.34)
w = 2 arctan[QT.12]
(8.35)
This transformation is shown in Fig. 8.14. The entire jQ axis in the s plane,
-00 < jQ :5 00 maps exactly once onto the unit circle -:rr < w :5:rr, such that
there is a one-to-one correspondence between the continuous-time and
discrete-time frequency points. It is this one-to-one mapping that allows analog
highpass filters to be implemented in digital filter form. As in the impulseinvariance method, the left half of the s plane maps onto the inside of the unit
circle in the z plane, and the right half of the s plane maps onto the outside.
Cll
1[
1[
FIGURE 8-14
The arctangent relationship between
continuous-time and discrete-time frequencies that occurs in applying the bilinear
transform .
Z90
= T. tan[wI2]
(8.36)
2(0/2-0 3 /8+" .)
T.(l- 02/4 + ... ) = wiT. for small 0
This result indicates that the mapping is approximately linear for small Q and
w. For larger frequency values, the nonlinear compression that occurs in the
mapping of Q to 0 is more apparent. This compression causes the transfer
function at the high Q frequencies to be highly distorted when it is translated
to the w-domain.
Prewarping procedure. For some special types of transfer functions, the effect
of this nonlinear compression of Q to 0 values can be compensated. When the
desired magnitude response is piece-wise constant over frequency, this compression can be compensated by introducing a suitable prescaling, or
prewarping to the Q frequency scale. For the bilinear transform, the Q scale is
converted into the Q* scale, where
2
(QT.)
Q*=-tan
T.
2
(8.37)
291
n (radls)
IHA(jn)1
lloo.:---"..-+--
l-Et-"''''''''--~
n (radls)
HGURE 1-15
Frequency prewarping procedure. Original specification in n scale is modified by prewarping to
produce the specification in the C scale.
Comparing the pole location in the s plane with that in the z plane, we can
state the pole mapping rule for the bilinear transform as
A pole at s = sp in the S plane gets mapped into ~ zero at z = -1 and a pole
at z = (2 + sp 7;)/(2 - sp 7;) in the z plane when the bilinear transform is
applied.
By examining the magnitude of the pole in the z plane, we find that poles lying
in the left half of the s plane are mapped into the inside of the unit circle.
Hence, a stable analog filter produces a stable digital filter after lhe mapping.
The following examples illustrate the application of the bilinear
trahsform.
Example 8.8. Chebyshev Iowpass filter design using the
trusformation. Consider the previous lowpass specification given by
passband:
-1 < IH(jQ)ldB s 0
stopband:
IH(jQ)ldB < -60
for
Q ~ 8268.1t'
bilinear
292
O~ =
and
2
0: =-tan[OsT./2]
= 2 x let tan[0.4134n] = 71690 rad/s
T.
The modified specifications to which the analog filter is to be designed are given
by
passband:
-1 < IH(jO*)ldB s 0
stopband:
for 0* ~ 71 690 rad/s
IH(jO*)ldB < -60
Value of II. The value of I" is determined from the passband ripple:
I" =O.S08.
Value of N. The order of the Chebyshev filter N is determined from
IHdjQ:W = [1 + 1"2C~(O: /O;>r l < 10-6
(-60 dB)
_
4.43 X 1010
dS) - [s + 2216][s2 + 2223s + (.4470)2]
~oIe mapping. We now apply the pole mapping dictated by Eq. (8.39) to
each pole in the s plane. For s = SI in the S plane, it1 the z plane th~re is a zero at
293
z = -1 and a pole at
z =2 + (- 2216 x 10-
4
)
=0 801
2-(-2216x1O 4)
For s =
S2.3,
_
%j24.S"
- 2 _ (-1108 j4331) x 10-4 - 0.819 J0.373 - 0.9Oe
1+
-1
0~
1 - . 1z
1 - 1.638z
+ 0.81z
-+__________~__rRe
~3*-____________
(b)
4.29
x(n)
10.3
y(n)
nGURE 8-16
Chebyshev digital lowpass filter results when using the bilinear transformation method. a)
Pole/zero pattern for Hdz). b) Digital filter structure. c) Log-magnitude and phase
responses.
294
PASSBAND:
IH(eJO>'T')ldB
-l~~r------------------------
-2-
-3 t-I
-4~O~14~~~n---------------------lO~,~~ n
""T. (radls)
STOPBAND:
IH(ejollT')ldB
""T.
(radls)
Arg[H(ejollTs)]
10,~n
-n
FIGURE 8-1tM:
The bilinear transform for the lowpass filter maps the zeros at g = 00 to
the zeros at OJ = 1C, as illustrated in the previous example. These zeros provide
additional attenuation in the stopband at the high frequencies. In contrast, by
the impulse invariance method these zeros are located at z = 0 and have no
effect on tbe magnitude response. Hence, the bilinear transform is a more
effective, albeit more complicated, procedure for obtaining digital filters from
analog filters.
295
Frequency transformations to convert.a lowpass filter of characteristic frequency p to a filter having characteristic frequency 8
Z-I_
Lowpass
Z-I+
Highpass
-1
-2
Bandpass
a=
1- az- 1
cosH(fJ + 8)]
a = - cosWfJ - 8)]
+ az- 1
2ak
k-l
-1
-k+i z +k+i
k - 1 -2 2ak -1 1
k+1 z -k+1 z +
Bandreject
sin[HfJ - 8)]
sinB(fJ + 8)]
2a
-f+kz
-1
k = cotB(au - a L )] tan(fJ/2)
1- k
+f+k
1-k -2
2a -1 1
1+kz -1+k z +
a - cosH(au + ad]
- cosH(au - aL)]
k
= tan[Hau -
ad] tan(fJ/2)
296
(S.40)
The second elemental system function generates a pole at z
z = 0 and is given by
= d and a zero at
Hp(z)
(S.41)
= 1 _ dz- 1
Z-1 - 11'
HLZ(z)
= 1- c 1 -az -1
= ( 1 + ca)
- az
(S.42)
= c is transformed into a
a+c
1 + ca
(S.43)
Cl=--
The pole at z = 0 is transformed into a pole at z = 11'. The location of the zero
is related to c, the location of the lowpass zero, while the location of the pole
is not. If we do the same to Hp(z), then we get the transformed system
function that is similar to the inverse of HLZ(z) above, given by
HLP(z)
1)
(S.44)
297
one pole should be transferred at a time. Even though a pole may be complex,
the analytic form for a first-order complex pole is still much simpler than that
for the second-order complex-conjugate pair. After the transformation is
accomplished, the complex-conjugate poles can then be recombined into a
second-order section with real-valued coefficients. This procedure is illustrated
in Example 8.9.
EDDlpie 8.9. Application of frequency
transformations-iowpass-t01lowpass. Consider the transformation of the Chebyshev lowpass digital filter,
given in Example 8.8, into a Chebyshev lowpass digital filter having the passband
specification, given by
OJ
= O.I404Jr
a--1
I-a-
z=--=-1
298
The pole/zero pattern in the z plane, the filter block diagram and the
log-magnitude and phase responses are shown in Fig. 8.17. For the prototype
lowpass filter, the log-magnitude response fell below -60 dB for w > O. 68.1r (see
Fig. 8.16). For the new filter, this occurs for w>O.83.1r. The stopband
performance of the new filter must be checked, since there is no control over it
when the passband frequency is used as the characteristic frequency in the
transformation. If the stopband is important, the stopband frequency should be
used in the transformation.
POLEMAPPING FOR THE LOWPAS5-TOHIGHPASS FILTER. Applying the
lowpass to bighpass transformation to Hz(z), we get HHZ(Z) given by
Z-l+ a
-1
1 +az
1
) 1 + [(c + a)/(1 + ca)] Z-l
= ( +ca
1 +az 1
HHZ(Z)=1+C
(8.45)
1m
(a)
~------------~------~~--~Re
(b)
x(n)
yen)
FIGURE 8-17
Results of applying lowpass-to-Iowpass frequency transformation to the digital filter shown in Fig.
8.16. a) Pole/zero pattern for H(z). b) Digital filter structure. c) Log-magnitude and phase
responses.
299
PASSBAND:
IH(e.loldB
-2
-3
-4~0--~~~--------~-
0.2808 It
(J)
It
STOPBAND:
IH(el"')ld8
Or-----I....
-20
-40
-ro~----~--------------~---~~0-----~----------~~~1t~+(J)
Arg[H(e""))
It
~-----4-------------~--+(J)
It
FIGURE 8-17c
-It
1+O'z- 1
HP( ) - 1 + dO' (1 + [(d + 0')/(1 + O'd)]z 1)
Z _ _1_
(8.46)
300
-1 < /H(eJ"')/dBSO
For the prototype lowpass filter, the passband edge is at w = 0.1404;r (13 =
0.1404;r). First, we must evaluate the constant (1':
(1'
= _ cosH(f3 + 8)] = _
cosH(f3 - 8)]
cos(0.3202;r) = -0.634
cos( -0. 1798;r)
ZI'
-1+a
z= - - - - = 1
1- (1'
ZI
= 0.801
C I = -0.339
Z2 = 0.819 + jO.373
C2 = -(0.1848) + jO.373)/(0.4813 - jO.2364)
=0.777e- J90ZO
for
Z3
= 0.819 - j0.373
301
The pole/zero pattern in the z plane, the filter block diagram and the
log-magnitude and phase responses are shown in Fig. 8.18.
+ 1 + c(k -
(8.47)
=c is transf6rmed into
1m
(a)
~-------'---+----------~~3Re
(b)
0.132
x(n)
y(n)
FIGURE 8-U
Results of applying lowpass-to-highpass frequency transformation to the digital filter shown in Fig.
8.16. a) Pole/zero pattern for H(z). b) Digital filter structure. c) Log-magnitude and phase
responses.
302
PASSBAND:
IH(ei"')ldB
o
-11--------#---"".-.::---
-2
-3
1t
STOPBAND:
IH(e"")ldB
o
-20
-40
-rol--~----~-------
1t
(J)
Arg(H(eJOl))
1t
O~-------~r-----------~
1t
(J)
ftGURE 8-18c
two zeros, at z =
c 1-
and
Cl
+ 1)]}112
(8.48)
303
The pole at
and
+ [a2k
where
(k + 1)(k - 1)]112
k+1
(8.49)'
12
d _ irk - [a2k - (k + 1)(k -1)r
2k+ 1
2
The locations of the zeros are related to c, the location of the lowpass zero,
while the locations of the poles are not.
If we do the same to the elemental system function Hp(z) then we get the
transformed system function that is similar to the inverse of HBZ(z) above,
given by
(k + 1)(1 - d 1 z- 1 )(1 - d 2 z- 1)
BP(Z) = [k + 1 + c(k - 1)](1 - CI Z 1)(1- C2 Z 1).
H,
+ 1) + {a2k 2 (d + 1)2 -
(8.50)
= d is transformed
[k
(8.51)
and
C2
The zero at
and
+ 1)]}112
+ [ir
2 2
(k + 1)(k - 1)]112
k+1
.
where
(8.52)
The locations of the poles are related to d, the location of the lowpass
pole, while the locati,ons of the zeros are not. If the original lowpass system
function contains both relevant poles and zeros, a cancellation of the
singularities that are produced at z = d 1 and z =d 2 will occur after the
transformation is accomplished.
Eumple 8.11. App6catioD of frequency tnmsformations--lowplISS-to-bandpllSS.
Consider the transformation of the Chebyshev lowpass digital filter, given in
Example 8.8, into a Chebyshev bandpass digital filter having the passband
specification given by
bandpass:
-1 < IH(ei"')ldB sO
for 0.42l.n" s
ClJ
s O.608Jr
304
0.7403
k+ 1
0 392
The pole of the prototype lowpass filter at z = Z; is transformed into two poles
located at
C1.1.2
d
1.2
-002
0392
1 .
These latter zeros cancel the poles that resulted from the zeros of the prototype
lowpass filter.
The pole locations are given by:
for ZI = 0.801
305
-2
1-z~
x-----:-----=
1 + O.084z- + O.74z 21 + O.611z
t
+ O.872z
The pole/zero pattern in the z plane, the filter block diagram and the
log-magnitude and phase responses are shown in Fig. 8.19.
1m
(a)
~---------+-------~~Re
(b)
9.58
10.3
x(n)
y(n)
-0.869
-\
0.74
.\
-0.872
.\
nGURE 8-19
Results of applying lowpass-to-bandpass frequency transformation to the digital filter shown in Fig.
8.16. a) Pole/zero pattern for H(z). b) Digital filter structure. c) Log-magnitude and phase
responses.
306
PASSBAND:
IH(e"")ldB
o
-1~-----P'---l,,+----
-2
-3
-40
0.4211r
0.608 1r
OJ
STOPBAND:
IH(e"")ldB
o
-20
-40
-W~~------r---1-----~-
-~~O~----~O.7.~~l-1r~O~.608~1r----~-n
OJ
.Arg(H(eJOJ)]
O~-------~~-+----~
-n
FIGURE 8-19c
(8.53)
= c is
307
transformed into
~~
-a(c -1) - {a2(c -1i - [k + 1 + c(k -1)][1- k - c(k + 1)]}112
c 2k + 1 + c(k -1)
The pole at z
where
(8.55\
'/
and
d _a-[a2-(k+1)(1-k)j1''2
2k+1
The locations of the zeros are related to c, the location of the lowpass zero,
while the locations of the poles are not.
If we do the same to the elemental system function Hp(z) that generates
a pole at z = d and a zero at z = 0, then we get the transformed system
function that is similar to the inverse of HRZ(z) above, given by
(k + 1)(1- d 1z- 1)(1- d2 z- 1)
HRP(z) = [k + 1 + d(k -1)J(1- CI Z 1)(1- C2 Z 1)
(8.56)
and
(8.57)
-a(d -1) - {a2(d _1)2 - [k + 1 + d(k -1)][1- k - d(k + 1)]}112
C2 =
k + 1 + d(k - 1)
= d 1 and z = d 2 ,
d _a+[a2-(k+1)(1-k)JII2
1k+ 1
where
(8.58)
and
d _ a - [a2- (k + 1)(1- k)JII2
2k+1
The locations of the poles are related to d, the location of the lowpass pole,
while the locations of the zeros are not.
If the original lowpass system function contains both relevant poles and
zeros, a cancellation of the singularities that are produced at z = d 1 and z = d 2
will occur after the transformation is accomplished.
308
Example 8.12. Application of frequency transformations-lowpass-tobandreject. Consider the transformation of the Chebyshev lowpass digital filter,
given in Example 8.8, into a Chebyshev bandreject digital filter having the
passband specification given by
-0.0455 0.934
The pole of the prototype lowpass filter at z = z, is transformed into two poles
located at
O.0486(z/ -1) {O.OO24(z; _1)2 - [1.068 - 0.932z;][0.932 -1.068z/W12
Cl.2=
1. 068 - 0.932z;
ZI
= 0.801
Z2
= 0.819 + jO.373
C1.l.2
= 0.48gei93S
C2.1
C2.2
= 9931ei76.2"
for
Z3
= 0.819 - j0.373 = z;
309
0.932eJ109 2"
j76 r
C3,2 = 0.931e- .
C3,1
1-0.lz- 1 +z- 2
x 1 _ O.444z 1+ 0.867z 21 + O.613z 1 + O.869z 2
The pole/zero pattern in the z plane, the filter block diagram and the
log-magnitude and phase responses are shown in Fig. 8.20.
(a)
~-------------+-------------;-Re
(b)
x(n)
y(n)
FIGURE 8-20
310
PASSBAND:
IH(eJOldB
o
-1t----~-t--___jp..L----
-2
-3
4~O------~O~.4~2~1~K~-0~.~OO~8-K------~K
STOPBAND:
IH(eJO IdB
0
-20
40
-60
-80
K
co
Arg!H(eJO)
co
FIGURE 8-ZOc
311
stopband, the phase response is less important since these components get
eliminated anyway. In this section, we investigate the use of all-pass filters to
modify the phase response in the passband. These modify the phase by being
connected in cascade with the existing filter. Since these filters have a constant
magnitude response, that of the existing filter is left unchanged.
An all-pass filter is one whose magnitude response is constant for all
frequencies, but whose phase response is not identically zero. We consider
both first and second-order filter sections that can be connected in cascade with
the IIR filters discussed previously in this chapter to modify the overall phase
characteristic.
First-order all-pass filter. The system function of a first-order all-pass filter is
given by
z
1 -r -1-1
HAP(Z) = .
-1
1-rz
(8.59)
=1- 2r-
r- 2
(8.60)
(8.61)
-(r-r-1)sin(w) ]
(
1) (
-r+r cosw)
(8.62)
The phase responses for different values of r are shown in Fig. 8.21. When
0< r < 1, the zero lies on the positive real axis. The phase over 0 < OJ < n is
positive, at OJ = 0 it is equal to n and decreases until w = n, where it is zero.
When -1 < r < 0, the zero lies on the negative real axis. The phase over
0< OJ < n is negative, starting at 0 for OJ = 0 and decreasing to -n at OJ = n.
Since the zero is outside the unit circle, the phase will always decrease by n as
OJ goes from 0 to n. The shape of the phase response is related to the radius r.
Second-order all-pass filter. Second-order all-pass filters are obtained by
allowing r to take on complex values and including the complex-conjugate
312
1m
+-------r-----*+-9----Re
lIr
PHASE.
FlGURE 8.21
Pole/zero pattern and phase response for
first-order all-pass filter.
singularity locations. Doing this we have the second-order all-pass filter system
function given by
(1 - r- 1z- 1)(1- r-hz- 1)
HAP(Z) = (1 _ rz- 1 )(1- r*z-l)
1 - 2 Re(r-1)z-1 + Ir- 1 12 Z-2
1- 2 Re(r)z 1 + Irl2 Z-2
(8.63)
The phase responses for different values of r are shown in Fig. 8.22. Since
there are two zeros outside the unit circle, the phase at (J) = 0 is 2.1r, or
equivalently, equal to zero, when r > O. When r < 0, the phase at (J) = 0 is zero
again. Since the two zeros lie outside the unit-circle, the phase will decrease by
2.1r as CIJ goes from 0 to .1r.
The phase response of a given filter can be tailored in a narrow band of
frequencies by varying the value of r and including additional all-pass filters.
However, the type of tailoring that can be done is limited, since the phase
responses of all-pass filters all show a negative trend with frequency.
8.7 SUMMARY
The Butterworth, Chebyshev and elliptic filter synthesis techniques for
designing analog lowpass filters in the s plane have been presented. For a given
lowpass specification, it was found that the Butterworth filter was the simplest,
but required the highest order. The elliptic filter provided the lowest order, but
was the most difficult to design analytically. The Chebyshev filter prov(des a
reasonable tradeoff between filter order (hardware cost) versus design effort
(design cost).
313
1m
PHASE:
7t
-71
FIGURE 8.l2
Pole/zero pattern and phase response for
second-order all-pass filter.
FURmER READING
Antoniou, Andreas: Digital Filters: Analysis and Design, McGraw-Hill, New York, 1979.
Gold, Bernard, and Charles M. Rader: Digital Processing of Signals, McGraw-Hill, New York,
1969.
Hamming, R. W.: Digital Filters, 2nd ed., Prentice-Hall, Englewood Cliffs, NJ, 1983.
Oppenheim, Alan V., and Ronald W. Schafer: Digital Signal Processing. Prentice-Hall,
Englewood Cliffs, NJ, 1975.
Rabiner, Lawrence R., and Bernard Gold: Theory and Application of Digital Signal Processing,
Prentice-Hall, Englewood Cliffs, NJ, 1975.
314
REFERENCE TO TOPIC
Elliptic filter reference
i~
PROBLEMS
8.1. In replacing an analog filter with a digital filter, aliasing effects must be eliminated
by including an anti-aliasing analog lowpass filter prior to the analog-to-digital
converter. The Butterworth and Chebyshev filters are suitable candidates in
practice. A possible specification for an anti-aliasing filter is to have a negligible
attenuation (between 0 and 0.1 dB) in the passband and to have a large
attenuation (greater than 60 dB) at the analog frequency corresponding to the near
edge of the passband of the next period of IH(eiw1T,)I, that is, the replica of the
magnitude response centered at w = 2n/T..
Consider the analog lowpass filter specification that is to be satisfied by the
digital filter to be given by
passband:
for O:s Q:s 10 rad/s
stopband:
IHUQ)ldB < -60
for Q 2= 50 rad/s
315
passband:
-1 < IH(jO)ldB s 0
for Os Os 10rad/s
stopband:
for 0
~ 50 rad/s
T. = 10- s.
2
(a) Determine the order of the Butterworth filter that satisfies this specification
and draw the s plane pole/zero pattern. Transfer the poles to the z plane using
the impulse invariance method and implement the digital filter.
(b) Determine the order of the Chebyshev filter that satisfies this specification and
draw the s plane pole/zero pattern. Transfer the poles to the z plane using the
impulse invariance method and implement the digital filter.
(c) Compare the order of the two filters.
8.5. Bilinear-transform method. Consider the analog lowpass filter specification given
by
passband:
for 0 sO s 10 rad/s
stopband:
for 0
~ 50 rad/s
T. =10- s.
2
COMPUTER PROJECTS
8.1. Comparison of impuJse..invariance and bilinear transform methods for a Butterworth lowpass IDter
Object. Design a Butterworth analog lowpass filter and compare the magnitude
and phase responses of the digital filters produced by using the impulse-invariance
and bilinear transform methods.
Analytic results
Analog filter design. Design the Butterworth analog lowpass filter that
satisfies the analog specification given in Table Proj8.1. Use one set of the
frequency values given in the table. Show the steps in the design procedure.
Sketch the pole/zero pattern in the s plane and give the system function HA(S).
Digital filter design. Design a digitallowpass filter to replace the analog filter
above. Let the sampling period be T. = 10- 4 s.
Impulse invariance method. Determine the pole/zero pattern obtained by
performing the impulse-invariance mapping. Write the digital filter system
function H(z) and sketch the block diagram of the filter.
316
TABLE Proj8.1
Possible values:
01
1094Jr
l094n
l094n
l094n
l094n
01
Az
5938n'
1250n
1250n
1250n
1250n
1250n
5938n
6094n
6250n
6406Jt
6563n
6094n
6250n
6406Jt
6563n
01
1406n
l406Jt
l406Jt
1406n
1406n
0%
01
liz
5938Jr
1563n
1563n
1563n
1563n
1563n
6094n
6250n
6094n
6250n
6406Jt
6563n
6406Jt
6563n
671fJn
01
1719x
1719x
1719x
1719x
1719x
liz
6094"
625On:
6406x
6563"
671fJx
Comparison
Compare the stopband performance of the two methods. Explain the phase
response in terms of the pole/zero pattern in the z plane.
8.2. Comparison of bnpnlse-invariance and bilinear transform methods for a Chebyshev lowpass ruter.
Object. Design a Chebyshev analog lowpass filter and compare the magnitu<a", and
phase responses of the digital filters produced by using the impulse:;invariance and
.'
bilinear transform methods.
Perform the steps listed in Project 8.1 for the Chebyshev filter design.
IHAUQ)ldB
_~~~Z'mlm
317
1. Design the analog Butterworth filter using the values for the analog lowpass
filter found in Table Proj8.1. These values have not been prewarped. Show the
an8.Iog Butterworth lowpass filter design procedure. Include sketches showing
the frequency prewarping transformation.
2. Design the digital lowpass filter by performing a bilinear transformation. For
the digital lowpass filter determine the system function obtained by the bilinear
transform and sketch the pole/zero pattern. Sketch the block diagram and plot
the unit-sample response. Plot the log-magnitude response with DVBAL = -4
and -60 with the specification limits shown. Plot the phase response.
3. Design the digital filter that satisfies one of the highpass, bandpass or band
reject specifications given in Appendix B. Use the frequency transformations
with the edge of the passband as the characteristic frequency. Sketch the
pole/zero pattern, and the block diagram. Plot the log-magnitude response of
the digital bandpass filter with DBVAL = -4 and -60, andwith the specification limits indicated. Also plot the phase response.
(a) If your stopband specification is not met after performing the frequency
transformation, satisfy the specification by adding zeros to the filter system
function to achieve additional attenuation.
(b) If your specification is met after performing the frequency transformation,
add zeros so that either of the following is achieved:
(1) a reduction in the transition band by a factor of 2, or
(2) a reduction in the stopband attenuation by' 6 dB.
Provide the following for the final filter: the system function, the filter block
diagram and the z plane pole/zero pattern.
8.4. Chebyshev DR filter design
Objed. Design an analog Chebyshev filter that satisfies the lowpass specification;
use the bilinear transform to obtain the digital filter; and use frequency
transformations to obtain the digital filter to meet a bandpass, highpass or
bandreject specification.
Perform the steps listed in Project 8.3 for a Chebyshev filter. Numerical
round-off errors in your computations may shift the implemented pole position so
that the specification is not satisfied. If this occurs, manually shift the pole
positions in your final filter until the specification is satisfied. Do this interactively
by examining the magnitude response after a modification is made. List the steps
that you took.
CHAPTER
9
FINITE-IMPULSE
RESPONSE
FILTER
DESIGN
TECHNIQUES
9.1 INfRODUCfION
In this chapter, we describe procedures for implementing finite-impulse
response (FIR) 1,ilters. In contrast to infinite-impulse response (IIR) filters, the
FIR filter is characterized by a unit-sample response that has a finite duration.
Understanding the performance of FIR filters is important because the FIR
filter is the discrete-time-domain equivalent to processing data in the frequency
domain with the fast Fourier transform (FFf) algorithm.
FIR filters have two advantages over IIR filters. First, the design
procedures for IIR filters are well established only for magnitude responses
that are piece-wise constant over frequency, such as lowpass, highpass,
bandpass and bandreject filters. In contrast, the magnitude response of an FIR
filter can be designed to have an arbitrary shape. Hence, if the magnitude
response specification is other than piece-wise constant, the FIR filter is the
filter of choice. The second advantage of FIR filters is that they can be
designed to have a phase response that is exactly linear with frequency. In
Chapter 6, it was shown that a special FIR linear-phase filter structure can be
used to reduce the number of multiplications by approximately one-half. The
disadvantage of FIR filters is that, if an IIR filter can be found that satisfies the
same specification as an FIR filter, the IIR filter will typically be faster and
require less memory.
318
319
Three FIR design procedures are described in this chapter. The one to be
used in a particular case depends on whether the desired unit-sample response
{hD(n)} is known and whether it has a finite duration. If {hD(n)} is known and
has a finite duration, the FIR design is straightforward and can be implemented directly by using the structures considered in Chapter 6. If the {hD(n)}
is known, but has an infinite duration, the response must be truncated to form
the finite-duration response {hN(n)} having N samples, where N is a finite
integer. To do this, the windowing method for designing FIR filters is
described. It employs an N-point tapered window sequence to perform the
truncation. When the form of the unit-sample response is not known, {hN(n)}
must be det6rmined from the desired magnitude specification IHo(ei"')1 and an
appropriate phase response. With the DFT method, {hN(n)} is determined
from the inverse discrete Fourier transform of N samples of the desired
magnitude response {IHo(k)l} and an appropriate linear phase response. The
windowing and DFT methods are combined to find the filter having the
shortest-duration unit-sample response that still satisfies the specification. The
third FIR filter design procedure is the frequency-sampling method. It
produces an interesting filter structure by using {IHo(k)l} and an appropriate
phase response. With this third method any continuous magnitude response
having an arbitrary shape can be achieved. The resulting filter structure
contains a parallel combination of second-order resonators, which allows the
processing to be performed in parallel. This structure is most useful for
applications in which processing speed must be reduced to a minimum. The
chapter concludes with a discussion on how to use the FFT algorithm to
perform filtering tasks on long data sequences. A comparison of multiplication
counts for performing the filtering operation with a digital filter and with the
FFT algorithm indicates when one is to be preferred over the other.
HFIR(Z) =
bkz- k
(9.1)
n=-NF
Using the nonrecursive structure, this filter can be implemented directly from
the coefficient values bk , for -NFsksNp Further, the unit-sample response
of the FIR filter is equal to this coefficient sequence, or
h(n) = b n
(9.2)
Hence, the FIR filter can be implemented directly from the unit-sample
response. We first consider implementing the FIR filter to approximate a
desired unit-sample response sequence. Then we consider the case of requiring
the FIR filter to satisfy a desired magnitude specification.
320
A problem arises for filters, such as the ideal lowpass filter, which have a
unit-sample response {ho(n)} that has an infinite duration. The sequence
{ho(n)} has an infinite duration whenever the deSlfed magnitude response
IH(eiw)l, or any of its derivatives exhibit a discontinuity. For such cases, we
must truncate the infinite-duration {ho(n)} to produce one that has a finite
duration of N samples, denoted by {hN(n)}.
As shown in Chapter 3, to have a linear-phase response, the unit-sample
response must be symmetric or antisymmetric about some point in time. To
simplify the analysis below, we consider {ho(n)} to be symmetric about n = 0,
or
(9.4)
for all n
To retain the linear-phase response in the FIR filter having the response
{hN(n)} , the truncation must be performed symmetrically around n = 0 to
maintain the symmetry in {hN(n)}, as shown in Fig. 9.1. The N-point
{ho(n)}
,.,
for N=7
I I
II
I 1111I1111
-2 -1 0 1 2
I I
o.
{h,{n))
.. 1111111
-3 -2 -\ 0 1 2 3 4
FlGURE 9-1
Comparison of desired unit-sample response {ho(n)} having an infinite duration and the 7-point
finite-duration approximation {h7(n)}.
321
(9.5)
(9.6)
where
w(n)
= w(-n):#O
for
=0
for
(9.7)
Since the two functions in the integral are periodic, a circular convolution
results and the limits are taken over one period. Trying to evaluate this
convolution in general is difficult because the spectra are complex-valued and
tend to have complicated analytic forms involving sine and cosine functions.
However, if all the discrete-time sequences are symmetric about n = 0, then all
the spectra are real-valued functions of w. This property helps us to visualize
the effects of convolution in the following discussion.
To illustrate the effects of this convolution, let us consider the problem of
approximating an ideal lowpass filter by using the windowing method. For the
322
I
IT
IT
{horn)
~TT"T"",.L.JL...L.."""T""T...,J...LJ.-f.J....LJ4-..,...~L1....L.o'T'"lr"T""1_""'
n
FlGURE 9-2
Ideallowpass filter magnitude response IHD(eJ"')1 and the corresponding infinite-duration desired
unit-sample response {hD(n)}. Case for (lJc = lr/4 is shown.
We'
for -weswswe
for -nS W < -we and coe < W <no
(9.9)
This is shown in Fig. 9.2 for We = n/4. The unit-sample response of the ideal
lowpass filter is given by the inverse Fourier transform, or
(9.10)
The desired unit-sample response is an even sequence that extends to both plus
and minus infinity. We will consider several different finite-duration approximations to this ideal response by employing several common window
sequences: the rectangular, triangular, and cosine windows.
TIlE RECfANGULAR WINDOW. The rectangular window sequence is defined
by
for -(N - 1)12 S n :S (N - 1)/2
(9.11)
~(n) = {~ otherwise
323
= wR(n) hD(n)
=
sin ( wcn)
for all n
for -(N -1)/2::;; n::;; (N -1)/2
(9.12)
(w.(n)} (N=31)
..- 11111"
11111111111!1111"
111111.
..n
15
0
15
(b)
1t
Q)
-lOO~----~----~'1-2-----L----~1t
Q)
FIGURE 9-]
Rectangular data window (N = 31).
(a) Window sequence; (b) spectrum;
(e) log-magnitude spectrum.
324
0 .....- -.....
-50
-100~----~-----U~----~----~
OJ
FIGURE 9-4
Results of applying a 31-point rectangular window to the ideallowpass filter unit-sample response.
(a) Finite-duration unit-sample response; (b) magnitude response of approximation to ideal
lowpass filter; (c) log-magnitude response.
of WR(e jCLl ) and HD(e jCLl ) by examining the features of WR(e jCLl ) that are
responsible for the deviations from the ideal response. The spectrum of the
rectangular window is equal to
WR(ejCLl )
(N-l)/2
n=-(N-l)12
N-l
(9.13)
325
The finite geometric sum formula can be applied to evaluate the sum, to give
1- e- icoN
W, (e lW ) = elW (N-I)/2
.
(9.14)
R
1-e- lco
To simplify this analytic form, we express the numerator and denominator as
sine functions, or
sin(Nw)
sin(w/2)
(9.15)
The spectrum WR(eieo) for N = 31 is shown in Fig. 9.3. The spectrum WR(e lCO )
has two features that are important for this application, the width of the main
lobe and the sidelobe amplitude. The main-lobe width is defined as the
distance between the two points closest to w = 0 wh'ere WR ( eieo ) is zero. For
the rectangular window, the main-lobe width is equal to 4,,/ N. The maximum
side lobe magnitude for WR(eieo ) occurs for the first sidelobe and is equal to
approximately 22% of the main-lobe amplitude, or -13 dB relative to the
maximum value at w = O.
We now consider the effect of these two features in the convolution to
produce the lowpass FIR filter transfer function HN(elW ). The transfer function
HN(eiW ) and the log-magnitude response IHN(eieo)ldB are shown in Fig. 9.4 for
the 31-point rectangular window. The filter response differs from the desired
response in several ways. The sharp transition in the ideal response at w = We
has been converted into a gradual transition. In the passband, a series of
overshoots and undershoots occur, and in the stopband, where the desired
response is zero, the FIR filter has a nonzero response, called leakage. These
effects can be explained in terms of the features of the window spectrum.
The main lobe of WR(eieo ) causes the smearing of the desired transfer
function features, especially noticeable at frequencies where the desired
magnitude response is discontinuous. The discontinuity in HD(eieo ) is converted
into a gradual transition in HN(eieo ), whose width is related to the width of the
main lobe of WR(e ieo ). Since the main-lobe width of WR(e ieo ) is equal to 4Jr/N,
the size of this transition region can be reduced to any desired size by
increasing the size of the window sequence. The forms of HN(eieo ) for different
values of N are shown in Figs. 9.5 and 9.6. However, this increase in N also
increases the number of computations necessary to implement the FIR filter.
The sidelobes of WR(e leo ) cause a different distortion to the filter
magnitude response. Since the side lobes of WR{e ieo ) extend over a wide
frequency range, large amplitude components in HD(e lW ) become smeared
over a wide range of frequencies in HN{eico ). This effect is most evident in the
frequency ranges in which the HD(e ieo ) is either constant (in the passband) or
has a small magnitude (in the stopband). In the passband, these sidelobe
effects appear both as overshoots apd undershoots to the desired response. In
326
(a)
{hlS(n)}
(b)
It
OJ
-50
-100~0------~------~----~------~1t
OJ
FIGURE '-S
Results of applying a 1S-point rectangular window to the ideal lowpass filter
unit-sample response. (a) Finiteduration unit-sample response; (b)
magnitude response of approximation
to ideal lowpass filter; (c) logmagnitude response.
327
(a)
-30
30
n
(b)
H", (e"")
L-
(c)
-50
-100~O------~---L--L-----~------~n
FIGURE 9-6
328
these sharp transitions by more gradual ones. This is the motivation for
considering the triangular, or Bartlett, window described next.
THE TRIANGULAR, OR BARTLETT, WINDOW. Let us consider the effect of
tapering the rectangular window sequence linearly from the middle to the
ends. We then obtain the.N-point triangular window given by
WT(n)
= 1 -21nl
-N-1
(9.16)
This window and its spectrum WT(e ieo ) are shown in Fig. 9.7. As expected, the
(a)
..," II1I111111111111!1111111ItI...
- 15
15
(b)
(c)
-lOO~~
__~__~__+-~__~__~-;
01
w
FIGURE 9-7
Triangular data window results
(N = 31). (a) Window sequence;
(b) spectrum; (c) log-magnitude
spectrum.
329
sidelobe level is smaller than that of the rectangular window, being reduced
from -13 to -25 dB relative to the' maximum_ However, the main-lobe width
is now 87'/N, or twice that of the rectangular window having the same
duration. This result illustrates that there is a tradeoff between main-lobe
width and sidelabe level.
The FIR lowpass magnitude response obtained by applying the triangular
window to the ideal lowpass filter unit-sample response is shown in Fig. 9.8.
Comparing it with that obtained by using the rectangular window, we find that
the triangular window produces a smoother magnitude response. The transition from passband to stopband is not as steep as that for the rectangular
(a)
-15
15
o~---+~===F====~--~
IT
IH3,(e'''lidB
(e)
01----.....
-50
-100L-----~------~------~----~
'/4
II
FIGURE 9-8
Results of applying a 31-point triangular window to the ideal lowpass
filter unit-sample response. (a)
Fmite-duration unit-sample response;
(b) magnitude response of approximation to ideal lowpass filter;
(c) log-magnitude response,
330
window. In the stopband, the response is smoother, but the attenuation is less
than that produced by the rectangular window. Because of these characteristics, the triangular window is not usually a good choice.
We next consider a class of raised-cosine windows that, compared with
the triangular window, are smoother at the ends, but c1os~r to one at the
middle. The smoother taper at the ends should reduce the sidelobe level, while
the broader middle section produces less distortion of {hD(n)} around n = 0.
RAISED-COSINE WINDOWS. To reduce the sidelobe level further, we can
consider an even more gradual taper at the ends of the window sequence by
using the raised-cosine sequence. We now discuss three such windows. The
first is the Hanning, or simply raised-cosine window, denoted by {wdn)} ,
given by
for -(N - 1)/2 s n S (N - 1)/2
+ 0.5 cos(21rn/(N -1
We n otherwise
o
(9.17)
( )_{o.s
This window and its spectrum WdeiO) are shown in Fig. 9.9 for N = 31. The
magnitude of the first sidelobe level is -31 dB relative to the maximum value,
an improvement of 6 dB over that for the triangular window. Since the
main-lobe width is the same, the Hanning window is preferable to the
triangular.
This reduction in the sidelobe level can be explained by considering
{wdn)} itself to be an infinite-duration raised-cosine sequence that is
multiplied by the rectangular window, or
wc(n) = [0.5 -+: 0.5 cos(N~nl) ]~(n)
=c(n)wR(n)
for all n
for all n,
(9.18)
W S
1r (9.19)
When convolving WR(eiO) with C(eiO), versions of WR(eiO) are shifted to the
locations of these impulses, the shifted spectra are scaled by the weight of the
impulse, and the results are added to produce the final curve, as shown in Fig.
9.10(b). The shifts caused by the impulses from the cosine function locate the
sidelobes of WR(eiO) so that they tend to cancel, thus reducing the sidelobe
magnitudes of the resulting spectrum Wc(eiO).
331
(a)
-15
15
nGun
w
9-9
Raised-cosine (Hanning) window results
(N = 31), (a) Window sequence; (b)
spectrum; (c) log-magnitude spectrum.
332
-15
15
{c(n)}={1 +COSCnI15)}
-15
15
{wc(n)}
+ n
.LLLI.&U.II....._ _ _
-15
15
FIGURE 9-10
Interpreting the raised-cosine
(Hanning) window results. (a)
Time domain; (b) frequency
domain.
WJI(n)
1))
This reduction in the first sidelobe level can be explained in terms of the
addition of the shifted and scaled window spectra WR(ei "'), shown in Fig.
9.10(b). For the raised-cosine window, the Dirac delta functions at co = 0 and
at co = n/15 formed a ratio of two to one. This ratio resulted in a negative
amplitude for the first side lobe in We( ei "'). By changing this ratio of delta
functions to become 2.35 to one (0.54 to 0.46/2), the magnitude of the first
sidelobe in We(ei "') can be reduced. The Hamming window and its spectrum
333
(b)
0("'''')
It
"1
-"1
"1
I I
-l~
N-I
N-I
10)
"1
FIGURE 9-IOb
WH(eJ "') are shown in Fig. 9.12 for N = 31. The magnitude of the first sidelobe
has been reduced to -41 dB, a reduction of 10 dB relative to the Hanning
window. But this reduction is achieved at the expense of the sidelobe
magnitudes at the higher frequencies, which are almost constant with
frequency. With the Hanning window, the sidelobe amplitudes decrease with
frequency.
The lowpass filter magnitude and log-magnitude responses when using
the Hamming window are shown in Fig. 9.13. It is noted that the first sidelobe
peak is -51 dB, -7 dB with respect to the Hanning window filter. However, as
the frequency increases, the stopband attenuation does not increase as much as
with the filter produced by the Hanning window.
The stopband attenuation in the lowpass filter magnitude response is
334
(a)
-15
(e)
!H31 (e"')!
0..--_
-4
ncURE 9-11
Results of applying a 31-point
raised-cosioe (Hanning) window
to the ideal lowpass filter unitsample response. (a) Finiteduration unit-sample response;
(b) magnitude response of approximation to ideal lowpass filter; (c) log-magnitude response.
limited by the sidelobe level of the window function. Even though the
Hamming window achieved an attenuation of 51 dB for our lowpass filter, it
may not be sufficiently small for some applications. A window having smaller
magnitude sidelobes is needed. Hamming reduced the sidelobe magnitude
while maintaining the main-lobe width, equal to 4:tr/N. The following window
of the main-lobe width.
reduces the sidelobe level at the expense
,
335
(a)
""111111111111111111111111111""
.n
0
-~
IT
(c)
-100L-__
~~
____- L____
____~
IT
co
ftGURE 9-12
Hanning window results (N = 31).
(a)
Window sequence; (b)
spectrum; (c) log-magnitude
spectrum.
(9.21)
336
(a)
15
- 15
o~----~~~--+-----~------~
1T
I H 31 (e IW ) IdB
(c)
0,---_.
-50
-l00L-----~------~----~~--~u
It
FIGURE 9-13
Results of applying a 31-point Hamming
window to the ideal lowpass filter unitsample response. (a) Finite-duration
unit-sample response; (b) magnitude
response of approximation to ideal lowpass filter; (c) log-magnitude response.
This window and its spectrum WB(ei "') are shown in Fig. 9.14. The magnitude
of the first sidelobe level has been reduced to - 57 dB. However, the main-lobe
width has increased to 1211" IN. This is another illustration of the tradeoff
between the sidelobe magnitude and the main-lobe width.
This reduction in the sidelobe level can be explained in a manner similar
to the raised-cosine window. The Blackman window can be written as the
337
(a)
-15
(b)
15
Wo(e'"')
It
-so
-57
-100 0
It
(J)
ftGURE 9-14
Blackman window results (N =31).
(a) Window sequence; (b) spectrum;
(c) log-magnitude spectrum.
(9.22)
where {~(n)} is the N-point rectangular window. As before, the multiplication of two sequences in the time-domain corresponds to a convolution in the
338
-lr :5 co :5 lr.
(9.23)
This spectrum is shown in Fig. 9.1S(a). The individual shifted and scaled
versions of WR(ei "') produced by the convolution with C2(ei "') are shown in
Fig. 9.1S(b). Their sum produces the spectrum of the Blackman window
WB(ei "') shown in Fig. 9.1S(c). The main-lobe width is extended by the
components centered at co = 4lr/(N -1), but these components serve to
reduce the sidelobe levels as well.
The digital lowpass filter results obtained when applying the Blackman
window are shown in Fig. 9.16. The minimum attenuation in the stopband is
an iIJ'lpressive -74 dB, but it occurs for co> lr/2. Such a large transition region
is necessitated by the wide main-lobe width of the Blackman window
spectrum.
The windows discussed above are compared in terms of their main-lobe
width and the maximum sidelobe level in Table 9.l.
Although other more complicated windows have been proposed, their
performance is only slightly better than that produced by the windows above.
These other windows are not discussed here, but can be found in the
references. Another reason for discussing only these simple windows is that the
shape of the window spectrum itself is not the important parameter, but rather
its effect on the transfer function of the final FIR filter that is being
approximated, so that different windows may be better for different filter
types. Hence, it is impossible to make a general statement regarding the
appropriateness of a particular window for the general filter. It is more
important to be aware of the general effects produced by the window spectrum
main-lobe and sidelobe structures.
(a)
O.Srr
O.04rr
O.Srr
O.04rr
FIGURE '15
Frequency-domain interpretation of the Blackman window
results. (a) Spectrum of infinite-duration sequence; (b)
shifted and scaled versions of
the rectangular window spectrum generated by the convolution; (c) spectrum of the
Blackman window is the sum
of the components in (b).
339
FIGURE 9-15b
FIGURE 9-&
The main problem with applying the windowing method is that the
desired unit-sample response {hD(n)} must be known. For a particular desired
magnitude response, this unit-sample response may not be known. In the next
section, we describe the DFf method that can be used to obtain a
finite-rluration approximation of the desired unit-sample response. In the
following section, we will apply the windowing method to this approximation.
340
o~----~~---+------~--~
It
(c)
-50
nGURE 9-16
Results of applying a 31-point Blackman
window to the ideal lowpass filter unitsample response. (a) Finite-duration
unit-sample response; (b) magnitude
response of approximation to ideal lowpass filter; (c) log-magnitude response.
-74
TABLE 9.1
Window
Rectangular
Bartlett
Hanning
Hamming
Blackman
41r/N
81r/N
81r/N
81r/N
121r/N
-13
-25
-31
-41
-57
341
iiin)
= L
k=-oo
ho(n
+ kNd)
(9.24)
The relationships of {ho(n)}, {hin)} and {iid(n)} for the ideallowpass filter
are shown in Fig. 9.17. If {ho(n)} has an infinite duration, some degree of
time-aliasing will occur. For a stable filter, {ho(n)} is equal to or approaches
zero for both positive and negative values of n. Hence, the time-aliasing effect
can be made negligible by choosing Nd sufficiently large. In the design
procedures below, we will consider hd(n) = ho(n) for the Nd points over which
{hd(n)} is defined.
To illustrate the Off ..approach, let us consider the ideal lowpass filter.
To obtain this Nd-point Off sequence, the magnitude response is sampled at
frequency points Wk = 21fk/ Nd, for 0::;; k ::;; Nd - 1. Let us define the sequence
{Ho(k)} to be
(9.25)
for 0 ::;; k ::;; Nd - 1
Applied to the ideallowpass magnitude response, we have
for 0::;; k::; NL_and for Nd - NL ::;; k ::;;Nd -1, and
<
otherwise
342
(hDCn)}
...
(hCn)}
INVERSEDFT
FIGURE 9-17
Relationships of desired unit-sample response {ho(n)}, its periodic extension {hd(n)} (Nd 0= 64),
the sequence produced by the inverse DFf assuming a zero phase sequence, and the approximate
unit-sample response {hd(n)} for the non-causal FIR filter.
(a)
343
{IHD(k)l}
III . .
o
. II .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
{Arg[Ho(';')j}
o t'5 k
(b)
{h(n)}
(c)
~---------~~--------~)
FIGURE 9-18
(a) Magnitude and phase DFf sequences for approximating the ideallowpass filter (N = 16); (b)
resulting 16-point inverse DFf .<!quence; (c) approximate unit-sample response for the non-causal
FIR filter. Parts (b) and (c) indicate the shift of samples to be performed.
344
where NL defines the edge of the passband, as shown in Fig. 9.18 for Nd = 16
and NL = 2. To determine the unit-sample response from the inverse OFT, we
must also specify a phase response sequence. Let us first choose the simplest,
the zero-phase response sequence, given by
Arg[Ho(k)] = 0
for aU k
For this zero-phase response sequence, the real and imaginary sequences are
equal to
and
Hence, the OFT element values are given by
Ho(k) = HR(k) + jHI(k) = HR(k)
(9.26)
The Nd-point unit-sample response {hin)} is then related "to the inverse OFT
sequence {h(n)} computed as
1 N.-l
h(n) = - 2: Ho(k) ei 21<knlNd
(9.27)
Nd k=O
This sequence is shown in Fig.9.18(b). The analytic evaluation of the inverse
OFT can be simplified by noting that, for the zero-phase response sequence,
{HD(k)} is an even sequence of k. The limits of the sum can then be taken
from -NL to NL , over which Ho(k) = 1. Hence,
1
NL
h (n) = 2: ej21tknlNd
Nd k=-NL
e -j21tM.nINd 2M.
2:
Nd
ej21tknlNd
k=O
e- j21tM.nlNd 1- ej21t(2M.+l)nINd
= Nd
1 - ei21tnlNd
sin[2.n-(NL + !)n/Nd ]
(9.28)
Nd sin[.n-n / Nd]
Since a zero-phase response sequence has been specified, the unit-sample
response should be an even sequence of n. The Nd-point noncausal sequence,
corresponding to the zero-phase response sequence, can be obtained from the
inverse OFT results by shifting the second half of the sequence, the values for
(Nd/2) + 1 s n s Nd - 1, into negative values of n, as shown in Fig. 9.18(c).
This then defines {hin)}, the FIR approximation to the desired zero-phase
lowpass filter. However, even after this shift is accomplished, the Nd-point
sequence may not be exactly symmetric about n = 0 because Nd is an even
integer and there may be one additional nonzero element without a partner at
n = Nd/2. Since this symmetry is a necessary condition for a linear-phase
response, even though the sequence {Arg[Ho(k)]} was specified to be
zero-valued, the phase response function of the filter Arg[Ho(ei "')] cannot be
equal to zero, except at the samplin.,g points.
=--'''---'--.:::--=~-=
345
-It
FIGURE 919
Comparison of the Fourier transform of {hd(n)} shown in Fig_ 918 and the DFf sequence values_
The DFf samples are shown as heavy dots.
To resolve this dilemma, let us define Hd(ei "') to be the filter transfer
function determined by computing the Fourier transform of {hd(n)}, or
N.,;2
Hie iw ) =
hd(n)e- iwn
(9.29)
n=-Ndf2 + 1
This transfer function is plotted in Fig. 9.19. Note that the function passes
through the sample values of {Ho(k)}, but is not zero-phase.
We now want to relate Hd(eiw ) to the desired transfer function Ho(eIW).
The connection between the two is that {hin)} is one period of the periodic
extension of {ho(n)}. Expressing {hd(n)} as the rectangular window truncation of this periodic extension, we have
00
Hie iw ) =
(9.30)
n=-IX)
where {WR(n)} is the Nd-point rectangular window and {hi n)} is the periodic
extension of {ho(n)}. As shown in Chapter 3, the multiplication of two
discrete-time sequences corresponds to the circular convolution of the two
corresponding Fourier transforms. We then have
(9.31)
346
H(eiW )
2:
hd(n) e- iwn
(9.32)
n=-oc
H(e'"')
'I II
FIGURE 9-20
Periodic extension of {ho(n)} forms the infinite-duration sequence {hd(n)}. The spectrum of the
infinite-duration sequence H(e JW ) is composed of Dirac delta functions.
347
thevalues of the FIR filter transfer function Hd(e JW ) between the sample points
may deviate significantly from HD(eiw ). The differences are most significant
around frequencies for which IHD(eiw)1 is discontinuous, as illustrated by the
edge of the passband in the ideal lowpass filter. When IHD(eJW)1 is a smooth
function of frequency, the sampled sequence {IHD(k)1} is a good representation of the form of IHD(eiW)I, provided the sampling is dense enough,
which' occurs for large values of Nd In this case, the filter transfer function
Hd(e IW ) will be essentially equal to HD(e iW ).
The above analysis also illustrates the problems that can occur when
filtering is performed by taking the DFf of the input data and merely
eliminating the undesired frequency components by setting them equal to zero.
In effect, a zero-phase filter is assumed having a symmetric finite-duration
unit-sample response {hin)}.
,In the next section, we co,nbine the windowing and DFf methods for the
design of practical FIR filters.
TIME-DOMAIN OPERATIONS
(hd(n)}
_.........~."
.llIlllll~IIlIIlII....._.......... ~
-N/ Z
+1
N/2
FIGURE '21
Interpreting the overshoots and leakage effects in Hie JOJ ). (a) Time domain; (b) frequency
domain.
348
H(e"")
1,
ftGURE !)2Ib
349
magnitude response sequence {IHo(k)l} from the magnitude response specification, followed by the procedure for specifying an appropriate phase
response. An inverse DFf then produces the Nd-point unit-sample response
{hd(n)}. The application of an N-point window, where N < Nd, to obtain
{hN(n)} from {hin)} is then discussed. Finally, a step-by-step procedure for
designing an FIR filter is presented.
In this section, we will describe the DFf/windowing procedure for
implementing lowpass, highpass, bandpass and bandreject filters. When
discussing the application of windows earlier in this chapter, we observed that
the resulting filter magnitude response was a distorted version of desired
magnitude response IHo(eIW)I. This distortion was caused by the convolution
of Ho( e iw ) with the spectrum of the window. This distortion prevents the
application of this procedure to designing filters having an arbitrary magnitude
response shape, such as linear-with-frequency, for example. A magnitude
response having a specific shape is more easily achieved with the frequencysampling method described in the next section .
IHo(k)1
= IHo(ei"')I..,=ei2d'Nd
for 0 :5 k :5 Nd/2
fOr (Nd/2)
+ 1:5 k :5 Nd -
1.
(9.33)
SPECIFYING
THE
APPROPRIATE
LINEAR-PHASE
RESPONSE
SEQUENCE. From {IHo(k)l} and a ,~'pecified phase sequence {Arg[Ho(k)]},
350
1-- _______ J
IHo(eI"') I
r-------.,
ofI
O>p
0>,
Wc
0>
1t
IH(eI"') I
IfI-Ef-
L.. _ _ _ _ _ .J
/llio(eI"')1
,.-...
o -,
(Os!
ro CI c.o PI
I
rop~
CJ)c~
Ws~
1t
0>
FIGURE 922
The desired magnitude response for lowpass
and bandpass filters is obtained by extending the passband into the transition regions.
The specification is shown as dashed lines.
351
TABLE 9.2
Linear phase responses for the various types of symmetry of the Nd-point
unit-sample response {hd(n)} (Nd is even integer)
Even symmetric with the point of symmetry on sample point Ns = Nd/2
Arg[Ho(eJW )] = -wNd /2
for 0 ~ w ~ H
Even symmetric with the point of symmetry between sample points, Ns = (Nd -1)/2
Arg[Ho(eiw )] = -W(Nd -1)/2
for O~ w'os; H
for
O~
w os;H
1)/2
for 0 ~ w ~ H
The phase at frequency points for which the magnitude response is zero-is
undefined and can be set to an arbitrary value. To simplify the specification of
the phase, we set it equal to the value of the linear trend. Then, at W = 0, the
phase value of antisymmetric sequences is defined to be equal to n /2. As
shown in Chapter 5, even symmetric sequences that have an even number of
elements have a z-transform that always produces a zero at z = -1, or a
magnitude response that is zero-valued at W = n. This condition occurs when
the point of symmetry falls between sample points at Ns = (Nd - 1)/2. Then, at
w = n, the phase value of even symmetric sequences is defined to be equal to
-(Nd - l)n/2.
The procedure to define the phase sequence that is least prone to error is
to sample Arg[Ho(eiCLI )] at (Nd/2) + 1 points over 0:$ w:$n and apply the odd
symmetry property of the phase sequence to obtain the entire Nd-point
sequence. Doing this, we have
Arg[Ho(k)] = Arg[Ho(eiCLI)] ICLI=eJ2KWNd
Arg[Ho(k)] = -Arg[Ho(Nd - k)]
:$
Nd - 1.
(9.34)
352
{HDCk)}
(a)
2 3 4 2 M 29 3() 31
(e)
15 ;
FIGURE 923
Effect of phase response slope on unit-sample response. (a) 32-point magnitude response used in
the inverse DFf computations; (b) unit-sample response sequence result when phase slope is -16;
(c) unit-sample response sequence result when phase slope is -15.5.
353
POINT OF SYMMETRY Ns
ON SAMPLING POINT
{wH(n)}
(hd(n)}
- .. nlIl
l
IlIIIIIIII
Ns
POINT OF SYMMETRY Ns
BETWEEN SAMPLING POINTS
(hd(n)}
II
.. ,tI'IIIlIllll.lllllJlllIlt
.....
t
n
Ns
FIGURE 9-24
Positioning a Hamming window to maintain the symmetry that is present in the
original sequence_
Having described these separate parts, we can now integrate them into a
procedure to design an FIR filter.
STEPS IN DESIGNING A FILTER USING mE OFT/WINDOWING
METHOD. The steps to design a linear-phase FIR filter with the
354
TABLE 9.3
1. Determine
the
approximate
desired
unit-sample
response
ing the cutoff frequency Wc into the transition region. The desired magnitude
response is sampled to produce the magnitude response sequence {IHo(k)I}.
The value of Nd should be chosen to be some large number, greater than the
duration of the final filter design, to make the time-aliasing effects in {hd(n)}
negligible. Most of the FIR filter specifications in this book will be satisfied
with durations of less that sixty samples. Hence, Nd = 128 is sufficient. The
linear-phase response sequence {Arg[Ho(k)]} is specified according to Table
9.2. For ease of specifying and applying windows, the point of symmetry of
{hd(n)} should be specified to be n = Nd/2.
In evaluating the inverse DFT, the real and imaginary parts of the DFT
355
= IHo(k)1 cos(Arg[Ho(k)])
and
HI(k) = IHo(k)1 sin(Arg[Ho(k)])
HR(k)
Since both the cosine and sine functions are periodic, it is not necessary to
express the phase in the principal value range of [-Jr, Jr] in the above
procedure for determining the phase response.
356
o
49-point window
33-point window
,. . . . . "~m~~~~llillfi~. . . . . ,,
o
Nfl
Na !
17-point window
Nfl
Nd-!
FIGURE 9-25
By locating point of symmetry of {hd(n)} at n = Nd/2, variable length windows can be applied
directly. When Nd/2 is an integer, windows having an odd-integer duration must be used.
357
for
for
O.42n ~ W
~ O.61n
O~w~O.16n
and
O.87n~w~n.
for O~ k ~Nd/2
for (Nd/2) + 1 ~ k
Nd - 1
358
(a)
IH(e'"') I
1
0.89
(-1 dB)
O.OOI(~ dB)LL._-:-~
o
:--_~IL,,- --:--:!r===t~_~-+
_ _--,,,..-L:1
0.16n:
0.42n:
(b)
__
0.6In:
0.87n:
n:
..
0)
IHo(e'"') I
If-
____
~L,,-
_______
0.34n:
~~
_____
~w
0.69n:
FIGURE 9-26
Initial frequency curves for Example 9.1. (a) Specification; (b) desired magnitude response
function.
and
HI(k) = IH(k)1 sin(Arg[H(k)])
HI(k) = -H1(Nd-k)
The inverse DFf was evaluated with the four possible phase responses to
produce the four unit-sample responses shown in Fig. 9.27. To take advantage of
the zero-valued coefficient occurring at n = 32, thus eliminating a multiplication
in the digital filter, we can use the antisymmetric sequence that has its point of
symmetry on a sampling point as {hd(n)}. The magnitude response IH(ei "') I of
this sequence is shown in Fig. 9.28. This magnitude response was obtained by
computing the 512-point DFf of {hd(n)}. The overshoots and leakage effects due
to the 64-point rectangular window trunction are evident.
Step 2. Determine {hN(n)}.
A 33-point Hamming window was applied {hd(n)} to obtain {h33(n)}. The
corresponding magnitude response is shown in Fig. 9.29(a). We note that it is
much smoother than that of {hd(n)}, being convolved with the spectrum of the
Hamming window. The passband requirement is easily met, but the minimum
359
(a)
(b)
315
(d)
31 5
'-17
FIGURE
Four unit-sample response sequences resulting from the four possible phase response types.
(a) Even symmetry with point of symmetry falling on sample point; (b) even symmetry with
point of symmetry falling between sample points. (C) Odd symmetry with point of symmetry
falling on sample point; (d) odd symmetry with point of symmetry falling between sample
points.
360
PASSBAND:
IH(e'''')ldB
o .
-lr-----------~Hr~~~+.Hr~------------
-2
-3
~~0------------L-~0~.4~2~n----~0.~6~ln~L---------~n ro
STOPBAND:
IH(e"")ldB
-20
~o
nGURE '28
Magnitude response corresponding to (hd(n)} shown in Fig. 9-27(c).
Fig. 9.29(b). Reducing the window further caused the low-frequency stopband to
be exceeded. Hence, N = 31 is the minimum duration, to give {h31(n)}.
Step 3. FIR filter implementation.
The maximum value of IH(e,W)1 for {h 31 (n)} was found to be equal to
HMAX = 0.9998. This value was close enough to one so that scaling the
coefficients by 1/HMAX was not necessary. The causal FIR filter structure is
shown in Fig. 9.30. Note that the output of the fifteenth delay is not connected to
a multipler because h 31 (15) = O. However, this savings of one multiplier is bought
at the cost of multiplying the outputs of 15 delays by -1 to achieve the
antisymmetric unit-sample response. If an even-symmetric {hd(n)} was used,
these negations would not be necessary. This filter would be efficient, however,
if the digital hardware allowed a subtraction to be performed as efficiently as an
addition.
361
In the next section, we consider another FIR filter design procedure that
results in a structure which allows the processing to occur in parallel.
PASSBAND:
IH(e"")ldB
0..-
f-
r2f-
c3ff-
-4
(i)
0.421t
0.611t
It
FIGURE 9-19
Magnitude response corresponding to windowed version of {hd(n)} shown in Fig. 9-27(c). (a)
33-point Hamming window results; (b) 33-poin(tBlackman window results.
362
(b)
PASSBAND:
IH(e'''')ldB
o
-I~--------------r+------~--------------
-2
-3
-4~O------------~~~----~~~----------~n
o
-20
-40
~~----~-------------------------H-----
~0~~~0~.1~6n------------------------~~~~
ftGURE '1911
specified. The difference is that, rather than computing the inverse Off to
determine the unit-sample response of the FIR filter, a special parallel filter
structure is used to implement each frequency sample directly. For a given
specification, the frequency-sampling procedure may produce a filter that is
faster and easier to implement in hardware.
Given a desired magnitude response IHD(&OI)I having an arbitrary shape,
the goal of this design procedure is to design an FIR filter having an N-point
unit-sample response and having a magnitude response IH(&OI)I, such that
IH(eiCOk)1
= IHD(eiCOk)1
x(n) - - - . . . - - - - - - - - ,
y(n)
FIGURE 930
linearpbase FIR filter structure produced by 31-point Blackman window.
363
364
where C/)k = 2:rck1N for O:s: k:s: N -1. That is, we want to design an FIR filter
whose magnitude response exactly matches the desired magnitude response at
N equally spaced points over O:s: C/) < 2:rc.
We start by considering the FIR filter structure that is implemented by a
comb filter cascaded with a bank of resonators, described in Chapter 6. The
system function can then be written in the form:
=
H(z)
(1-NZ-N) ~o 1-Ho(e
ei2n;kIN -l
j2nkJN
N-l
(9.37)
(9.38)
(9.40)
where Re[ . ] is the real part of the complex quantity within the brackets. As
expected, the numerator is real-valued, but a function of both the real and
imaginary parts of Ho(e j 2n;kIN). The system function is then given by
H(z)
k-l
(9.41)
36S
(a)
x(n)
yen)
(b)
x(n)
y(n)
ftGURE 9-31
Digital filter structures used when applying the frequency-sampling method. (a) General filter; (b)
simplified structure for linear-phase response.
366
This result is valid for any desired magnitude and corresponding phase
response, but can be further simplified for the class of linear-phase filters
below.
CHOICE OF EVEN OR ODD VALUES FOR THE UNIT-SAMPLE RESPONSE
DURATION N. As shown in Chapter 6, the comb filter generates zeros that
are equally spaced on the unit circle. When N'is even, zeros are located at both
Z = 1 and z = -1, as shown in Fig. 9.32. For odd-valued N, there is a zero only
on the positive real axis at z = 1.
Not all of the zeros generated by the comb filter can be canceled by
resonators, since the pole/zero pattern is governed by the symmetry properties
of the unit-sample response. For example, it was shown previously that
antisymmetric sequences, since they have a zero-valued mean, always produce
a zero at w = 0 (z = 1). Hence, the resonator gain of the desired magnitude
response at w = 0 is always equal to zero. The system function for a
linear-phase filter having an antisymmetric unit-sample response HAS(z) is
given by
1- Z-N [HD(ei1l:) (NI2)-l
]
(9.42)
HAS(z) = N
1
-1 +
2: HR,k(Z)
+Z
k=l
1m
N=6
N=4
-.---~~--+-
Re
-'---~~--+-Re
1m
1m
N=3
N=5
--11---'-:----'-- Re
- t - - - i b - - - + - - Re
ftGURE 932
Pole/zero patterns in the z plane of comb filter for different values of N.
367
Hs(z)=
1- Z-N
N
[H (eJo)
(N~-1
(9.43)
HR~Z
(9.45)
The numerator can be simplified by adding 2kn to the argument of the first
cosine term, which does not change the value of the cosine function when k is
an integer. This gives
368
where
(9.48)
is the real-valued gain of the kth second-order resonator. Note that the cosine
factor makes some of these gains negative. Including this result in the total
system function Eq. (9.37), we get the filter shown in Fig. 9.31b and
_1- Z-N [Ho(ej~ (N~-l u ( ) ]
H( Z ) N
1
-1 + ~
flR,k Z
-
(9.49)
k=l
Before describing the frequency-sampling design procedure and presenting examples, we describe the procedure for choosing the gains of the
resonators in the transition region.
SPECIFYING THE MAGNITUDE RESPONSE IN THE TRANSmON
REGION. With the frequency-sampling procedure, the filter magnitude
response IH(ei"')1 is equal to the values of the desired response IHo(ei "')1 at the
sampling frequency points, The values of IH(ei"') 1 at other frequencies are
interpolated from these sample point values. Because the combfilter/resonator combination generates an N-point duration of a sinusoid, that
could be modeled as being obtained with an N-point rectangular window
applied ~o an infinite-duration sinusoid, the interpolation is achieved with
sin(Nw )/sin( w/2) functions, as shown previously in Fig. 9.21(b). As such,
sharp discontinuities in IHo(eico)1 produce overshoots and leakage effects in the
filter magnitude response IH(ei"')I. To reduce these effects, the samples in the
transition region are used to taper the desired response gradually between the
passband and stopband. Since each nonzero sample value, IHo(ei2nkIN)I, means
the addition of a resonator, the number of such samples in the transition
region should be minimized. Unfortunately, determining these transition
sample values is a complicated procedure involving linear programming
optimization procedures (see Rabiner and Gold). The values of the transition
points also depend on the number of samples N and the cutoff frequency, It is
claimed that, in lowpass filter designs, a maximum stopband attenuation
between 44 and 54 dB can be achieved when one transition point is allowed.
With two transition points, from 65 to 75 dB can be obtained, and with three
transition points between 85 to 95 dB is possible. Rather than do the
complicated optimization, or to rely on tabulated values, we present an
alternate procedure that is more intuitive. The cost involved with using this
procedure is that it may require more resonators that the optimum procedure.
To avoid the problems associated with discontinuities and to take
advantage of the tolerances in the specification, a smooth transition from the
369
= !Os - Op!/NT
(9.50)
and
N
= 2Jr/{)O.
(9.51)
If there is more than one transition region, the smallest one determines the
value for N. Once N has been determined, the sample values o( {!Ho(ei2JrkIN)I}
falling in the stopband are set to zero. Initially, all the sample values of
IH(e"")1
\-
-----
Ii
( ) ' - - - - - " - - - - - - - ' - - - - - ' - - . (0
It
IH(e"")1
nGURE 9-33
The desired magnitude response for lowpass
and bandpass filters is obtained by connecting the passband and stopband with a
raised-cosine function.
370
{IHo(ei2J<kIN)I} falling in the passband are set to one. Then, the value at the
inside edge of the passband is reduced to fall on the raised-cosine taper, but
still within the limits. This allows us to take advantage of the passband
tolerance. For passband to stopband transitions, let kp + 1 be the number of
the first sample inside the edge of the passband and ks + 1 be that of the first
sample inside the stopband. Then the cosine taper should be equal to 1 for
k = kp and zero for k == k.. If we let Nps = k. - kp, then the cosine sequence
traverses 1' radians, including the end points, in Nps samples. The downward
transition sample values are then defined by
IHD( ei2J<kIN)1 =0.5(1 +cos(1'(kN.- kp))
ps
for kpsk s k.
(9.52)
o.s(
E:umple 9.2. Determining transition region values for a bandpass filter. Let us
consider the bandpass specification shown in Fig. 9.34, given by
passband: -1 s H(eiW)ldB S 0
stopband: IH(eiW)ldB < -60
oJ[
lo~l~==:::=?-I:--__-::-:lI:-----,..-,IL_ _---,r===-,C:=:=::lL-+'"
o
O.l6rr
O.42rr
O.61rr
O.87rr
(j)
rr
{Ho(k)}
1 2 3 4 5 6 7 8 9 JO II 12 13 14 15 16 17 IS 19 20 21
2~
23
nGURE 9-34
Frequence curves for Example 9.2,-(a) Specification; (b) desired magnitude response
sequence.
371
and
n. which is rounded to k = 10
to
k = 0.61n/0.043n = 14.19, which is rounded to k = 14.
The stopband samples extend from k = 0 to k = 0.16n /0.43n = 3.72, or
k = 4 for the low frequency stopband, and from k = O. 87n/0. 043n = 20.2, or
k =20 to k = N /2 = 23.
The values of {lHo(k)l} can now be evaluated.
Low-frequency stopband:
IHo(k)1 =0
for 0 s k s 4.
cos(n(k6-S))
for S s k s 11.
=0.933
(=-0.60 dB).
Passband:
IHo(12)1 = 1
Passband to stopband transition:
For the downward transition, kp + 1 = 14, or kp = 13, and k. + 1 = 20, or k. = 19.
Then Npo = 6 and
IHo(k)1 = O.S(1 + cos (
n(k; 13))
for 13 s k s 19.
for20sks23.
372
TABLE 9.4
373
Step 4. Verify the filter design. The values of the filter magnitude response
at the frequencies other than the sampling points should be determined_ This is
done by computing the magnitude of the Nd-point OFT of the N-point
unit-sample response {hN(n)} , where Nd> N. The value of Nd should be
chosen large enough that the OFT samples, denoted by {HNd(k)}, are a good
representation of the continuous-frequency transfer function H(ejo. For
example, if N =32 then Nd = 128 is a good choice. The Nd-point OFT is
computed by padding the N-point unit-sample response with Nd - N zeros.
Upon verification, the magnitude response specification may not be met
because the allowed limits are exceeded at the frequencies between the
sampling points. If this happens, the specification must be sampled more
densely by increasing the value of N and the design procedure repeated. If the
specification iscexceeded only slightly, the value of N may need to be increased
by only a small number.
Step 5. Comparison of computation counts. Count the number of multiplications that are required to determine if the frequency-sampling filter structure is
more efficient than using the linear-phase nonrecursive implementation,
determined from {hN(n)}. However, the parallel structure of the frequencysampling implementation allows the computations to be performed in parallel,
which may mean that it is-a faster implementation.
Eumple 9.3. Desi&n of FIR bandpass filter widI frequency-samp1iDg
metlaod. Let us consider the bandpass specification given by
passband:
-1 s IH( ei"')ldB s 0
for 0.42JJ S
sO.61JJ
stopband:
for 0 s w S 0.16JJ and 0.87JJ s w S JJ.
From Example 9.2, we found N = 46. The resonator gains are then given by
for k
=12
for 13 S k S 19.
The digital filter was implemented and the unit-sample response {h46(n)} was
computed and is shown in Fig. 9.35(a}. As expected, it has even symf!1etry about
n =22.5.
As a verification, the 512-point DFf of {h46(n)} was computed by padding
with zeros and the magnitude response was determined. The passband and
stopband results are shown to satisfy the specification in Fig. 9.35(b}.
374
{h..,,(n)
FIGURE 9-35
Unit-sample response sequence of filter satisfying
specification in Example
9.3.
225
To implement the filter 15 second-order sections are needed, one for each
nonzero IHo(k) I If multiplications by -1 are ignored, two multiplications are
required for each resonator. An additional mUltiplication is required by the
comb-filter for each output point. Hence, the frequency-sampling structure
requires 31 multiplications per output point. Since {h~n)} is even symmetric,
the linear-phase FIR structure can be impjemented to provide the same result
with 23 multiplications per output point. In this case, the frequency-sampling
structure requires more multiplications.
375
PASSBAND:
IH(e"")ldB
II
1/\
I
-I
-2~
~
-3~
~
-4
III
O.61n
O.42n
(I
It
STOPBAND:
IH(t"')ldB
IL-~~~
__________________________
~~~~Ill
0.1611
FIGURE 9036
Magnitude response of filter satisfying specification in Example 9.3.
number, then its magnitude response has a zero at CJ) = n. Proceeding blindly
without this knowledge, we sample IHD ( ei ") I at 33 points over O:s CJ) :S n. The
sample values are shown in Fig. 9.37(a). The resonator gains are then given by
Bk = 4k1C cos(63nk/64)/N
This filter has been implemented and the unit-sample response is shown in Fig.
9. 37(b). The even symmetry about n = 31.5 is apparent. However, when the
magnitude response of this filt~r is determined, it is linear over most of the
frequency range, but becomes zero at CJ) = n. This is due to the zero dictated by
the symmetry of the unit-sample respone. Upon closer examination, we also find
that
B32 = 2n cos(63n/2) = 2n cos(3n /2) = O.
Since an even symmetric sequence having an odd number of points does not have
a zero at CJ) = n, we should try N = 63.
,-
376
(a)
111111
{iHo(k)i}
.' " I II
II I 2
II [Ill 11111111111111.
. '"
32
II
(b)
{h ..(n)}
(c)
iH(e"")i
1t
~------------------------------~~m
FIGURE 9-37
Results for Example 9.4 when N = 64. (a) Input samples of magnitude response sequence;
(b) unit-sample response of filter; (c) filter magnitude response.
N = 63: IHD ( ei..) I was sampled at 32 points over O:s Q) < n. These sample
values are shown in Fig. 9.38(a). The resonator gains are then given by
~
,.
= 4b cos(621rk/63)/(N + 1)
This filter has been implemented and the unit-sample response is shown in Fig.
9 .38(b). The even symmetry about n = 31 is apparent. The magnitude response of
this filter, shown in Fig. 9.38(c), is more linear over the entire frequency range.
Having been convinced that an odd N is appropriate, we next observe the
results for N = 33 and 15, shown in Fig. 9.39. As N is reduced, the deviation of
IH(ei"')I from the desired linear function is more apparent, especially near Q) = 0
and Q) = n, where IHo(eiW)I has sharp comers. The minimum acceptable value for
N is determined by the specified tolerances, which may be in terms of maximum
deviation of IH(ei"')1 from a linear function, for example. This case is examined in
the projects.
377
(a) (IHo(k)\}
"'1111[11111111[11[11111111111[. k
II 1 2
II
:1CJJI'
(J)
62
II
31
(c) IH(tI"')1
~--------------------------~-+{J)
nGUU 9-38
Results for Example 9.4 when N =fi3. (a) Input samples of magnitude response sequence; (b)
unit-sample response of filter; (c) filter magnitude response.
378
.12
(b)
N=15 results
FIGURE 9-39
Results for Example 9.4 for different values of N. (a) N = 33; (b) N
= 15.
379
= 1- rNz- N
(9.54)
The poles of the resonator are then also located inside the unit circle to cancel
these zeros. With their poles inside the unit circle, these resonators become
lossy. This loss allows any residuals that occur to decay to zero eventually.
No discussion of FIR filtering techniques is complete without a description of how to perform the filtering operation with the FFf algorithm. This
topic is described in the next section.
= ~l h(k)x(n -
k)
(9.55)
k=O
For each output point, NH multiplications and additions are required. If the
380
input sequence {x(n)} contains N x elements, then the output sequence {y(n)}
contains Ny = NH + N x - 1 points. Since a multiplication is typically the single
operation that requires the most time to perform in a general-purpose
computer, we will use the number of real-valued multiplications required to
perform a filtering operation as a measure of the efficiency of a filtering
m~thod. To perform the direct convolution above, NH multiplications are
required for each output value, or NyNH multiplications for the entire output
sequence.
The convolution above can be converted into a multiplicative operation
by taking the Ny-point discrete Fourier transform of the data and unit-sample
response and computing
Y(k)
= H(k)X(k)
(9.56)
The output sequence values y(n), for OSn sNy -1, are then determined
from the inverse OFT of {Y(k)}. The following steps must be performed to
accomplish the filtering operation in the frequency domain.
Step 1. Computation of the Ny-point OFTs of the unit-sample response and
the input sequence:
H(k) = ~I h(n) e- j 2n:nJcINy
(9.57)
n=O
and
N~I
(9.58)
n=O
(9.59)
Ny
L.
ej2JrnklNy
(9.60)
k=O
381
the size of the DFf to be computed was determined by the duration of the
output sequence Ny = NH + Nx - 1. The DFfs of both the input and unitsample response had to be computed to this size. For long input data
sequences, such as the sampled audio signals from CD systems, Nx is typically
much greater than NH. To compute the Ny-point DFfs, {h(n)} would then
have to be padded with Nx - 1 zeros, a large number that requires a long
computation time. As an alternate procedure, we can divide the input sequence
into smaller blocks of data and determine the block size that minimizes the
number of multiplications required per output point. When processing data
with digital filter structures, this problem does not arise, since the number of
computations per output point is a constant, being determined by the structure
of the filter.
Let the sequence {x(n)} have an arbitrarily long duration, such that
N x NH, and break it up into blocks of No samples, as shown in Fig. 9.40.
The mth block is then denoted by {xm(n)} and defined by
xm(n) =x(n - mNo )
= 0,
for
O~n ~No
otherwise
(9.61)
N~l
L h(n - k)xm(k)
for
k=O
O~
n ~NH + N o -1
(9.62)
2: xm(n m
mNo )
(9.63)
If {y(n)} is the linear convolution of {h(n)} and the entire sequence {x(n)},
then it is equal to the sum of the outputs for each block, or
(9.64)
m
382
{X(T .,I'Ie"
II'
11'1111*
i, .,I'leII'10lI'N~.~!
,,-.IIlI,
.III.
'II
'[U'
JIlt..
11'
........... ............. ..
tIll.
r" n
{Yo(n)}
sa.
{y(n~}
'0
'1},*
NH+NQ-l
'1.
1'1' 1'1
.i1..Ub..'.IIIIlIll' rllIlIh,
,IlIr
ow
'111*
ttIlt.
.nIh'I. ..
....
"GURE 9-40
Relationships of sequences used in the overlap-and-add method.
of the overlap, the valid output sequence, or those samples that require no
further manipulation, increases by No points. If we let R denote the number of
multiplications per valid output point, we have
(9.65)
383
TABLE 9.S
Steps and multiplication count for performing a filtering operation with the
FFf
Step
4Mylog2 My
4My
4Mylog2My
Examining this last equation, we find that for a given value of FIR filter
duration NH , there is a block size No that minimizes the value of R. The curves
of the R values for different values of No are shown in Fig. 9.41 for different
values of N H
To determine whether the FIR filter or the FFf approach is more
efficient, the value of R should be compared to N H , the number of
computations per output point required by the general Direct Form FIR filter
structure. For linear-phase filters, the value of R should be compared with
NH/2 to account for the linear-phase structure.
R
SOO
1024
4()O
300
256
200
12M
100
FIGURE 9-41
curves showing R, number of multiplications per output point, as a function of the block size No,
with size of filter duration NH as a parameter.
384
such that
No + NH - 1 = My = 2K
(9.66)
9.7 SUMMARY
In this chapter, three methods for synthesizing FIR filters were presented. The
first, called the windowing method, synthesizes the filter from the unit-sample
response sequence. This approach is most useful for designing an FIR filter
from a known unit-sample response sequence. One application of this case
occurs when replacing an existing analog filter with a digital FIR filter. The
impulse response of the analog filter can be sampled to produce the desired
unit-sample sequence. The second approach, call the DFT /windowing method,
the unit-sample response is determined from the inverse discrete Fourier
transform of the samples of the magnitude response and an assigned phase
response. A window sequence can then be applied to shorten the duration and
take advantage of the tolerances in the specification. When a linear-phase
response is specified, the special FIR structure can be implemented to reduce
the multiplication count by almost one-half. The third approach,. the
frequency-sampling method, synthesizes the filter directly from samples of the
magnitude response. This method results in a filter structure that consists of a
comb filter followed by a bank of parallel resonators. This parallel structure
can perform the computations on the input data simultaneously, thereby
reducing the computation time. This approach is most useful for designing a
filter to have a magnitude response with a specific shape.
We also considered performing the filtering operations in the frequency
domain with the FFT. The overlap-and-add method for performing a filter
operation on long data sequences divides the input data sequence into blocks.
The block size that minimizes the number of multiplications per output point
was determined. The number of ~uJtiplications can then be compared to that
385
required for digital filter structures to perform the same function. It was
observed that the FFf method is not always the most efficient approach to
processing data.
FURTHER READING
Antoniou, Andreas: Digital Filters: Analysis and Design, McGraw-Hili, New York, 1979.
Bergland, G. D.: "A guided tour of the fast Fourier transform," IEEE Spectrum, 6: 41-52 (1969).
Burrus, C. S" and T. W. Parks: DFT / FFT and Convolution Algorithms, Wiley-Interscience, New
York, 1985. [This book provides a description of the various algorithms to implement a
discrete Fourier transform. Program listings are given in FORTRAN and assembly
language for the Texas Instruments TMS32010 signal processing chip.]
Cooley, J. W., and J. W. Tukey: "An algorithm for the machine computation of complex Fourier
series," Math. Comp., 19: 297-301 (1965).
Gold, Bernard, and Charles M. Rader: Digital Processing of Signals, McGraw-Hill, New York,
1969.
Hamming, R. W.: Digital Filters, 2d ed., Prentice-Hall, Englewood Cliffs, NJ, 1983.
McClellan, J. H., T. W., Parks, and L. R.,Rabiner: "A computer program for designing optimum
FIR digital filters," IEEE Trans. Audio Electroacoust" AU21: 506-526 (1973).
Oppenheim, Alan V., and Ronald W. Schafer: Digital Signal Processing, Prentice-Hall,
Englewood Cliffs, NJ, 1975.
Peled, A., and B. Liu: Digital Signal Processing: Theory, Design and Implementation. Wiley, New
York, 1976.
Rabiner, Lawrence R., and Bernard Gold: Theory and Application of Digital Signal Processing,
Prentice-Hall, Englewood Cliffs, NJ, 1975.
Taylor, F. J.: Digital Filter Design Handbook, Marcel Dekker, New York, 1983. [Advanced
topics, also covering ladder and wave filters. Includes hardware and &oftware
considerations]
Williams, Charles S.: Designing Digital Filters, Prentice-Hall, Englewood Cliffs, NJ, 1986.
[Beginning level text for juniors and seniors, relying very little on previous mathematical
knowledge.]
PROBLEMS
9.1. Consider the infinite-duration unit-sample responses given below. We have
determined that either 5-point or 6-point rectangular windows are sufficient to
implement linear-phase FIR filters that satisfy the specifications. For each
response, indicate the appropriate window duration and draw the causal
linear-phase FIR filter structure that performs multiplications most efficiently.
(a) h(n)=O.9"forn~O
h(n) =h(-n) for n <0
(b) h(n) = 0.9" for n > 0
h(O) = 0
h(n) = -h( -n) for n < 0
(c) h(n)=O.9"forn~O
h(n) = h( -n + 1) for n < 0
9.2. The triangular window can be analyzed as the convolution of two smallerduration rectangular windows. Compute the transfer function of the 5-point
386
9.3.
9.4.
9.5.
9.6.
9.7.
9.S.
9.9.
Sketch and compare the transfer functions of the triangular and rectangular
windows.
Consider the ideallowpass filter having the cutoff frequency We = :r/2.
(a) Compute the desired unit-sample response {ho(n)}.
(b) Use a 3-point rectangular window and compute the transfer function of the
windowed sequence. Compare with the ideal response.
(c) The same sequence is obtained when a 5-point rectangular window is applied
(why?). Indicate by using sketches of the transfer functions why the same
windowed magnitude response is obtained.
Give simple examples that illustrate the four linear-phase responses given in
Table 9.2 by sketching representative unit-sample response sequences and their
corresponding phase responses.
Indicate the possible symmetries that the unit-sample response can have to
approximate a lowpass filter, a highpass, a bandpass filter and a bandreject filter.
Consider the locations of desirable and undesirable zeros of the transfer function.
Write the analytic expression for the set of variable-duration Hamming windows,
having duration N (even integer) and having the point of symmetry at
Ns = (Nd - 1)/2, where Ns is not an integer (N < Nd)'
Consider the desired magnitude response given by IHD(ei"')1 = Isin wi. Using the
Off method, determine the following 8-point unit-sample responses.
(a) Even-symmetric about n = 3.5
(b) Anti-symmetric about n = 3.5
(c) Even about n = 0 (except for unmatched point at n = 4)
(d) Odd about n = 0 (except for unmatched point at n = 4)
Design the four possible 8-point linear-phase FIR filters having the magnitude
response sequence given in Prob. 9.7 by using the frequency-sampling method.
Derive the transfer .t~i1ction of the second-order resonators used in the
frequency-sampling method for the case of an antisymmetric unit-sample
response.
COMPUTER PROJECfS
9.1. 'The Gaussian window
Object. Investigate the spectrum of the Gaussian window.
AnaIytk results. Consider the Gaussian window function defined by
for all t
387
Computer results
(a) Compute the log-magnitude spectrum of this window and compare the
main-lobe width and sidelobe level with the windows given in Table 9.1.
(b) Try to invent your own window sequence that has better characteristics than
those above. Do this by modifying the values of ope of the window sequences
given in this chapter. An analytic form for the window sequence values is not
necessary.
9.2. Variable-duratioo windows
Object. Write a subroutine to generate a variable-duration window sequence.
This subroutine will be used in the following project. Write the subroutine
HAM(WH, NW)
where
WH (real output array) of size 128 that contains a Hamming window sequence
centered at N = 64 and has duration equal to NH. The rest of the WH
array is equal to zero.
NW (integer input) is the duration of the window. NW must be an odd
integer.
This WH array is appropriate for windowing unit-sample sequences that are
symmetric about a point. The windowing operation is accomplished by multiplying
HD(N), the 128-point approximation to the desired unit-sample response by the
128-point WH(N) array.
Repeat for the Blackman window by writing
BLACK(WB, NW)
Compoter results Verify the operation of HAM and BLACK by computing and
plotting the window sequences for NW = 31,63 and 127.
9.3. Linear-phase FIR filter design using the DFf/windowing method
Object. Design a causal linear-phase FIR filter that satisfies ore of the magnitude
response specifications given in Appendix B using the DFf/windowing procedure.
AnaIytk~
(a) Sketch the (linear, not log) magnitude response that is obtained by extending
the passbands.
(b) Choose the type of symmetry (even or odd) and the point of symmetry (on a
sample point or between sample points) of the causal unit-sample response.
Justify your choice.
(c) Sketch the appropriate linear-with-frequency phase response curve for the
filter. The principal value of the phase is not needed and should not be
sketched.
Computer results
(a) Compute and plot the 128-point approximate desired unit-sample response
{hd(n)} that is symmetric about n = 63. Ho(N) is symmetric about N = 64.
(b) Truncate {hin)} by using an Nw-point Hamming or Blackman window.
Justify your choice or compare the two.
Starting with Nw = 64, truncate Ho(N). Compute and plot the log-magnitude
response of the windowed unit-sample response. Reduce Nw until the specification
is no longer met. Provide log-magnitude response plots for all the values of Nw
used, i,n the order that they were tried, to indicate your strategy.
388
(c) For the filter design that meets the specification and has the smallest
unit-sample response duration, do the following:
(i) determine HMAX and scale the coefficients so that the maximum of the
magnitude response is equal to one.
(ii) plot the unit-sample response and indicate the symmetry on the plot.
(iii) plot the phase response and sketch the linear trend on the plot.
(iv) sketch the block diagram of the FIR filter structure.
9.4. Unear-phase FIR filter design using frequency-sampUng method
Object. Design a causal linear-phase FIR filter that satisfies one of the magnitude
response specifications given in Appendix B using the frequency-sampling procedure.
Analytic results
(a) Sketch the (linear, not log) magnitude response that is obtained by assigning
the response in the transition region to be a raised-cosine function that
connects the passband and the stopband.
(b) Determine the value for N, the duration of the filter unit-sample response.
Computer results
(a) Implement the comb filter and resonators. Compute and plot the unit-sample
response. Indicate the symmetry on the plot.
(b) Compute and plot the 128-point log-magnitude response of the filter. Circle
the points on the response curve that were specified in the frequency sampling
procedure.
(c) Sketch the filter block diagram. Compare the number of multiplications of this
frequency-sampling structure with that required for the nonrecursive FIR
linear-phase structure having the same unit-sample response.
9.S. Designing a filter with specific magnitude response shape with the fiequency.
sampHng method
Object. Design a filter whose magnitude response approximates a given analytic
form using the frequency-sampling method.
Implement the filter that approximates the desired magnitude response given
by one of the following:
(1) Linearly decreasing response
IHo(ej")1 = a(l- co/,,)
forOscos"
forOscos"
a"YJ
for Os co s"
Let a be the number determined by placing a decimal point before the first
nonzero digit in your student ID number. For example if ID = 0123, then
a=0.123.
Error criterion. The filter magnitude response is allowed to deviate from this
specification by 2% of the maximum of the magnitude response.
389
Analytic results
Sketch the desired magnitude response and indicate the limits that must contain
the final filter magnitude response.
Computer results
(a) Compute and plot
IHD(k)1 = IHD ( ej 2>rkll28)1
for 0 :S k
:S 64.
(b) Starting with N = 32, implement the comb filter and resonators. Compute and
plot the unit-sample response.
(c) Reduce the value of N. For each reduction, compute the 128-point magnitude
response and compare with the specification by calculating the error sequence
given by
E(k) = IHD(k)I-IH(k)1
for 0 :S k
:S 64.
The error element having the largest magnitude, denoted by IElm.,., should be
found. The filter design is successful when the minimum N is found, for which
IElm"" <O.02a.
(d) For the filter design that meets the specification and has the smallest number
of resonators, sketch the filter block diagram. Compute and plot the 12S-point
magnitude response of the filter. Circle the points on the response curve that
were specified in the frequency sampling procedure. Compute and plot the
unit-sample response. Compare the number of multiplications with that
required for the nonrecursive FIR linear-phase structure.
CHAPTER
10
FINITEPRECISION
EFFECTS
10.1 INTRODUCTION
Finite-precision effects are caused by the errors due to representing numbers to
a finite accuracy. These effects were previously noted in Chapter 8, when the
computed pole locations of IIR filters were different from those desired, the
difference being due to round-off effects in the calculations. These effects are
also important when implementing a filter structure on a computer or digital
hardware, which represents numbers as a finite set of binary values. In this
case, the input sequence and coefficients values must be represented in such a
finite-precision number system, as well as the results of the arithmetic
operations of addition and multiplication.
We start by defining the two most common forms of representing
numbers in the computer, fixed-point and floating-point notation. Then, three
effects that occur in finite-precision number systems are considered. The first is
the conversion of continuous-valued, or infinite-precision, signal values into
finite-precision values. This occurs in the analog-to-digital conversion operation. This effect is shown to be similar to adding noise to the input signal
values. The second effect occurs when the filter coefficient values, computed to
infinite precision in theory, are constrained to equal one of the allowable
numbers represented in the computer for the filter implementation. As a
result, the singularities in the z plane are limited to lie on a grid of allowable
390
391
locations. The deviations that are produced in the resulting transfer function
are considered. The third effect is the truncation that results when the sum or
product of two finite-precision numbers is itself represented as a finiteprecision number. If the filter being implemented is a nonrecursive structure,
this effect is similar to adding noise to the output of each multiplier. However,
if the filter has a recursive structure, the truncation of the product may cause
the output to exhibit undesired offsets or oscillations, called limit cycles.
Since these finite-accuracy effects are nonlinear and random, their
analysis is very complicated. To provide some insight, special cases are
analyze(l to indicate the type of behavior that can be expected. Procedures for
simulating and observing these effects on a computer are described. The intent
of this chapter is to present some points to be aware of when designing filters
in a finite-precision number system, but not to provide a comprehensive
analysis of these effects. Such an analysis is most difficult and beyond the scope
of this text. In the cases when the analysis can be performed, it requires results
from nonlinear system theory and probability theory. The analysis can be
found in the references at the end of the chapter.
binary point
~ b l bits f~r fraction
---,'.1
,----_ _ _-A-.l _ _ _
SI I I I I I I I I I I I I I It
sign bit
least Significant
bit
FIGURE 10-1
Allocation of bits in a word for fixed-point representation (l6-bit word is shown).
392
exponents, including zero, and the negative exponents. For example, the
decimal value of the binary number 01.101 2 is determined as
01.101 2 = ( + )(1 x 2) + (1 x 2- 1)
+ (0 x 2- 2) + (1 x T
= 1.625\0'
FINITEPRECISION EFFECTS
393
remainder
~=3
~=1
~=O
1
1
1
1
o
1
1
Hence,
0.8610 = 0.1101 2 { = 0.8125 1O} by truncation
= 0.11102{= 0.87510) by rounding
Combining these two results, we have
6.86\0 = 0110.1101 2 by truncation
= 0110.11102 by rounding
394
TABLE 10.1
Binary .amber
latecer values
(biliary polIIt
at rigIat)
Fractious
(biliary poiat
after sign bit)
2-bit.8IIIbersystem
01
00
11
10
1
0
-1
-2
0.5
0
-0.5
-1
011
010
001
000
111
110
101
100
3
2
1
0
-1
-2
-3
-4
0.75
0.5
0.25
0
-0.25
-0.5
-0.75
-1
0111
0110
0101
0100
0011
0010
0001
0000
1111
1110
1101
1100
1011
1010
1001
1000
7
6
5
4
3
2
1
0
-1
-2
-3
-4
-5
-6
-7
-8
0.875
0.75
0.625
0.5
0.375
0.25
0.125
0
-0.125
-0.25
-0.375
-0.5
-0.625
-0.75
-0.875
-1
"
FINITEPRECISION EFFECfS
5Sign of mantissa
I I I II I
395
5Sign of exponent
I II
L -________~-----------JA~_y--~
mantissa
exponent
ftGURE 10-2
Allocation of bits in a word for floating-point representation (l6-bit word is shown).
pattern within the word, as shown in Fig. 10.2. If the word contains b bits, let
b m be assigned to the mantissa and be to the exponent. Since b = be + b m , a
hardware designer must decide on the bit allocation between the mantissa and
exponent. The number of bits assigned to be determines the range of the
number system, while the number of bits assigned to b m determines the
precision. A common compromise is to set bm = 3b/4. In many minicomputers,
two 16-bit words are combined to express a floating-point number as a 32-bit
word, of which b m = 24 and be = 8.
In the next section, we consider the effect of representing the infiniteprecision values of a discrete-time sequence in such a finite-precision system.
2b
(10.2)
For a given quantizer range, increasing the number of bits reduces the step
size, making the staircase pattern approach a straight line.
There are two types of errors that can be introduced by such a quantizer.
The first is granular error, which occurs when Ix(n)1 < M, and is denoted by
Eg(n), where
(10.3)
is always less than the step size fl.. The
Note that the magnitude of this en:pr
<
396
0111
0110
0101
0100
5
4
0011
0010
------~------------~~~----------+_~~n)
-M
-7
1l0I
1100
lOll
1010
1001
-8
1000
-4
-5
-6
fiGURE 10-3
Quantizer characteristic for a 4-bit quantizer.
second error occurs when Ix(n)1 > M, when the amplitude exceeds the
quantizer limits, and is called clipping error, denoted by Ec(n), where
_{x(n)-M -1
Ec(n) - x(n) + M
(10.4)
FlNITEPRECISION EFFECTS
397
XZrms = -
2: x2~n)
(10.5)
n=O
The rms values for many common signals, such as telephone speech and
recorded music levels on tape are usually specified or determinable by simple
measurements.
For speech processing applications, it is not uncommon to have the
quantizer limits set equal to 4Xrms ' This setting represents a compromise in
which an accurate representation of the small-amplitude signals, which occur
more commonly, is achieved at the expense of large errors for more rarely
occurring large-magnitude signals. Nonlinear quantizer characteristics are also
common, in which the step size varies with the magnitude of the input signal.
A further discussion of nonuniform and also time-varying quantization
schemes can be found in the reference by Jayant and Noll.
To analyze the quantization operation, we employ the additive error
model shown in Fig. lOA. The quantized value xq(n) is considered to be equal
to the true value x(n) plus a random additive noise term Eg(n), or
xq(n) =x(n)
+ Eg(n)
(10.6)
When matched to a random signal having a known average power level, the
step size t:. is equal to
t:. = 8Xnns
2b
(10.7)
t:. 2/12
= 12 22b
64
(10.8)
The SNR is observed to improve exponentially with the number of bits in the
quantizer. Expressing the SNR value in decibels, we have
12 22b) = 6b - 7.3
SNRdB = 10 10glO ( 64
x(n)--~
FIGURE 10-4
Additive noise model for quantizer.
. (10.9)
398
This last result states that the signal-to-noise ratio improves by 6 dB for every
bit that is added to the ADC. The effect of the quantization error on the SNR
for a digital audio system is illustrated in the example below.
Example 10.3. Quantization error in a digital audio system. Let the input be
{x(n)} with an rms value equal to Xrms and let the quantizer limits span 4X""s.
If a 16-bit quantizer is employed, a SNR of greater than 88 dB can be achieved.
The current claim for commercial digital audio systems is approximately 84 dB.
The difference is due to the thermal noise in the analog amplifiers and the
digital-to-analog conversion, which were not considered in the analysis.
EFFECf OF QUANTIZATION NOISE AT THE FILTER OUTPUT. The quantization error in the ADC process was modeled as the addition of a noise
sequence to the infinite-precision sample values. To examine the contribution
of this noise sequence to the output sequence produced by a linear digital
filter, we apply the quantized signal to the filter and can express the output
sequence as
{Yq(n)}
= {xq(n)} * {h(n)}
= {x(n) + Eg{n)} * {h{n)}
(10.10)
Because the filter is linear, we can apply the superposition principle to get
{Yq(n)}
(10.11)
The sequence {y(n)} is the output that would have been observed for
infinite-precision samples and {ve (n)} is the output produced by the sequence
of noise values. These output noise values can be written explicitly as the sum
of the random errors scaled by the terms of the unit-sample response as
v.,(n)
""
~ h(k)Eg(n - k)
(10.12)
k=-co
a~ = 0; ~ h 2 (k)
(10.13)
k=-oo
This simple relationship allows us to compute the output noise power in terms
of the input noise power and the filter unit-sample response.
Example 10.4. Noise variance at the output of the 3-sample avenger. The
difference equation of 3-sample average is given by
y(n)= l[x(n
+ 1) +x(n)+x(n -1)]
FINITEPRECISION EFFECTS
399
If the input sequence has been quantized to the set of integers, then the step size
is 1. If the range of the quantizer is large (> 1(0) and the input amplitude has
been matched to the quantizer, the quantization errors can be considered to be
= -b.. The errors can be
uniformly distributed. The error variance is then
considered independent if consecutive values of {x(n)} tend to occur in different
levels of the quantizer in a random fashion. The noise variance at the output is
then
a;
If the input sequence has been quantized to the set of integers, then the step size
is 1. Under the same conditions as in Example lOA, the noise variance at the
output is then
~
o~ = 0;
2: a
= 1/[(12)(1 -
)]
k=O
1)~1_ O.943z
~ 0.849643z
I)
2
(cascade form)
(direct form)
If the coefficients are quantized by rounding to the nearest 0.05, then the cascade
400
form becomes
1
which has poles at z = 0.9 and 0.95. The resulting filter is stable. However, the
Direct form becomes
1
H(z) = 1-1.85z
+ 0.85z-2
which factors into poles located at z =0.85 and 1.0. The pole lying on the unit
circle makes the filter unstable. This example illustrates that the sensitivity of a
filter to coefficient quantization increases with the order of the filter.
(10.14)
Bit paHera
Coellicient values
(Zr cos(8) or,z)
0000
0001
0010
0011
0100
0101
0110
0.125
0.25
0.375
0.5
0.625
0.75
0.875
1.0
0.354
0.5
0.611
0.707
0.791
0111
(multiplication by 1)
0.866
0.935
1.0
FINITEPRECISION EFFEcrs
401
(0)
1m
JUHM
jU7!17
Izl=l
jus
jU3S
0 ~-----+--~~~~~-Re
0.5
(b)
1m
r =0.5,9 =60"
I
1
Ir
=0.35,9 =45 0
r =0.28,9 =30
I
1
O~~------+----------Re
FIGURE 10-5
Coefficient quantization effects in the z plane.
0) Quantizing ,2 produces circles of radius r.
b) Quantizing 2r cos( 8) produces vertical lines.
z plane passing though z =2r cos( 8), as shown in Fig. 10.5(b). This vertical
line indicates the pairs of allowable rand 8 values that can occur. Quantizing
this coefficient produces a set of corresponding vertical lines. The locations of
the allowable singularities for the second-order section can then fall only at the
points of intersection between these circles and vertical lines. The points of
intersection for the 4-bit quantization are shown in Fig. 10.6. Note that
quantizing the coefficients in this manner produces a non-uniform distribution
of the locations that tend to cluster around z = j. Alternate filter structures
have been proposed that produce a uniform distribution of the allowable
locations in the z plane. These are described in the references.
Because of the coefficient quantization, the position of the zero must be
shifted from that desired by theory to one of the four adjacent allowable
positions. The filter designer must choose one of these positions or increase the
number of bits in the finite-precision representation. This latter choice comes
with an increase in hardware cost and possibly slower operation, The following
example illustrates the implication of these results for FIR filter design.
402
1m
jo 866
jo 707
0
0
0
0
0
jo 5
jo 35
~_,-~-.~~~e-~-&~~---Re
0.5
FIGURE 10-6
Allowable locations in the right-hand
z plane for singularities when 4-bit
quantization is employed. Complexconjugate singularity locations are
not drawn.
Example 10.7. Effects of FIR filter coefficient quantization. Let us assume that
we want to implement a second-order FIR filter having 4-bit precision. Let the
desired filter transfer function be given by
HF1R(Z) = (1- O.9ei70"z-I)(1_ O.ge- i 7O"z-1)
The desired zero location at z = O.gei70" is shown in Fig. 1O.7(a). Because of
coefficient quantization, the zero position must be moved to one of the four
adjacent grid locations, labeled 1 through 4 in the figure, that are located at
z = O.866eJ64, Z = O.866e i73 , z = O.935ei66 and z = O.935eJ74 The magnitude
responses of these four zeros are shown in Fig. 1O.7(b). All the zeros produce a
valley in the magnitude response, but the location of the valley is related to the
angle of the zero, while the depth is related to the radius of the zero and the
interaction with the complex-conjugate zero.
DR FILTERS. For IIR filters, a similar effect occurs to that described above for
the FIR filters. However, since IIR filters can become unstable, an additional
consideration is required. As discussed in Chapter 5, an IIR filter can be
configured either as a cascade of second-order sections or in a direct form
implementation. In any case, the poles must be inside the unit circle for a
stable filter. For the cascade configuration of second-order sections, the
locations of the poles of each section can be easily verified or be made stable
by placing the poles at the set of allowable locations determined by the
quantization that lie strictly inside the unit circle. The desired pole must then
be transferred to the closest allowable pole location in the hardware
implementation. Because of this shift in the singularity location, a change in
either the resonant frequency or bandwidth occurs. As described in Chapter 6,
as the poles approach the unit circle, the changes in the magnitUde response
become increasingly drastic.
Example 10.S. Effects of DR filter coeffident quantization. Let us assume that
we want to implement a second-order IIR filter having 4-bit precision. Let the
FINITEPRECISION EFFEcrs
403
(a)
1m
40j
10
02
~--------------~Re
IH(eJ"')1
(b)
2.63
O~
____________________. -______
~,ro
FIGURE 107
Effect of quantization on
zero placement. a) Desired
zero location must be shifted
to one of lour closest neighbors when filter is implemented. b) Four magnitude
response curves corresponding to the four allowable
pole locations.
For both FIR and IIR filters, as the order of the filter increases, the
placement of the singularities is complicated by their interactions. In practice,
an optimization procedure is usually performed to find the combination of
singularity positions that produces the best approximation to the desired
404
(a)
1m
/DESIRED POLE
4'1.
~
'1.'1.'1. 3
'1.
O L - - - - - - - - -..... Re
1
FIGURE IN
O~----------------~ro
o
n
FlNITE'PREClSION EFFEcrs
405
does not fall outside, or overflow, the number range when additions and
multiplications are performed. We consider each operation separately.
Addition in fixed-point arithmetic. The addition of two fixed-point numbers
expressed in 2's-complement notation is simple: The two numbers are simply
added bit by bit starting from the right, with the carry bit being added to the
next bit location. The final carry bit is discarded. A subtraction is performed
by first negating the number to be subtracted and then adding.
Example 10.9. Addition of two fixed-point numbers. Using the 4-bit number
representatioR xxx.x, perform the following additions:
1.5\0 + 1\0:
OOLl
001.0
010.1
(= 2.5\O)
2.5\0 + (-21O):
OlD.l
110.0
1 000.1
(= 0.5\O)
tOLl
010.0
111.1
(=-0.5\0)
011.0
011.1
110.1
(= -1.51O)
3+3.5:
Overflow error occurs in the last result because 6.510 cannot be represented
in this 4-bit number system.
When two numbers of b bits each are added and the sum cannot be
represented by b bits, an overflow is said to occur. To describe a procedure
that prevents it from occurring, let us consider an FIR filter structure that
contains a total of M additions, as shown in Fig. 10.9. Let the number system
have its binary point immediately to the right of the sign bit, so that only
fractions are represented. The values of the input sequence {x(n)} can then be
normalized to have magnitudes less than or equal to one. The multiplier
coefficient values can also be scaled to be less than 1. Then the sum of these M
terms is always less than M. To prevent overflow when the sum is computed,
the input sequence must be scaled so that all the values have magnitudes that
are less than 1/M. This scaling then ensures that the maximum possible total is
less than or equal to 1.
406
x(n)
--..._------l
y(n)
FIGURE 10-9
Filter structure having M inputs to adder.
407
2.5 10 x 1.510 :
010.1
x 001.1
0101
x 0011
0101
0101
0000
0000
0001111 = 00011.11 when the binary point is restored
Restoring the 4-bit representation, the product becomes
001l.1 2 ( = 3.5 10) by truncation, and
0100.02 ( = 4.010) by rounding
408
two floating-point numbers, the two mantissas are multiplied using the
fixed-point multiplication procedure and the two exponents are added. The
exponent value is then adjusted, so that the magnitude of the product of the
mantissas falls within [t 1).
Example 10.12. Multiplication of two ftoating-point numbers. Let us consider
an 8-bit number representation with 5 bits to represent the mantissa and 3 bits to
represent the exponent. We want to perform the multiplication
2.73510 x (-1.25)10
Expressing 2.73510 in floating-point notation, we get 0.68375 x 22 or
01011 0102,
Since the second multiplier is negative, the product will be negative.
Expressing the magnitude 1.25 10 in floating-point notation, we get 0.625 x 21 or
01010001 2,
Performing the mUltiplication of the mantissas, we get
01011
01010
00000
01011
00000
01011
00000
001101110
which is equal to O. 0110111~( = 0.4296875 10 ) when the binary point is restored.
By truncation, we get 0.01102 (=0.375 10), and by rounding we get 0.01112(=
0.4375 10)'
Performing the addition of the exponents, we get 0102 + 001 2 = 011z( = 310),
After converting the mantissa into a negative number, the final result is
11010 011 2( = -310) by truncation or
11001 011 2 ( = -3.5 10) by rounding
FINITE-PRECISION EFFECTS
409
FIGURE 10-10
Multiplication truncation effect is modeled as an additive noise source at the output of each
multiplier for the general Direct Form II filter structure.
410
x(n) -----..-----f
>-----:~
yen)
FIGURE 10-11
Multiplication truncation effect is modeled as an additive noise source at the output of each
multiplier for the Direct Form II FIR filter structure.
a~ut = N 12 = N2-
2b
f /12
(10.16)
Since the noise power increases with N, and N is also equal to the duration of
the FIR filter unit-sample response {h(n)}, this is another reason why it is
desirable to make the duration of {h(n)} as short as possible.
FINITE-PRECISION ARITHMETIC EFFECfS IN UR FILTERS. The analysis of
truncation effects for IIR filters is more complicated than for FIR filters
because of the feedback structure. Because of this feedback, the errors
associated with finite-precision multiplications and additions circulate back into
the filter and affect future values of the output. As described below, these
errors may produce unwanted oscillations, called limit cycles.
In general, the analysis of these limit cycles is very difficult. To
demonstrate their existence, we consider the simple special case of the limit
cycles that occurs in response to a unit-sample sequence. Since the input to the
filter is zero for values of n other than n = 0, these limit cycles are commonly
called zero-input limit cycles. These cycles exist when the unit-sample response
is prevented from decaying to zero because of multiplication truncation.
Example 10.13. Limit cycle in first-order recursive filter. Let us assume the
digital filter is implemented with the number system having precision equal to O.l.
Consider the unit-sample response of the first-order recursive filter described by
y(n) = -0.9 y(n -1) +x(n)
FINITEPRECISION EFFEl TS
411
0.8
0.6
0.5
0.5
0.5
-\ 0
-0.5
-0.5 -0.5
-0.7
-0.9
LIMIT CYCLE
FlGURE 10-12
Example of a zeroinput limit cycle in the
unit-sample response of
a first -order recursive
filter implemented with
finite-precision
arithmetic.
These limit cycles also appear as unwanted noise at the output. But they
are different from those previously considered in that, rather than being
random (producing a "hiss"), they are correlated (producing a "hum" or
"buzz"). Even for such simple cases, the complete analysis of these limit
cycles, which determines under what conditions they exist and what their
amplitude and frequency characteristics are, is beyond the scope of this book,
but is included in the references.
ParaUel versus cascade implementation of filters. Parallel combinations are
easier to analyze because they can be considered separately. For example, for
parallel implementations, all sections can exhibit zero-input limit cycles
independently. Cascade implementations are more difficult to analyze because
the output of the first section is then the input to the second. Hence only the
first section in a cascade connection can exhibit a zero-input limit cycle. The
second section then has this limit cycle as an input and, by definition, cannot
have a zero-input limit cycle. Since the nature of the limit cycle depends on the
first or second-order filter characteristics, and only the first section can exhibit
a zero-input limit cycle, the sequence observed at the output of the cascade
combination depends on the ordering of the sections in the filter implementation. This effect is considered in the projects.
Since the analysis of these quantization effects is very difficult, we now
tum to programming techniques to simulate these effects arid provide insights
into their behavior.
412
QUANT(X,NI,NF,XQ)
where X (real input), NI and NF (integer inputs) and XQ (real output) are
defined above. The precision is equal to 2- NF, and the range of integer values
is then from _2N1 - 1 to 2NI - 1 - 2-NF
The simplest and fastest way of implementing this conversion is to use the
truncation function IFIX in FORTRAN. If Y is a floating-point number, then
N = IFIX(Y) is the integer part. For example, if Y = 2.8, then N =
IFIX(2.8) = 2. If Y> 0, by adding 0.5 to Y, we get a rounding to the nearest
integer, or N = IFIX(Y + 0.5). For example, N = IFIX(2.8 + 0.5) = 3. If Y < 0,
we must subtract 0.5. For example, if Y = -3.9, then N = IFIX( -3.9 - 0.5) =
-4. Using this IFIX function, the quantizer can be implemented by first
multiplying the value of X by a constant C, performing IFIX(CX + 0.5), and
then dividing the result by C. This sequence of steps produces the desired
value for XQ when C = 2NF. The value of NI is used to check whether the
number X is within the allowable range. If X exceeds the range, XQ should be
set to the maximum or minimum value in the number system, depending on
whether X exceeds the positive or negative limit. The following example
illustrates the conversion process.
Example 10.14. mustratioD of the QUANT cODvenioD process. Consider an
8-bit digital hardware system using 2's-complement notation with NI = 5 and
NF = 3. Quantize the values of X given below.
FINITEPRECISION EFFECI'S
413
= IFIX(8X + 0.5)
for X~O,
and
XQ = IFIX(8X - 0.5)
for X < 0
8
Since NI = 5, the range is from -16 (1000 000) to 15.875 (01111111).
For X = 3.1415926,
For X= -2.87,
For X = 37,
For X=-37,
SCALE(X,NX,F)
where
X
(real input/output array) is the discrete-time sequence to be scaled
NX
(integer input) is the size of the array
F
(real input) is the scale factor
The operation that is performed is given by
X(N) = F*X(N)
for 1 sNsNX
We next describe the sequences that can be used as the inputs to filters
implemented with finite-precision number systems.
INPUf SEQUENCES. Previously, t~e unit-sample sequence and sinusoidal
sequences have been employed as inputs to the various filters. These can also
be used for finite-precision filters. The unit-sample sequence shows the
existence of the zero-input liinit cycle for recursive filters. The sinusoidal
sequence having the frequency corresponding to the location of the filter
414
magnitude response maximum value can be used to ensure that the range of
the number system is not exceeded. We also consider a third type of input
sequence, the random sequence, that can be used to observe the filter output
behavior of signals that are more representative of actual signals. We first
consider the white random sequence, which on average has a spectrum that is
constant with frequency. We then filter this white sequence with a lowpass
filter to generate a lowpass correlated random sequence, and with a highpass
filter to generate a highpass correlated random sequence. A random number
generator is described next that can be used to generate the random
discrete-time sequence.
In FORTRAN, a random number can be generated by a call to the
pseudorandom number generator. On the VAX/VMS system, this is done with
the statement
A=RAN(NRANl,NRAN2).
where NRAN1 and NRAN2 are seeds used by the generator. The values for
these seeds must be specified to equal two arbitrary integers at the beginning
of the program, before the random number generator is called. Each time this
statement is executed, the variable A takes on a new value of a uniformlydistributed random number between 0 and 1. The average value of these
The nth element of
random numbers is then 0.5 and the variance is equal to
the N-point white random sequence {wen)} can be set to a zero-mean random
number with the same variance with the statement
n.
(10.17)
= ~ [X~(k) + Xf(k)]
for 0:5 k :5 N - 1
(10.18)
If this is performed M times and the ith result is denoted by {P'(k)}; the
average value of the sequence, {Pavek)}, is given by
1 M
Pavek) = M ~ P;(k)
for 0 :5 k :5 N - 1
(10.19)
=a
for all k
(10.20)
where a is a constant. That is, the white sequence has equal components at
each frequency, on average. The power spectral sequence {P(k)} of a single
FINITE-PREOSION EFFEcrs
(0)
(w(n)
(b)
(u(n)
415
It
(c) {v(n)}
()
It
w
FIGURE 10-13
Examples of random sequences. The discrete-time sequences represent a typical realization of the
random process. The frequency curves represent the power spectrum of the realization and the
average power spectrum. a) White random process. b) Lowpass random process. c) Highpass
random process.
for0:5n:5N-1
(10.21)
416
for all k
(10.22)
M-+oo
This power spectral sequence has most of its power concentrated at low
frequencies. One example of a highpass random process {v(n)} can be defined
as
v(n)
= Uw(n) -
w(n
+ 1)]
for OSnsN-1
(10.23)
property that
lim Pav(k) = (1- cos(21rk/N))/2
for all k
(10.24)
M--.oo
This power spectral sequence ,has most of its power concentrated at high
frequencies.
These white and correlated sequences represent interesting classes of
signals that approximate signals that occur in practice. To observe the
finite-precision effects, these sequences are first applied to a digital filter that is
implemented in an infinite-precision number system, approximated by the
REAL variable in a 16-bit or 32-bit computer system. The output sequence
produced in this case can be compared with that produced by the same filter
structure but implemented with a finite-precision hardware. The effects of
finite-precision can be observed by taking the difference between these two
output sequences. The projects at the end of this chapter illustrate this
procedure.
10.8 SUMMARY
Quantization effects are caused by the errors that are due to representing
numbers with a finite precision. Two finite-precision number systems have
been described, the fixed-point and floating-point notation. Three effects due
to finite-precision were considered. The first occurs when the continuousvalued signal amplitude is represented with a finite number of bits in the
analog-to-digital conversion operation. This effect was shown to be similar to
adding noise to the signal. The second effect occurs when the filter coefficient
values are expressed in finite precision. This effect was shown to limit the
locations of the singularities in the z plane to lie on a grid. The corresponding
deviations of the magnitude response were illustrated for poles and zeros. The
third effect is the truncation that results when the sum or product of two
finite-precision numbers is itself represented as a finite-precision number. For
FIR filters implemented in the direct-form nonrecursive structure, this effect
was shown to introduce additive noise to the output sequence. For IIR filters,
FINITEPRECISION EFFECTS
417
however, these errors circulate in the memory of the filter and can produce
undesirable oscillations, called limit cycles. The chapter ends by describing
programming techniques to simulate these finite-precision effects, which are
very difficult to determine analytically.
These finite-precision effects are most important in three practical cases:
1. when specifying the number of bits in an ADC;
2. when implementing a filter in special purpose hardware to minimize the
number of bits in the finite-precision number system;
3. when implementing filters whose poles lie near the unit circle.
REFERENCES TO TOPICS
Zero-input Omit cycles
Blackman, R. B.: Linear Data-smoothing and Prediction in Theory and Practice, Addison-Wesley,
Reading, MA, 1965.
Jackson, L. B.: "Roundoff-noise analysis for fixed-point..digital filters realized in cascade or
parallel form," IEEE Trans. Audio Electroacoust., AU-IS: 107-122, (1970).
Jackson, L. B.: "Roundoff noise analysis in cascade realizations of finite impulse response digital
filters," Bell Sys. Tech. J., 52: 329-345 (1973).
FDter optimization proceclares
Avenhaus, E.: "On the design of digital filters with coefficients of limited word length," IEEE
Trans. Audio Electroacoust., AU-20: 206-212 (1972).
Oppenheim, Alan V., and Ronald W. Schafer: Digital Signal Processing, Prentice-Hall,
Englewood Cliffs, NJ, 1975.
Rabiner, Lawrence R., and Bernard Gold: Theory and Application of Digital Signal Processing,
Prentice-Hall, Englewood Cliffs, NJ, 1975.
Taylor, F. J.: Digital Filter Design Handbook, Marcel Dekker, New York. 1983. Advanced topics
also covering ladder and wave filters. Includes hardware and software considerations.
~
conversion
Jayant. N. S. and Peter Noll: Digital Coding of Waveforms, Prentice-Hall, Englewood etiffs. NJ.
1984.
Mano, M. Morris: Digital Logic and Computer Design, Prentice-Hall, Englewood Cliffs, NJ. 1979.
PROBLEMS
10.1. Range IUld preCISIon using 2's-c:omplement fixed-point notation. Consider a
computer with an 8-bit word. Determine the range of values and the increment
between numbers that can be expressed when the binary point is placed at the
following locations:
(a) after the right-most bit
(b) after the sign bit
(c) in the middle of the word
10.2. Repeat Problem 10.1 for a 16-bit word and a 32-bit word.
418
18.3. Rup aacI predsioa using ftoating-point notation. Determine the range of
values and the increment between numbers that can be expressed for a b-bit
word containing bID bits for the mantissa and be bits for the exponent for the
following values of b, bID and be:
(a) b = 8, b m = 6 and be = 2
(b) b=8, b",=2 andbe =6
(c) b= 16, b", = 12 and be=4
(d) b =32, bID =24 and be =8
1&.4. Convert the following decimal numbers to binary representation using 16-bit
notation in which the fraction is represented by 8 bits. Indicate the results
obtained both by rounding and truncation:
(a) 117
(b) 0.0726
(c) 43.34
(d) -18.68
10.5. Perform the following additions in binary representation using an 8-bit notation
in which the fraction is represented by 4 bits. Indicate the results obtained both
by rounding and truncation.
(a) 2.510 + 3.2510
.
(b) 2.510 + -3.2510
10.6. Perform the following multiplications in binary representation using an 8-bit
notation in which the fraction is represented by 4 bits. Indicate the results
obtained both by rounding and truncation.
(a) 2.5 10 x 3.2510
(b) 2.5 10 x -3.25 10
10.7. Perform the following calculations with binary numbers using both 2'scompleml!nt fixed-point with 8-bit words in which three bits are assigned to the
fraction. Perform the truncations by rounding.
(a) 1.5 - 3
(b) 2xn.
(c) 0.33 x 0.8
(d) -0.9 x 5.6
10.8. Perform the calculations given in Problem 10.7 by using floating-point notation
with 8-bit words in which three bits are assigned to the exponent (including the
sign bit of the exponent).
10.9. Express n as an 8-bit word using 2's complement notation, when the range of
the number system is [-8, 7].
10.10. Derive the SNR value similar to Eq. (10.8) for a sinusoidal signal whose
amplitude is equal to the maximum level of the quantizer.
10.11. Consider the all-pass system function given by
H(z) = 1- p-1 Z -l
1- pz
forO<p<1
FINITEPRECISlON EFFECIS
419
(a) Determine the range to which the input sequence must be scaled such that
overflow is avoided for any sinusoidal input.
(b) Determine the range to which the input sequence must be scaled such that
overflow is avoided for any bounded input, that is, Ix (n)1 < M, for all n.
COMPUTER PROJECfS
10.1. Spectral whiteness of random nmnber generator
Object. Test that the random number generator on your computer produces a
white process.
Compater results. Generate a 128-point sequence of the white random sequence
{w(n)}.
To show the random shape of one realization of the power spectral
sequence, compute and plot 65 points of the power spectral sequence corresponding to O:s co :S re.
To show the limiting behavior of the averaging process, generate 10
independent {w(n)} sequences, compute the power spectral sequence of each,
compute and plot the average. To save on memory, compute a running average
by accumulating the individual spectral sequences and then 'dividing by the
number. Repeat with 100 independent sequences.
Comment on the "whiteness" of the spectral averages.
10.1. Spectral content of correlated random processes
Object. Test that the correlated random processes have lowpass and highpass
spectral shapes.
Computer results
(1) Generate a 128-point sequence of the lowpass rand(.m sequence {u(n)}
defined by Eq. (10.21). To show the random shape of one realization of the
po~ spectral sequence, compute and plot 65 points of the power spectral
sequence corresponding to O:s (J) :S re. To show the limiting behavior of the
averaging process, generate 10 independent {u(n)} sequences, compute the
power spectral sequence of each, compute and plot the average. To save on
memory, compute a running average by accumulating the individual spectral
sequences and then dividing by the number. Repeat with 100 independent
sequences. Comment on the agreement of the computer results with Eq.
(10.22) as the number of sequences increases.
(2) Repeat Part (1) for the highpass random process {v(n)}.
10.3. ADC conversion errors
Object. Compute the quantization errors produced by an analog-to-digital
converter and to compare the. noise power to the predicted value.
Consider an 8-bit quantizer characteristic that has the range [-8,7].
Implement the subroutines QUANT, to perform the quantization, and SCALE,
to match the input sequence to the quantizer. Two 128-point input sequences are
to be generated: {sin(ren/32)} and {w(n)} (the white random sequence).
420
Aualytic resds
(1) Determine the scale factors to be applied to the two input sequences to match
each to the quantizer.
(2) Compute the variance of the additive noise that is predicted if the
quantization errors are uniformly distributed and independent.
for
O~n ~
127
FlNlTEPRECISION EfFECTS
421
Computer results
(1) Limit-cycle of direct form implementation.
(a) Starting with 8-bits in the quantizer, matched to the range determined
above, plot the unit-samplr response that is produced when all the
products are truncated. Demonstrate the existence of a zero-input limit
cycle.
(b) Reduce the quantizer word size by one bit, while maintaining the same
range, and repeat Part (a).
(c) Repeat part (b) until the quantizer has four bits.
(2) Limit-cycle of cascade of second-order section implementation. Repeat Part (1)
under the foUowing conditions:
CHAPTER
11
INVERSE
FILTERING
11.1 INTRODUcnON
In this chapter, we discuss the interesting and important topic in signal
processing called inverse filtering. This topic integrates many of the digital
signal processing concepts presented in the previous chapters to solve the
problem of removing distortions from observed signals that are introduced by
measuring instruments or by physical transmission media. This inverse filter is
also commonly called a deconvolution filter in the fields of geophysics and
bioengineering. Inverse filters work best when applied to a system that can be
modeled by a system function Hm(z) that has the minimum-phase property.
This property'is defined in terms of the pole/zero pattern of Hm(z), the phase
response Arg[Hm(eiOJ )] and the unit-sample response {hm(n)}. Two procedures
for designing the inverse filter are presented. The first performs the design
directly in the z plane by placing the poles of the inverse filter at the locations
of the model zeros and the filter zeros at the location of the model poles. This
procedure is limited to models for which either the system function or the
pole/zero pattern is known. In the second design procedure, an FIR filter
approximation to the ideal inverse filter is obtained. Although not exact, these
approximations have useful applications in practice. Modifications to this
design procedure are discussed to include additive noise in the observed signal.
422
INVERSE FlLTERlNG
423
ECHO
~-----Jo Time
:t-IE_TE_CrE_D_SI_G_NA_L_ _ _ _
10
FIGURE 111
Model of a radar system.
424
SINGLE ECHO
DESIRED SIGNAL
---1~_~_~L_VT_E:_i_'E~~ 6~--~l------~~
ECHOES FROM
MULTIPLE TARGETS
~ -1. ._~_~_~TE_ER_i_E--,~
....lt2----~
--'t!.. I!-l
01-1
FIGURE 11-2
Desired operation of an inverse filter for the radar problem.
INVERSE FILTERING
TRANSMImNG
MODEM
,
TRANSMISSION
CHANNEL
425
RECEIVING
MODEM
TRANSMITTED SIGNAL
1-1
RECEIVED SIGNAL
III'III!
II"
~OES
1111"1~
I
I Ii
FIGURE 113
Model of a reverberant data transmission channel that exhibits echoes.
1o
CHANNEL MODEL
RECEIVED SIGNAL
1
Iii
I ,
FIGURE 11-4
Digital filter model for the reverberant channel.
DESIRED OUTPUT
RECEIVED SIGNAL
INVERSE FILTER
(ECHO SUPPRESSOR)
- ...- - - + . (
FIGURE 115
Desired operation of an inverse filter for the reverberant channel.
426
/z/=!
1m
-+<>--..-----t-Re
MINIMUM - PHASE
MIXED- PHASE
MAXIMUM - PHASE
FIGURE 11-6
Pole/zero pattern for minimum-phase, mixed-phase and maximum-phase systems.
INVERSE FILTERING
PRINCIPAL VALUE
OF PHASE RESPONSE
ENTIRE
PHASE RESPONSE
"tL \V\ 7
_:!\
11
41:7
OJ
1C------+--~7t-+UJ
FIGURE 11-'
Comparison of principal value
of the phase response, which is
produced by the DFf, and the
entire phase response.
the unit circle cause discontinuous jumps of H radians in the phase response. If
Mz zeros lie outside the unit circle, the phase response is equal to - MzH at
co = H.
One other point must be considered before the phase response criterion
of a minimum-phase model is given. In the description of all-pass filters in
Chapter 8, it was shown that when a zero of the system function, located at
z = Zo, is moved to z = l/Zo, the shape of the magnitude response of the
system is unaltered, but the phase response changes. Hence, a given
magnitude response can have many valid phase response functions.
From the behavior of the magnitude and phase responses described
above, we can form the following definition of a minimum-phase system:
For a given magnitude response, the minimum-phase system is the causal
system that has the smallest magnitude phase at every frequency co.
That is, in the set of causal and stable filters having the same magnitude
response, the minimum-phase response exhibits the smallest deviation from
zero phase. Note that the zero-phase filters described previously in the text
cannot be minimum-phase because they are noncausal and their system
functions have poles outside the unit circle. By adding sufficient delay to the
unit-sample response, these filters become causal and have a linear phase
response. The minimum-phase filter having the same magnitude response will
have a phase response that has a smaller magnitude at each frequency.
mE UNIT-SAMPLE RESPONSE CRITERION. In the time-domain, we can
find the condition on a causal unit-sample response {hm(n)}, by which we can
recognize a minimum-phase system. Recall that for a causal system, hm(n) = 0,
for n < O. Let us define the energy evolution factor E(M) to be
M
E(M)
= 2:
n=O
h;,,(n)
(11.1 )
428
2 o
MINIMUM - PHASE
MAXIMUM -PHASE
MIXED- PHASE
(LINEAR - PHASE)
FIGURE 11-8
Pole/zero pattern for minimum-phase, mixed-phase (linear-phase) and maximum-phase systems in
Example 11.1.
IH(eJ"')I
12.55
O~======~~-L
____ ____--Jw
~
It
Arg [H(eJ<O)
It
MINIMUM-PHASE
-It
-21t
-31t
-41t
FIGURE 11-9
Magnitude and phase responses for
minimum-phase, mixed-phase (Iinearphase) and maximum-phase systems in
Example 11.1.
INVERSE FILTERING
429
= Hm(z)
(11.2)
(11.3)
Hence, the system function of the inverse filter is the reciprocal, or inverse, of
the model, from which the name inverse filter is derived.
Let the system function of the detector model be given by
H ( ) = N(z)
m z
D(z)
(11.5)
430
(a)
MINIMUM-PHASE
.5
MIXED-PHASE
(LINEAR-PHASE)
r
0
I
I I
3
)on
MAXIMUM-PHASE
(b)
(M)
MINIMUM-PHASE
9.76
~--7''----
MIXED-PHASE
(LINEAR-PHASE)
FIGURE 1110
a) Unit-sample responses for mmlmum-
MAXIMUM-PHASE
2
5 M
DESIRED OUTPUT
.-_--.(yin)}=(d(n)}
(d(n)}
-+n
MODEL OF
BAND LIMITED
DETECTOR
Hm(z)
,fT
~
.9_
INVERSE
FILTER
!--.
n
H,,(z)
FIGURE 1111
Model of bandlimited detector and application of inverse filter.
INVERSE FILTERING
Z-l.
431
This result indicates that the poles of the inverse filter system function
correspond to the zeros of the model and the zeros of the inverse filter are the
poles of the model. For a stable and causal inverse filter, the poles of the
inverse filter system function must lie within the unit circle. Hence, a causal
and stable inverse filter can be implemented only if the physical system is
minimum-phase. The following examples illustrate this point.
Example 11.2. Inverse filter for the radar problem. Let us assume that the
radar pulse can be accurately given by
r"
hm(n) =-.-(-) sin[wo(n + 1)]
sm Wo
for n ~O
Using the results of Example 5.42, the radar pulse sequence is modeled by the
unit-sample response of the second-order filter defined by
1
H (z) = - - - - - - : - - : - - -2 : :
m
1- 2r cos(wo)Z 1 + r z 2
The system function of the inverse filter that compresses {hm(n)} into
{d(n)} is
Example 11.3. Inverse filter for the transmission channel problem. Let the
transmission channel exhibit only one echo, having amplitude a, where lal < 1,
and occurring K sample periods after the transmitted signal is received. Then the
unit-sample response of the channel is given by
and
hm(n) = 0, otherwise
This system model is not minimum-phase because it has a zero outside the unit
circle at z = -a. The inverse filter system function is given by
H,,(z) = 1/Hm(z) = 1/(1 + az- 1)
432
Since the pole of Hiz) is outside the unit circle, the inverse filter is unstable, but
it still converts {hm(n)} into {d(n)} (show this). However, if this conversion is
not done exactly, or if there is any noise present, the output sequence of this
inverse filter will approach infinity.
and
Arg[Hifa{k)]
= -Arg[Hm,N{k)]
(11.8)
hifa{n) =
k=-oo
hin + kNd )
(11.9)
INVERSE FILTERING
433
To minimize the associated time-aliasing effects, the value of Nd , the size of the
Nd-point Off, should be made as large as possible.
In the case that {hm(n)} has an infinite-duration, the observed sequence
{hm,N(n)} is equal to the first N samples, or
hm,N(n)=hm(n)
forO:sn:SN-1
(11.10)
Hm,N(e iw ) = 21
jf
r Hm(ei8)WR(eJ(W-8)
L1<
d8
(11.11)
434
Here we will only give the definition of this transform as it relates to designing
inverse filters. The derivation and other properties of the discrete Hilbert
transform are given in the references. It is sufficient to state that the phase
response sequence of the minimum-phase FIR filter can be determined from
the observed magnitude response sequence by employing the discrete-time
Hilbert transform. The observed magnitude response and the computed phase
response sequences can then be employed in the procedure previously
described in Section 11.5 to implement the inverse filter approximation.
Using the results of the discrete Hilbert transform, the phase response is
given by
Arg[H(dQl)) = 2~P
L: lo~
(11.12)
where the symbol P indicates the Cauchy principal value of the integral. The
Cauchy principal value is needed here because the cotangent function becomes
infinite when its argument becomes zero, or when 0 = w. In this case, the
integral must be evaluated through the limiting procedure given by
Arg[H(eiQl )] = lim 21
1C
--+0
[L
ro
-
w)/2] dO
(11.13)
-1<
cot[(O - w)/2]
dO]
The forms of the two functions that are multiplied and then integrated, for a
particular value of w, are shown in Fig. 11.12. Because of the complicated
analytic forms, the evaluation of the above integral must usually be performed
numerically. The log-magnitude response sequence is then used to determine
the values of the phase response sequence. A simple program to evaluate this
integral is given in the Projects.
-IT
cot( '-;')
0
IIIIII~IT
'-8
--~~~~----~O~--~W--------IT~--8
I
I
I
I
I
I
I
FIGURE UU
Relationship of the functions for
evaluating the discrete Hilbert
transform.
INVERSE Fn..TERING
43S
for
- l r S W S lr
lr
11:
(e)
.. ,111IIIII/fllllllllll........... "
for 0 S w S
211:
FlGURE 11-13
Results of Example 11.5. a)
Logmagnitude
response
employed in Hilbert transform. b) Phase response
produced by Hilbert transform. c) The unit-sample
response determined by inverse DFf.
436
This function was sampled at 1024 points over the range 0:5 OJ :5 2n to obtain the
log-magnitude response sequence. The integral to determine the phase response
was performed numerically using the DHT subroutine listed in the projects. The
resulting phase response {Arg[Hm(eJW}]} of the minimum-phase model is shown
in the figure. The phase response has the minimum-phase characteristics of being
continuous-valued and returning to zero at OJ = n. The unit-sample response
{hm(n)} shown in the figure was obtained by computing the inverse DFT of the
real and imaginary sequences computed from these magnitude and phase
response sequences.
1 _ 2r cos( 8)z
+ rZz
where a = -2r cos(8) = -1.66 and b = r2 = O.S1. The "inverse magnitude response
function IHin.(eiW)1 = IHm(eiw)I- 1 This inverse magnitude response is shown in
Fig. 11.l4(a) and lo~ IHin.(eJW)1 is shown in Fig. 11.l4(b). Applying the discrete
Hilbert transform to this latter function produces the phase response shown in
Fig. 11.14(c). Using this phase response and IHin.(eiw)I, we find the real and
imaginary DFT sequences. Performing an inverse DFT produces the unitsample response {hinv(n)} shown in Fig. 1l.14(d). The sequence values that
are significantly different than zero are hin.(O) = 1, h in.(1) = a = -1.66 and
h inv(2) = b = 0.S1, or those fpr the exact inverse filter. The other values in
{hin.(n)} should be zero, but are not exactly zero because of errors in the
finite-precision arithmetic.
INVERSE FILTERING
(a)
IH,nie)"')1
(b)
log. IHon,(e)"')1
(e)
Arg [H,n,(e)O'
437
-It
(d)
(hon,(n)}
I I . . . . .. . . . . .
o
II
FIGURE 1114
Results of Example 11.6. a) Magnitude response
of inverse filter. b) Log-magnitude response
employed in Hilbert transform. c) Phase response produced by Hilbert transform. d) The
unit-sample response determined by inverse
DFf. 16-point sequences were used.
The previous example illustrates than when the system model contains
only poles, the inverse filter contains only zeros, and the inverse filter
unit-sample response has a finite duration. The size of the sequences used in
the discrete-Hilbert transform and the inverse OFT must then be equal to or
larger than the duration of the unit-sample response. If, however, the system
model contains a zero, then the inverse filter will contain the corresponding
pole. The unit-sample response of the exact inverse filter will then have an
infinite duration. To obtain a valid approximation, the size of the sequences
used in the Hilbert transform and inverse OFT computations should be large
438
enough that time-aliasing effects are not significant. To determine the size of
these sequences that will make the time-aliasing effect negligible, we examine
the pole in the inverse filter system function having the largest radius, equal to
rm. The unit-sample response will then decay on the order of r::'. The value of
N should be chosen such that ~ < 0.001 or 0.1 % of the maximum value.
The approximate value of the duration N can also be determined from the
bandwidth of the peak in the inverse filter magnitude response, as was done in
Chapter 7. As an alternate procedure, several values of N can be tried and the
unit-sample response sequence can be examined for each. If the values of the
unit-sample response do not change significantly as N is increased, then
time-aliasing effects may be neglected.
Example 11.7. Inverse filter design with the discrete Hilbert transform for
all-zero system model. Let us consider the second-order all-zero system model
given by
Hm(z) = 1 - 2r cos(6)z-1 + r2z- 2
with r = 0.9 and 6 = 1&/8. The magnitude response is then given by
IHm(eiw)1 = [1 +a 2 + b 2 + a(2+b) cos(w)+2b cos(2w)]112
where a = -2r cos(6) = -1.66 and b = r2 = 0.81. The inverse magnitude response
function IHmv(eiW)1 = IHm(eiw)rl. This inverse magnitUde response is shown in
Fig. 11.15(a) and lo~ IHinV(eiw)1 is shown in Fig. 11.15(b). Applying the discrete
Hilbert transform to this latter function produces the phase response shown in
Fig. 11.15(c). Using this phase response and IHinv(eIW)I, we find the real and
imaginary DFT sequences.
To determine the size of these sequences, we determine from the bandwidth
of IHinv(eiOl)1 that rm = 0.9. The value of N is then equal to
N = 10~[0.OOl]/lo~[rm] = 66
INVERSE FILTERING
439
IHonv(eJ"')1
(a)
It
log., IHonv(e'OI)1
(b)
o
(c) Arg (Honv(elW)]
It
-It
(d) {h;nv(n)}
11[[11,.IlIlll'."111,.. ....31.. n
FtGURE 11-15
Results of Example 11.7. a) Magnitude response of inverse filter. b) Log-magnitude response employed in Hilbert transform. c)
Phase response produced by Hilbert transform.
d) The unit-sample response determined by
inverse DFf.
sequence. The output of the inverse filter determined with the above
procedure, when the unit-sample response of the nonminimum-phase system
model is applied at the input, will be equal to the unit-sample response of an
all-pass filter.
EUIIlple U.8. Inverse filter design with the discrete HObert transform for a
Domuinhnam-pbase systelD lDodel. Let us consider the second-order all-zero
system model given by
440
In the next section, we examine the effects of additive noise in the design
and performance of inverse filters.
(a)
(hnm(n)}
(b)
(c)
31
{h,nv(n)}
(y(n)}
~rr"'''''''''''''nTl''n'''''---~n
FIGURE 11-16
Results of Example 11.8 .. a) Unit-sample response of nonminimum-phase system. b) The unitsample response of inverse filter. c) Output of
inverse filter is identical to the unit-sample response of all-pass filter.
INVERSE FILTERING
441
= {s(n)} + {w(n)}
(11.14)
= lim
Pw(eieo )
M ....""
= lim
M ....""
[_1_
f W;(e
MN
ieo )
W;"(ei eo )]
i=1
[-
1M
.]
L 1W;(eJeoW
(11.15)
MNi=l
The division by N ensures that the Fourier transform remains finite for any
value of N. Since the noise sequence {w(n)} is random, the observed signal
{x(n)} is also random. A similar expression can be written for the power
spectrum of {x(n)}, denoted Px(eioo ), given by
Px(e ioo )
= lim
M ....""
[_1_ X,(e JW )
MNi=l
= lim [_1_
M ....""
x:(e
JW
)]
f IX,(eJOOW ]
(11.16)
MN,=!
{w(n))
I
{s(n)}
.o,I h. 111'
'"o
,It
l,t
t
t ...
""~n
".1.~. ~
n
FIGURE 1117
{x(n)}
"nIh "11"...
~n
442
For the nonrandom sequence {s(n)}, the power spectrum Ps(eiQ is equal to
Ps(eiQ = S(ei"') S*(ei"')
(11.17)
= IS(ei"'W
In many practical cases, it can be argued that the noise is statistically
independent of the signal. The power spectrum of the observed signal is then
equal to
(11.18)
The inverse filter design procedures considered above can be caUed
noiseless, since noise effects were not considered. The noiseless inverse filter is
designed to compensate for the spectrum of the signal and neglects the noise.
The magnitude response of the noiseless inverse filter is then given by
(11.19)
This result shows that the noiseless inverse filter gain is a maximum at the
frequency where the signal spectrum is a minimum. When we try to apply this
noiseless inverse filter to the signal with noise, the noise components in the
signal are amplified in the output, and the results are usually disappointing.
INCLUDING NOISE EFFECfS INfO THE DESIGN OF mE INVERSE
FILTER. If the characteristics of the noise are included in the design of the
inverse filter, the performance can be improved slightly. The gain of the
noiseless inverse filter is a maximum at the frequencies where the signal
spectrum is a minimum. If there are noise components at the frequency range
where the signal spectrum is low, these will dominate the output. There is a
trade off between the amount of pulse compression that can be obtained and
the amount of noise that is present in the output.
To illustrate this trade off, let us denote the inverse filter magnitude
response that includes the noise effects by IH.+w(ei "') I and let it be defined by
.
IHs+w(el"')1
= Ps(ei"') + APw(ei"')
(11.20)
INVERSE Fn.TERING
443
EuJDple 11.9.
j"I3Z -I)
Let us assume that the observed signal is equivalent to having a white noise
sequence {w(n)}, that is uniformly distributed between -0.5 and 0.5, added to
the output of this system. The noise spectrum is then constant with frequency and
Pw(ei .. )
= W~ =-b.
~ AW~j112
The forms of fH.+w(eIW)1 for the different values of A are shown in Fig.
11.18(a). We note that the zero in Hm(z) at Z =0.95einf4 produces a peak in these
transfer functions at (JJ = ,,/4. The gain is also large for high frequencies to
compensate for the general lowpass characteristic of Hm(eIW ). The A = 0 curve
corresponds to the magnitude response of the noiseless inverse filter. As A
increases, the values of the maximum gains decrease to reflect the dominance of
noise in those frequency ranges. As A increases, the curves become flatter,
indicating the increasing dominance of the constant spectral component AW~
These magnitude curves were sampled at 128 points to generate the
sequence {lH.+ ..(k)l}. The logarithm of this sequence was then employed in Eq.
(11.12) to determine the phase response sequence {Arg[HHw(k))}. The phase
sequences for the different values of A are shown in Fig. 11.18(b). As A increases,
the phase response tends toward zero.
Having {IH.+ ..(k)l} and {Arg[HH ..(k))}, the 128-point inverse Off can be
computed to determine the unit-sample response of the inverse filter {hHW(n)}.
The first 32 points of the sequences obtained for the different values of A are
shown in Fig. 11.19. We note that the zero in Hm(z) produces an infinite-duration
component in the sequences. As A increases, these unit-sample responses
approach the unit-sample sequence {d(n)}. a result which is consistent with the
flattening of the magnitude and phase spectra.
The pulse compression behavior of these filters can be examined by their
response to the noiseless pulse sequence {hm(n - no)}, shown in Fig. 11.20(a).
The output sequences are shown in Fig. 11.20( b) for the different values of A. For
A = 0, the unit-sample seque~ce occurring at n = no is to be expected. Upon
closer examination, we note a slight residual component for n > no. This residual
is due to the time-aliasing effect produced with the 128-point sequences and can
be reduced by increasing the size of the DFf sequences. As A increases, the pulse
444
INTRODUcnON TO DIGITAL
'';',AL PROCESSING
A=
OL-______
________________________
"'.
ro
It
It
A=
A=
It
--It
ftGURE 1118
Response curves of inverse filter for signal in
additive noise, for different values of A. a) Magnitude responses employed
in Hilbert transform. b)
Phase response produced
by Hilbert transform.
compression capability of the inverse filter decreases and the form of the output
seqlJ.ences approaches that of {hm(n - no)}.
The behavior of the inverse filter in the presence of noise can now be
examined. The input to the filter is the delayed pulse sequence plus noise
{hm(n - no) + w(n)} shown in Fig. 1l.21(a). The output sequences that are
observed when this input is applied to the different filters are shown in Fig.
1l.21(b). As A decreases the effects of the noise become more apparent in the
output.
To quantify this observation, the variance of the noise in the output W2
was computed. This was done by subtracting the noiseless outputs, shown if'
INVERSE FILTERING
445
A. =0
~~~~~~~~~~~UU~rr-n
31
A. =05
A. =2
A. =8
..I...
01.0
.11.
on
.. .. .
.ILn
31
FIGURE 1119
Unit-sample responses determined
by inverse DFf for different values
orA.
Fig. 1l.20(b), from the respective sequences in Fig. 11.21(b). The average of the
squared residuals then provides an estimate of the noise variance W 2 The
computed values of W 2 are given in the figure for the different values of A.. As A.
increases, the value of W 2 approaches W~, the variance of the noise in the input
sequence.
Summarizing these results, we note that when noise is present there is a
trade off between the ability to compress the pulse and to suppress the noise.
When the maximum pulse compression, {hm(n - no)} -+ {d(n - no)}, is attempted, the noise component in the output has the highest power. The degree of
pulse compression that should be attempted depends on the particular application
and specification to be achieved.
446
A =0
ft
we
no
A =0.5
.u
A =2
. , . n
A =8
no
ill'
...
FIGURE 1120
Noiseless input results. 0) Input is a delayed unit-sample response of the minimum-phase system.
b) Output of inverse filters having unit-sample response shown in Fig. 11.19.
INVERSE FILTERING
447
+ w(n)
(wi =
0.083)
)..=0
),,=0.5
),,=2
)..=8
. IItt
(W2=0.09)
II
IT. I .
FIGURE 11-21
Results with input contain:ng
additive noise. a) Input is a
delayed unit-sample response
of minimum-phase system plus
white noise. b) Output of inverse filters having unitsample response shown in Fig.
11.19. The variance of the
output noise is equal to W 2
448
11.9 SUMMARY
This chapter began by considering two comm<fn distortions that occur to
observed signals and by defining discrete-time models that generate these
distortions. Inverse filters were found to work best on models whose system
functions have the minimum-phase property. The minimum-phase property
was defined in terms of the pole/zero pattern in the z plane of the system
function of the model Hm(z), the phase response Arg{Hm(ei "')} and the
unit-sample response {hm(n)}. Two procedures for designing the inverse filter
were described. The first performed the design in the z plane and the second in
the frequency domain. The z plane procedure produced the system function of
the inverse filter directly from the model pole/zero pattern: the poles of the
inverse filter were located at the positions of the model zeros and the filter
zeros at the positions of the model poles. This procedure is limited to models
for which either the system function or the pole/zero pattern is known. The
frequency-domain approach i~volved computing the DFf sequence of the
observed unit-sample response of the model to implement an approximate
inverse filter. The types of approximations that resulted by employing this
procedure were described. In cases for which only the magnitude response of
the model is known, an FIR approximation to the inverse filter can be
designed by using the discrete-time Hilbert transform. For minimum-phase
systems, the log-magnitude response sequence is the discrete-time Hilbert
transform of the phase response sequence. This useful result was employed for
designing inverse filters. The chapter ended by considering the problem of
designing inverse filters for signals in the presence of noise.
A common alternate procedure for designing inverse filters in the time
domain requires concepts that are not difficult, but sufficiently different from
the topics covered in this text that they were not covered here. These
time-domain design procedures can be found in the references.
REFERENCES TO TOPICS
General inverse filtering applications
Arya, V. K. and J. K. Aggarwal: Deconvolution of Seismic Data, Hutchinson Ross, Stroudsburg,
PA,1982.
Mendel, J. M.: Optimal Seismic Deconvolution, Academic Press, New York, 1983.
Anderson, B. D. O. and J. B. Moore: Optimal Filtering, Prentice-Hall, Englewood Cliffs, NJ,
1979.
Time-domain design 01 inverse filters
Makhoul, J.: "Linear prediction: A tutorial review," Proc. IEEE, 63, 561-580 (1975).
Robinson, E. A., and S. Treitel: Geophysical Signal Processing, Prentice-Hall, Englewood Cliffs,
NJ,1980.
Schwartz, Mischa, and Leonard Shaw: Signal Processing: Discrete Spectral Analysis, Detection,
and Estimation, McGraw-Hill, New York, 1975.
Treitel, S., and E. A. Robinson: "The design of high-resolution digital filters," IEEE Trans.
Geosci. Electron., GE-4: 25-38 (1966).
INVERSE FILTERING
449
Discrete-l6Ibert tnDIfona
Oppenheim, Alan V. and Ronald W. Schafer: Digital Signal Processing, Prentice-Hall, Englewood
Cliffs, NJ. 1975.
Adaptive filters
Cowan, C. F. N., and P. M. Grant: Adaptive Filters, Prentice-Hall, Englewood Cliffs, NJ, 1985.
Goodwin, G. C., and K. S. Sin: Adaptive Filtering, Prediction and Control, Prentice-Hall,
Englewood Cliffs, NJ, 1984.
..
Haykin, S.: Adaptive Filter Theory, Prentice-Hall, Englewood Cliffs, N.J, 1986.
Honig: M. L., and D. G. Messerschmitt: Adaptive Filters, Kluwer, Boston, 1984.
System aaodeliDg
Kuc, R.: "Modeling acoustic attenuation of soft tissue with a minimum-phase filter." Ultrasonic
Imaging Journal, 6: 24-36 (1984).
PROBLEMS
11.1. Show that a linear-phase filter cannot be minimum-phase by considering the
pole/zero pattern of this system.
11.2. Determine whether the following unit-sample responses are from a minimumphase filter. If not, indicate why not.
(a) hen) = 1
for O~n ~N-l
(b) h(n)=n+l
forO~n~N-l
(c) h(n)=r"cos(wo)n
forn~O, h(n)=O, otherwise
(d) h(n) = r" sine wo)n
for n ~ 0, h (n) = 0, otherwise
11.3. Consider a minimum-phase FIR filter having the unit-sample response given by
hmin(n), for 0 ~ n ~ N - 1. Let the maximum-phase FIR filter, with the identical
magnitude response, have the unit-sample response hmax(n), for 0 ~ n ~ N - 1.
Show that {hmax(n)} has the same values as {hmin(n)}, but in time-reversed
order, or
hmo.(n) = hmin(N -1- n)
for O~n ~N-l
11.4. Given any linear-phase FIR filter, how can this filter be transformed into a
minimum-phase filter without changing the magnitude response?
11.S. Given the unit-sample response of a minimum-phase filter {hen)}, show that a
second filter having the unit-sample response {h2(n)} = {hen - k)}, where k is
any nonzero integer, is not minimum-phase.
11.6. Consider the causal unit-sample response {hen)}, for which h(O) = o. Show that
this filter cannot be minimum-phase.
11.7. Consider a physical system whose model system functionis given by
Hm(z) = 1 + az- I
and whose unit-sample response is given by {hm(n)}. This system model is not
minimum-phase because it has a zero outside the unit circle at Z = -a. The
inverse filter system function given by
450
+ (1/a)z-1]
(a) What is the output sequence of H(z) when {h",(n)} is the input sequence?
(b) What is the magnitude spectrum of this output sequence?
11.8. Consider the fourth-order minimum-phase FIR system Hmia(z) having all four
zeros at z = 0.9.
(a) Compute the magnitude response of this system.
(b) For each of the possible phase responses having this magnitude response
form, calculate and sketch the phase response and the unit-sample response.
11.9. Inverse filter of an ARMA model. Let the system function of an ARMA model
be given by
1
H (z) = 1- O.5zm
1+0.5z 1
1-0.81z- 2
Hm (z)=1_1.27z 1+0.9z
COMPUTER PROJEcrs
11.1. Inverse filter for the radar system
Objed. Simulate a radar system and to perform inverse filter design in the z
plane.
Generation of the ideal radar return. Let r(n), for O:$n :$63, be the
realization of an ideal radar return having the following values:
r(1) = 1
(isolated return)
r(31) = 1
r(32) = -1
r(n) = 0
otherwise
The obseroed radar return, denoted by {s(n)}, is the first 64 samples of the
convolution of {r(n)} with a pulse waveform {p(n)}. Let {p(n)} be the
unit-sample response of the AR system described by the difference equation
given by
y(n) = 1.8 cos(.n"/8)y(n -1) - O.81y(n - 2) + x(n)
INVERSE FILTERING
451
Analytic results
(a) Determine the Z plane pole/zero pattern of the AR system.
(b) Determine and sketch the block diagram for the inverse filter.
Computer results
(a) For the pulse waveform {p(n)}, use only the first 30 samples of the
unit-sample response of the AR system.
(b) Verify the operation of the inverse filter by computing and plotting the
output when {p(n)} is the input. Why is the output for n =30 not equal to
zero?
(c) Generate and plot the observed radar sequence {s(n)}.
(d) Compute and plot the output of the inverse filter when {s(n)} is the input.
11.2. IDverse fiber of the reverbennt eommunkatiou channel
Object. Simulate a reverberant communication channel and construct an inverse
filter.
Communication channel model. Let the system function of a reverberant
channel be given by
Hm(z) = 1- 0.81z- 2
AaaIytic results. Determine and sketch the following for this channel model:
(a) the z plane pole/zero pattern
(b) the unit-sample response
(c) the pole/zero pattern and block diagram of the inverse filter
Computer results. Implement the channel model and inverse filter. Perform the
following.
(a) Plot the unit-sample response of the channel model.
(b) Plot the output of the inverse filter when sequence in Part (a) is the inut.
(c) Plot the output of the channel filter when the FSK sequence, generated in
Chapter 2, is the input.
(d) Plot the output of the inverse filter when the sequence in Part (c) is the input.
11.3. Approldmate FIR inverse fiber for an FIR system model
Object. Determine the approximations of this inverse filter design procedure.
Consider the FIR system model to be given by
Hm(z) = 1- 0.9z- 1
We want to find the inverse filter using the frequency-domain procedure.
Analytic: results. Determine the true inverse filter and sketch its unit-sample
response {hin)}.
Computer results
(a) Plot the model unit-sample response {hm(n)}. Compute and plot the Nd-point
magnitude and phase sequences {IHm(k)l} and {Arg[Hm(k)]} for Nd = 16.
(b) Compute and plot {hif.(n)} , the unit-sample response of the FIR approximate inverse filter determined from {lHm(k)I-I} and {-Arg[Hm(k)]}.
Compare with {hif(n)}. Verify that {h'f.(n)} corresponds to the first period of
the periodic extension of {hin)}.
(c) Repeat for Nd = 64.
452
Hm(z) = 1- 0.9z- 1
Let us assume that we only know the magnitude response of this system, from
which we want to design the inverse filter.
Analytic results
(a) Determine the true inverse filter and sketch its unit-sample response {hir{n)},
(b) Calculate and sketch the magnitude response IHm(eiw)1 of this system.
Computer results
(a) Compute and plot the N-point log-magnitude response sequence {lHm(k)ldB}'
Let N= 16.
(b) Use the discrete-Hilbert transform subroutine DHT, given below, to compute
the phase response. Plot the result and compare with that of the true filter.
(c) Compute and plot the unit-sample response of the FIR approximate inverse
filter, Compare with {hin)}.
(d) Repeat for N = 64.
SUBROUTINE DHT(XLMAG, XPHS, N)
C
C
C
C
C
C
INVERSE FILTERING
453
DO 1 I=2,N2
II=I
TYPE* ,II, I / ' ,N2
SUM=O.
OM=FLOAT(I-l) * DOMGA
C INTEGRATION LOOP
C
2
1
DO 2 J=l,N
IF ( J EQ. I) GOTO 2
THETA=FLOAT(J-l) *DOMGA
ALPHA=(THETA-OM)/2.
COTAN=COS(ALPHA)/SIN(ALPHA)
SUM=SUM+DBTONP*XLMAG(J)*COTAN
XPHS(I)=SUM/FLOAT(N)
XPHS(NP2-I)=-XPHS(I)
RETURN
END
11.6. Inverse filter design using the Hilbert transfonn for an IIR system
Object. Determine performance of the inverse filter design procedure for FIR
systems.
Consider the IIR system model to be given by
APPENDIX A
PROGRAM LISTINGS
The computer programs listed below evaluate the DFf using the fast
Fourier transform and provide the graphics routines for displaying arrays on
the terminal and transferring them to a file for printer hard copy. The FFT
routines have been adapted from the Cooley-Tukey fast Fourier transform
algorithm (ref: Cooley, Lewis and Welch, IEEE Trans. Education, 12,27-34,
1969). Programs to test these routines are listed and sample print-outs are
presented. The routines include:
PLOT - to display an array of arbitrary size with a vertical abscissa.
FFf - to compute the DFT with the fast Fourier transform algorithm.
456
VAX* -780 computer system using the VMS operating system. The Pascal
programs have been written on a DEC Rainbow* PC with MS-DOS and using
Turbo Pascal, available from Borland International, 4585 Scotts Valley Drive,
Scotts Valley, CA 95066.
Inputs to programs:
X - real-valued array.
XR and XI - arrays containing the real and imaginary components of
the DFf.
NX - size of array.
NPRNT (FORTRAN and Pascal) - causes graph to be printed when
NPRNT= 1.
DSK (Pascal) - disk file name for data output.
LOG2N - integer equal to log2(N) for N-point DFf.
NTYPE - integer, when = 1, DFf is performed; when = - 1, IDFf is
performed.
DBSCAL - 0) defines lower limit of log-magnitude graph.
SPEC - 0) defines specification level to be marked on log-magnitude
graph.
IF1 and IF2 - two integers indicating DFf bin numbers to be marked
on graph.
APPENDIX A
CALL PLOT(X,45,NPRNT)
TYPE*, 'GO AGAIN? (1/0)'
ACCEPT*, IANS
IF(IANS.EQ.1) GOTO 1
STOP
END
FORTRAN programs.
SUBROUTINE PLOT(X,NX,NPRNT)
DIMENSION X( NX)
BYTE ARR(71) ,MARK
C FIND MINIMUM AND MAXIMUM VALUES IN ARRAY
XMAX=O.
XMIN=O.
DO 1 I=1,NX
IF(X(I).GT.XMAX) XMAX=X(I)
IF(X(I).LT.XMIN) XMIN=X(I)
IF(XMAX.LT.-XMIN) XMAX=-XMIN
IF(XMAX.EQ.O.) XMAX=1.
TYPE 200,XMAX
IF(NPRNT.EQ.1) PRINT 200,XMAX
200 FORMAT(' MAX VAL- ',F6.2)
C IPOS IS DOTTED LINE POSITION
IPOS=36
IF(XMIN.GE.O.) IPOS-1
IF(XMAX.LE.O.) IPOS-71
C SCALE TO PRINTER COORDINATES
SCALE=70./XMAX
IF(IPOS.EQ.36) SCALE-35./XMAX
MARK-'-'
DO 2 I=I,NX
RNDOFF=.5001
IF(X(I).LT.O.) RNDOFF--.5001
N=IFIX(X(I)*SCALE+RNDOFF)+IPOS
DO 5 J=I,71
5
ARR(J)=MARK
ARR(IPOS) =' I '
ARR(N)='*'
TYPE 100,I-I,ARR
IF(NPRNT.EQ.I) PRINT 100,I-I,ARR
100 FORMAT(' ',I3,'-',7IAI)
2
MARK-"
RETURN
END -
5
6
457
10
20
30
458
SUBROUTINE PLOTMR(X,NPRNT)
DIMENSION X(65)
BYTE ARR(65) ,MARK
C FIND MAXIMUM OF X ARRAY - XMAX
TYPE 200
IF(NPRNT.EQ.l) PRINT 200
200 FORMAT(' MAGNITUDE RESPONSE')
XMAX=O.
DO 1 1=1,65
XMAX=AMAXl(XMAX,X(I
SCAL = XMAX/20.
SCALD2=SCAL/2.
DO 3 1=1,21
C LEVEL OF GRAPH LINE
GLVL=FLOAT(21-I)*SCAL
MARK=' ,
IF(I.EQ.l.0R.I.EQ.21) MARK='-'
DO 4 J s l,65
4
ARR(J)-MARK
ARR(l )=' I'
ARR(65)-' I'
DO 5 J-l,65
A-ABS(X(J)-GLVL)
5
IF(A.LT.SCALD2) ARR(J)-'*'
IF(NPRNT.EQ.l) PRI~100'GLVL.ARR
3
TYPE 100,GLVL,ARR
100 FORMAT(' 'F6.2,lX,65 1)
RETURN
'
END
SUBROUTINE PLOTPR(X,NPRNT)
DIMENSION X(65)
BYTE ARR(65) ,MARK
PI=4. *ATAN( 1.)
SCAL-PI/10.
TYPE 101
IF(NPRNT.EQ.1) PRINT 101
101 FORMAT(' PHASE RESPONSE')
SCALD2-SCAL/2.
DO 3 '1=1,21
PHLVL=FLOAT(ll-I)*SCAL
MARK=' ,
IF(I.EQ.1) MARK-'-'
IF(I.EQ.11) MARK-'-'
IF(I.EQ.21) MARK='-'
DO 4 J=l,65
ARR(J)=MARK
ARR(l )=' I'
ARR(65)-' I'
DO 5 J-1,65
A-ABS(X(J)-PHLVL)
5
IF(A.LT.SCALD2) ARR(J)-'*'
IF(NPRNT.EQ.1) PRINT 100,PHLVL,ARR
3
TYPE 100,PHLVL,ARR
100 FORMAT(' 'F6.2,lX,65Al)
RETURN
END
SUBROUTINE PLOTLM(X,DBSCAL,SPEC,
+
IFl, IF2 ,NPRNT)
DIMENSION X(65) ,Y(65)
BYTE ARR(65) ,MARK
TYPE 101
IF(NPRNT.EQ.l) PRINT 101
101 FORMAT(' LOG-MAGNITUDE RESPONSE')
XMAX=-1000.
DO 1 1=1,65
XMAX=AMAX1(XMAX,X(I
C SCALE ARRAY BETWEEN 0 AND DBSC~L
DO 2 1=1,65
Y(1)=X(1)-XMAX
2
Y(I)=AMAXl(Y(I),DBSCAL)
SCAL=-DBSCAL/20.
SCALD2=SCAL/2.
DO 3 1=1,21
MARK=' ,
IF(I.EQ.1.0R.I.EQ.21) MARK='-'
DO 4 J=l,65
4
ARR(J)=MARK
C INDICATE FREQUENCY MARKS AND LIMITS
ARR(l )=' I'
IF(IF1.GT.0.) ARR(IFl)='I'
IF(IF2.GT.0.) ARR(IF2)-'I'
ARR(65)=' I'
C DB LEVEL OF GRAPH LINE
DBINC=-FLOAT(I-1)*SCAL
DO 5 J-l,65
C SPECIFICATION LINE
A-ABS(SPEC-DBINC)
IF(A.LT.SCALD2) ARR(J)-'-'
C DATA POINT
A-ABS(Y(J)-DBINC)
5
IF(A.LT.SCALD2) ARR(J)='*'
IF(NPRNT.EQ.1)PRINT 100,DBINC,ARR
3
TYPE 100, DBINC,ARR
100 FORMAT(' 'F6.2,lX,65A1)
RETURN
END
Program to test FFT.FOR, PLOTMR.FOR,
PLOTPR.FOR and PLOTLM.FOR:
C
TEST1 FORTRAN
DIMENSION X(128),Y(128)
DO 1 1=1,128
X(1)=O.
Y(I)-O.
DO 2 1=1,8
X(1)-1.
CALL FFT(7,X,Y,l)
DO 3 1-1,65
A-X(1)
B-Y( 1)
X(I)-SQRT(A**2+B**2)
PHS-D.
APPENDIX A
459
y(I)~PHS
NPRNT-I
CALL PLOTMR(X,NPRNT)
CALL PLOTPR(Y,NPRNT)
DBSCAL--40
SPEC--20
IFl-20
1F2-30
DO 4 1-1,65
1F(X(1).LE.O.OOOI) X(1)=.OOOI
X(1)=20.*ALOGIO(X(I
CALL PLOTLM(X,DBSCAL,
+
SPEC,IFI,IF2,NPRNT)
STOP
END
for j := I to 71 do begin
if
I then dot := ' - '
else dot
;=-=
'
';
if
= z Pt the n dot : = ' I ' ;
if J = ivaI then dot := '*';
write(dot);
if nprnt = I then write(dsk,dot);
end;
writeln; if nprnt
1 then writeln(dsk)
end;
writeln; if nprnt =
then writeln(dsk);
if nprnt = 1 then begin
for j := I to 71 do write(dsk ,dot) ;
end; {empty print buffer}
end ;{plot}
Program to test plot.pas:
program testO(output);
type
vector = array [1 80] of real;
var
blnk: char;
dsk: text;
y: vector;
x,f,an: real;
n, nx J nprnt. se: integer;
for i
:~
I to nx do begin
xli];
end;
writeln(dsk);
end;
for i :~ I to nx do begin
dot :='-';
write( i-I :3 ,dot) ;
if nprnt = I then
write(dsk, i-I :3,dot);
rndoff := 0.5001;
460
xiii] := xili]*inv;
end i
end;
end {fft};
procedure fft(var xr,xi:vector;
10g2n.ntype:integer);
const
pi = 3.1415926;
var
n,n2,i,id,j,k,le,lel: integer;
ur,ui,wr,wi,tr,ti,sign,inv,omega: real;
begin
sign := -1.;
if ntype < 0 then sign :=1.;
n :- 1; for i := 1 to 10g2n do n := n*2;
n2 := n div 2;
j := 1; {time decimation}
for i := 1 to n-l do begin
if i < j then begin {switch}
tr
:= xrlj]; ti
:= xilj];
xrlj] :- xrli]; xilj] :- xiIi];
xrli] := tr;
xili]:= ti;
k
:- j+k;
end;
omega := pi/leI;
wr :- eos(omega);
wi :- sign * sin(omega);
for
:- 1 to leI do begin
i :- j; while i <- n begin
id .- i + leI;
tr .- xrlid] * ur - xilid] * ui;
ti . xrlid] * ui + xi!id] * ur;
xrlid] := xrli] - tr;
xilid] :- xiIi] - ti;
xr!i] := xrli] + tr;
xiIi] :- xi!i]-+ ti;
i :E i+le;
end;
tr .= ur*wr - ui*wi;
ti :- ur*wi + ui*wr;
:~
var
dot, mark: chari
i, j. zpt, ival, m, offset: integer;
xmx, zero, scale, scale2, inc: real;
begin
writeln('magnitude response'); writeln;
if nprnt = 1 then begin
writeln(dsk.'magnitude response');
writeln(dsk);
end;
xmx := 0.;
for i := 1
to num do begin
if xli] > xmx then xmx :- x!i];
end;
:a n2;
ur
num ,.
trj ui := tis
end i
end;
end
if i 1 then begin
write(blnk.xmx :6:2);
if nprnt - 1 then
write(dsk.blnk,xmx :6:2);
end;
if i - 21 then begin
zero :- 0.;
write(blnk,zero :6:0);
if nprnt 1 then
write(dsk,blnk,zero :6:0);
end;
end
else begin
mark := blnk;
for j := 1 to 7 do write(blnk);
if nprnt = 1 then
for j := 1 to 7 do
write(dsk,blnk);
end i
APPENDIX A
writeln;
if nprnt = 1 then writeln{dsk);
dot :- mark;
end
write 1n;
if nprnt
=1
461
end;
then writeln{dsk);
end; {plotpr}
end;
end; {plotmr}
procedure plotpr{x:vector; nprnt:integer;
var dsk:text);
const
b Ink = '
';
num = 65;
var
dot, mark: char;
i, j, zpt, ivai, m, offset: integer;
xmx, pi, val, scale, scale2, inc: real;
begin
writeln{'phase response'); writeln;
if nprnt = 1 then begin
writeln{dsk,'phase response');
writeln{dsk);
end;
pi := 4.*arctan{I);
xmx :a pi;
write(dot) ;
procedure plotlm{x:vector;
dbscal, spec :real;
ifI,if2,nprnt:integer;
var dsk: text) ;
var
blnk,mark: char;
arr: array [1 65] of char;
i, j, k, zpt, ivai, m, offset: integer;
xmx, xmn, scale, scale2, dbinc: real;
:= ' ,
65;
{find max of x array}
XIUX := -300;
for i : = 1 to m do
if xli] > xmx then XIUX := xli];
{normalize to 0 dB}
for i := 1 to m do begin
Xll] := xli] - XIUX;
if xli] < dbscal then xli] :- dbscal;
end;
scale := dbscal/20.;
scale2 := abs{scale)/2.;
for i := 1 to 21 do begin
mark :- ... ';
if (i = 1) or (i
462
for j:=
to 65 do write(arrlj]);
if nprnt
1 then begin
for j := 1 to 65
do write(dsk,arr[j]);
writeln(dsk) ;
end;
writeln;
end;
end;
;=
end;
plotmr(x,nprnt,dsk);
plotpr(y,nprnt,dsk);
i1 := 20; if2 := 30;
dbscal := -40.; spec := -20.;
for i := 1 to 65 do begin
if x[i] <= 0.0001 then
xli] :- 0.0001;
x[i] := 8.6S*ln(x[i]);
end;
plotlm(x,dbscal,spec,if1,if2,nprnt,dsk);
blnk := ' ' ;
if nprnt = 1 then for i := 1 to 160 do
write(dsk,blnk); {clear print buffer}
end.
{$i fopen }
{$i Ht }
{$i plotmr
{$i plotpr
{$i plotlm
begin
write('print (I/O)? '); read(nprnt);
writeln;
then b :- arctan(y[i]/x[i]);
if xli] = O. then begin
if y[i] > O. then b :- pi/2.;
if y[i] < O. then b := -pi/2;
C-language programse
void plot(x,nx,nprnt,fp)
FILE
*fp;
float
xl];
nx,nprnt;
int
{
int
i,j,ival,zpt,offset;
xmx,xmo,scale,rndoff;
float
char
dot;
0.; xmn
xmx
0 .
-=
}
if (xmx
APPENDIX A
if (nprnt -- 1) fprintf(fp,"%3d-",i);
for (j - 0; j < 71; j++) {
if (i == 0) dot =
,
else dot = ' "
if (j -= zpt) dot - '1';
rndoff = .5001;
if (xli] < 0.) rndoff = -.5001;
ivaI = offset + (rndoff + xli]*scale);
if (ivaI == j) dot = '*',
printf("%lc",dot) ,
if (nprnt
1) fprintf(fp,"Zlc",dot);
-=
printf("\n") ;
if (nprnt
1) fprintf(fp,"\n");
=-
return;
}
463
void fft(log2n,xr,xi,ntype)
float
*xr, *xi;
int
log2n, ntype,
j ,k, 1 J Ie J lel , id , i~
int
n J n1 J n2 J i
double
ur,ui,wr,wi,tr,ti,
pi-4. *atan(l.) ;
fm,fl,sign,in;
float
/* testO.c */
#include <math.h>
'include <stdio.h>
#inc1ude <p10t.c>
main()
k=n2;
while (k<j) {
j-k; k - k/2;
j+k;
float
*fp;
x1128],f,
pi4.*atan(1.);
int
ans,i,j,sc,nx,nprnt;
void
plotO,
FILE
fp - fopen("testO.dat","w");
f - 2.*pi*f; nx - 45;
for (i - 0; i < nx; i++)
if (sc
1) xli] - sin(f*i);
if (sc
0) xli] - cos(f*i);
}
plot(x,nx,nprnt,fp);
printf("go again? (1/0)");
scan("%d",&ans) ;
if (ans -- 1) goto start;
fc lose( fp);
tr
ur*wr
ui*wi;
ti = ur*wi + ui*wr;
ur
tr; ui = tit
if (ntype < 0) {
in - l./n;
for (i-O; i<n; i++)
*(xr+i)
*(xr+i) * in,
*(xi+n) = *(xi+n) * in;
}
return;
}
464
void plotmr(x.nprnt.fp)
*fp;
float
x[ J;
FILE
int
nprnt;
int
float
char
i,j,nx,ival,zpt,offsetj
xmx,xmn,scale,rndoff;
dot;
nx
nx
= 65;
xmx
= pi;
rndoff = .5001;
if (xlJ] < 0.) rndoff
-.5001;
ivaI = offset + (rndoff + x[j l*scale'
if (ivaI == 20-i) dot =
printf( "%lc" .dot);
if (nprnt == 1) fprintf(fp."Zlc".dot
}
printf( "\n") ;
if (nprnt == I) fprintfCfp,"\n");
}
re turn;
}
if
void plotlm
(x,dbscal.spec.ifl.if2.nprnt.fp)
FILE
*fp;
float
x[].dbscal.spec;
int
ifl.if2.nprnt;
{
int
float
char
i,j,nx,zpt,offset;
xt[65].xmx.scale,scale2.
rndoff .dbinc;
dot;
printf("\n") ;
if (nprnt == 1) fprintf(fp."\n");
}
return;
}
int
nprot;
printf("log-magnitude response
");
print( "dbscal- %6.2f
",dbscal);
printf("spec= %6.2f\n".spec);
if (nprnt == l){
fprintH fp, "log-magnitude response ");
fprintH fp. "dbscal- %6.2 f
" .dbscal) ;
fprintf(fp,"spec= %6.2f\n",spec);
int
i,j,nx,ival,zpt,offset;
xmx,scale,rndoff;
pi = 4.*atan(I.);
scale = dbscal/20.;
scale2 = fabs(scale/2.);
for (i = 0; i <- 20; i++)
void plotpr(x.nprnt.fp)
*fp;
float
x[ J;
FILE
float
double
char
dot;
dbinc - i*scale i
APPENDIX A
II j nx-1
II j if 1 I I j if2)
printf("X1c",dot);
if (nprnt 1)
fprintf(fp,"%lc",dot);
print( "\n");
if (nprnt 1) fprintf(fp,"\n");
)
return;
} ,
*fp;
float x[128],y[128],dbscal,spee;
double a,b,f,
pi -4.*atan(I.);
int
i,j,if1,if2,nprnt,nx,ntype,log2n;
void
fft(),plotmr() ,plotpr() ,plotlm();
FILE
fp fopen("testl.dat","w");
nx 128; nprnt 1;
for (i 0; i < nx; i++) {
xli] -0.; y[i] -0.;
}
10g2n 7; ntype 1;
fft(log2n,x,y,ntype);
nx 65;
for (i 0; i < nx; i++)
a x[i]; b y[i];
xli] sqrt(a*a + b*b);
if (a
o.
&& b 0.)
y[il
0.;
465
plotmr(x,nprnt,fp),
plotpr(y,nprnt,fp),
for (i 0, i < nx, i++) {
if (x[i] < 0.0001) xli] 0.0001;
xli] 20.*log10(x[i])1
}
466
Re.ult. produced
by
te.tO:
.--------
0--
123-
4-
56-
7B91011121314151617181920212223-
24- 25-26272B29303132333435363738394041-424344-
--
-- -
- r
I
I
I
I
I
I
I
I
L9t
+---------------------------------------------------------------+.t,1
,1I
..
..
. . . ,
..,
1
,
..,
I .
,
1
1
1
1
1
1
1
+---------------------------------------------------------------+u
8sruodsr8.1 8sr'8qd
--------------.---------------.------------.------------+0
I
I
I
1
1
1
00 8
+------------------------------------------------..
V XICINlIdcIV
468
log-magnitude response
0.0------------1---------1--------------------------------I
1
1
1
I
I
I
1
I
I
I
I
I
I
I
I
I
-10.0+
I
I
I
1
1
1
1
1
1
11
1I
I..
11...
-20.0-------------------------------------------------I
I
1I
-30.0+
1
1
1
II
1
I
1
I
I
1
1
I
II
I
I
1
1
I
I
II
I
1
I
I
1
-40.0+-----------------1---------1------------------------------.
APPENDIX B
kl
4
5
6
7
8
9
10
11
12
13
14
k2
21
kl
33
k2
22
23
34
49
35
50
24
36
25
37
38
39
51
52
53
26
27
28
29
30
31
40
41
42
43
48
54
55
56
57
58
kl
6
7
8
9
10
k2
19
20
21
kl
31
32
33
k2
46
47
48
22
34
49
23
35
50
kl
4
5
6
7
8
9
10
11
24
36
12
13
14
15
16
25
37
26
27
28
29
38
51
52
53
39
-54:
12
40
55
56
13
41
11
14
k2
21
22
k3
33
34
k.
48
49
23
35
50
24
36
25
37
38
39
51
52
53
26
27
28
29
30
31
11
6
7
8
9
10
k2
19
20
21
k3
31
32
33
22
23
34
49
35
50
51
52
53
54
55
56
11
24
36
54
12
25
40
55
13
41
42
43
56
14
15
16
26
27
28
29
37
38
39
57
58
40
41
469
k.
46
47
48
470
APPENDIX B
LOWPASS SPECIFICATION
IH(e'''')ldB
-~.~~
HIGHPASS SPECIFICATION
IH(e'''')ldB
o
-1
-50L_ _L-_...mi!~~ ro
o
BANDPASS SPECIFICATION
IH(e'''')ldB
o
-1
O~!m
-If""
nGURE Bl
Lowpass, highpass, bandpass and bandreject specifications for the projects.
SUBJECT
INDEX
A
ADC (see analog-to-digital conversIOn)
Adder component, 3, 41,169
Advance component, 3, 41, 169
Aliasing
frequency domain, 103
time domain, 125, 127,341,433,438
Allpass filter, 310
Amplitude function, 75
Analog filter design methods, 263
Butterworth filter, 264
Chebyshev filter, 270
elliptic filter, 275
Analog-to-digital conversion (ADC), 12
Nyquist criterion, 102
quantization effects, 395
sampling of anlog signals, 103,280
Anti-aliasing filter, 105,264
Antisymmetric sequences, 86, 89
(also see Symmetric sequences)
B
Bartlett window, 328
Bilinear transform, 288
Binary point, 391
Blackman window, 335
Butterfty computation, 147
Butterworth filter, 264
C
Cascade second-order section, 215
Cascade structure of filters, 164, 215
Causal system, 40
Chebyshev filter, 270
Circular convolution, 95,129,130,321
GOefticient quantization, 399
FIR filter, 400
IIR filter, 402
Comb filter, 224, 364
Conversion of decimal to binary, 392
Convolution
circular, 95,129,130,321
linear, 31, 132
sum evaluation, 32
CSOS (see cascade second-order section)
Cutoff frequency, 236, 264
D
DAC (see digital-ta-analog conversion)
Decirnation-i'l-time FFT algorithm, 142
Delay component, 3, 41, 169
DFf (see Discrete Fourier transform)
DFf program, 135
DitJerence equation, 41,162
Digital filter (see FIR or I1R filter)
Digital-to-analog conversion, 12, 106
Direct form structures, 210
Discrete Fourier transform (DFf)
computation of, 123
definition, 119, 123
evaluating with fast Fourier transform, 142
Goertzel algorithm, 139
linear convolution with, 132
of infinite duration sequences, 127
of noncausal sequences, 125
program (DFf), 135
471
472
SUBJECf INDEX
E
Elliptic filter, 275
Energy evolution factor, 427
Euler's identities, 25
Even sequence, 86, 188, 189
F
SUBJECt INDEX
Multiplication
fixed-point, 406
floating-point, 408
Multiplier component, 3, 41,169
N
Noncausal filter
definition, 40, 41
filter structure, 169
implementation of, 54
Nonrecursive filter, 5, 210
program (NONREC), 48
NONREC program, 48
NULL program, 45
Number representations
Fixed-point, 391
Floating-point, 394
Nyquist criterion, 102
Order, 5
Overflow, 405
Overlap-and-add method, 379
M
Magnitude response, 71, 236
Magnitude-phase program (MAGPHS), 81
MAGPHS program, 81
Maximum-phase system, 426
Minimum-phase system, 426, 433
473
P
Padding with zeros, 123
Parallel second-order section, 218
Parallel structure, 167, 218
Periodic extension
of spectra, 102
of time sequences, 120, 125, 127, 341, 432
Phase distortion, 244, 440
Phase response, 71, 243
jumps in, 76
of minimum-phase system, 426
of maximum-phase system, 426
principal value, 73
PL01LM program, 240
POLE program, 181
Pole/zero pattern in z plane, 170
of linear-phase systems, 195
of maximum-phase sequences, 426
of minimum-phase sequences, 426
of symmetric sequences, 189
to z-transform, 235
Prewarping, 290
Program descriptions:
DIT,135
IT,81
LOGMAG,240
474
SUBJECT INDEX
Q
Quantization
inADC,395
of filter coefficients, 399
simulation of, 412
Quantizer characteristic, 395
QUANT program, 412
T
Time-invariant system, 31
Transfer function, 67, 83
Transition region, 368
Triangular window, 328
Truncation of arithmetic results, 392, 406, 409
Truncation of sequences, 321
Two's-complement notation, 393
v
Vector notation of complex numbers, 23
R
Raised-cosine windows, 330
Random number generator, 414
Rectangular window, 322
Reconstruction filter, 105
REC program, 49
Recursive filter, 5, 209
program (REC), 49
Relevant singularity, 246
Region of convergence, 174
Resonator, 224
Round-off, 392, 406
S
Sampling analog signals, 2, 96
Second-order sections, 215, 218, 400, 402
SCALE program, 413
SHFfRG program, 47
SHIFf progrl'm, 54
Shift register program (SHFfRG), 47
Spectrum, 67, 71
Stability criterion, 38
Sum-of-products program (SUMP)
SUMP program, 47
Superposition principle, 26, 381, 398
Symmetric sequences, 86
Fourier transform of, 86
pole/zero pattern of, 189
z-transform of, 188
System function, 162