DSP For MATLAB and LabVIEW Fundamentals of Discrete Frequency Transforms Forester W. Isen Download PDF
DSP For MATLAB and LabVIEW Fundamentals of Discrete Frequency Transforms Forester W. Isen Download PDF
com
https://ebookgate.com/product/dsp-for-matlab-and-
labview-fundamentals-of-discrete-frequency-
transforms-forester-w-isen/
https://ebookgate.com/product/dsp-for-matlab-and-labview-i-
fundamentals-of-discrete-signal-processing-synthesis-lectures-on-
signal-processing-isen/
https://ebookgate.com/product/hilbert-transforms-
volume-1-encyclopedia-of-mathematics-and-its-applications-1st-
edition-frederick-w-king/
https://ebookgate.com/product/radio-frequency-circuit-design-1st-
edition-w-alan-davis/
https://ebookgate.com/product/discrete-fourier-analysis-1st-
edition-m-w-wong-auth/
A Frequency Dictionary of Dutch Core Vocabulary for
Learners Routledge Frequency Dictionaries 1st Edition
Carole Tiberius
https://ebookgate.com/product/a-frequency-dictionary-of-dutch-
core-vocabulary-for-learners-routledge-frequency-
dictionaries-1st-edition-carole-tiberius/
https://ebookgate.com/product/labview-for-everyone-graphical-
programming-made-easy-and-fun-3rd-edition-edition-travis/
https://ebookgate.com/product/radio-frequency-integrated-circuit-
design-2nd-edition-john-m-w-rogers/
https://ebookgate.com/product/instructor-solution-manual-
fundamentals-of-digital-signal-processing-using-matlab-2nd-
edition-robert-j-schilling/
https://ebookgate.com/product/models-for-discrete-data-daniel-
zelterman/
DSP for
MATLAB™ and LabVIEW™
Volume II: Discrete Frequency
Transforms
SYNTHESIS LECTURES
ON SIGNAL
PROCESSING
Editor
José Moura, Carnegie Mellon University
DSP for MATLAB™ and LabVIEW™ Volume II: Discrete Frequency Transforms
Forester W. Isen
2008
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in
any form or by any means—electronic, mechanical, photocopy, recording, or any other except for brief quotations in
printed reviews, without the prior permission of the publisher.
DSP for MATLAB™ and LabVIEW™ Volume II: Discrete Frequency Transforms
Forester W. Isen
www.morganclaypool.com
DOI 10.2200/S000162ED1V01Y200811SPR005
Lecture #5
Series Editor: José Moura, Carnegie Mellon University
Series ISSN
Synthesis Lectures on Signal Processing
Print 1932-1236 Electronic 1932-1694
DSP for
MATLAB™ and LabVIEW™
Volume II: Discrete Frequency
Transforms
Forester W. Isen
M
&C Morgan & cLaypool publishers
ABSTRACT
This book is Volume II of the series DSP for MATLAB ™ and LabVIEW ™ . This volume provides detailed
coverage of discrete frequency transforms, including a brief overview of common frequency transforms,
both discrete and continuous, followed by detailed treatments of the Discrete Time Fourier Transform
(DTFT), the z-Transform (including definition and properties, the inverse z-transform, frequency re-
sponse via z-transform, and alternate filter realization topologies including Direct Form, Direct Form
Transposed, Cascade Form, Parallel Form, and Lattice Form), and the Discrete Fourier Transform (DFT)
(including Discrete Fourier Series, the DFT-IDFT pair, DFT of common signals, bin width, sampling
duration, and sample rate, the FFT, the Goertzel Algorithm, Linear, Periodic, and Circular convolu-
tion, DFT Leakage, and computation of the Inverse DFT). The entire series consists of four volumes
that collectively cover basic digital signal processing in a practical and accessible manner, but which
nonetheless include all essential foundation mathematics. As the series title implies, the scripts (of which
there are more than 200) described in the text and supplied in code form (available via the internet at
http://www.morganclaypool.com/page/isen) will run on both MATLAB and LabVIEW. The
text for all volumes contains many examples, and many useful computational scripts, augmented by
demonstration scripts and LabVIEW Virtual Instruments (VIs) that can be run to illustrate various
signal processing concepts graphically on the user’s computer screen. Volume I consists of four chapters
that collectively set forth a brief overview of the field of digital signal processing, useful signals and
concepts (including convolution, recursion, difference equations, LTI systems, etc), conversion from the
continuous to discrete domain and back (i.e., analog-to-digital and digital-to-analog conversion), alias-
ing, the Nyquist rate, normalized frequency, sample rate conversion, and Mu-law compression, and signal
processing principles including correlation, the correlation sequence, the Real DFT, correlation by con-
volution, matched filtering, simple FIR filters, and simple IIR filters. Chapter 4 of Volume I, in particular,
provides an intuitive or “first principle” understanding of how digital filtering and frequency transforms
work, preparing the reader for the present volume (Volume II). Volume III of the series covers digital
filter design (FIR design using Windowing, Frequency Sampling, and Optimum Equiripple techniques,
and Classical IIR design) and Volume IV, the culmination of the series, is an introductory treatment of
LMS Adaptive Filtering and applications.
KEYWORDS
Higher-Level Terms:
MATLAB, LabVIEW, MathScript, DSP (Digital Signal Processing), Discrete Time
Fourier Transform (DTFT), z-Transform, Discrete Fourier Transform (DFT), Fast Fourier
Transform (FFT), Goertzel Algorithm, Discrete Fourier Series (DFS), Frequency Domain,
Discrete Frequency Transform
Lower-Level Terms:
FIR, IIR, Direct Form, Direct Form Transposed, Parallel Form, Cascade Form, Lattice
Form, Decimation-in-time (DIT)
This volume is dedicated to the memory of the following
Douglas Hunter (1941-1963)
Diane Satterwhite (1949-1961)
John G. Elsberry (1949-1971)
Amelia Megan Au (1967-2007)
ix
Contents
SYNTHESIS LECTURES ON SIGNAL PROCESSING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
0.2 The Four Volumes of the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
0.3 Origin and Evolution of the Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 In the Previous Volume 1
1.1.2 In this Volume 1
1.1.3 In this Chapter 1
1.2 Software for Use with this Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Introduction to Transform Families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3.1 Fourier Family (Constant Unity-Magnitude Correlators) 3
1.3.2 Laplace Family (Time-Varying-Magnitude Correlators) 5
1.4 The DTFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Inverse DTFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.6 A Few Properties of the DTFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.6.1 Linearity 13
1.6.2 Conjugate Symmetry for real x[n] 13
1.6.3 Periodicity 13
1.6.4 Shift of Frequency 13
1.6.5 Convolution 14
1.6.6 Even and Odd Components 16
1.6.7 Multiplication By A Ramp 16
1.7 Frequency Response of an LTI System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.7.1 From Impulse Response 17
1.7.2 From Difference Equation 18
x CONTENTS
1.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2 The z-Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 Software for Use with this Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3 Definition & Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.3.1 The z-Transform 26
2.3.2 The Inverse z-Transform 26
2.3.3 Convergence Criteria 26
2.3.4 Summary of ROC Facts 32
2.3.5 Trivial Poles and Zeros 33
2.3.6 Basic Properties of the z-Transform 33
2.3.7 Common z-Transforms 35
2.3.8 Transfer Functions, Poles, and Zeros 36
2.3.9 Pole Location and Stability 42
2.4 Conversion from z-Domain to Time Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.4.1 Difference Equation 45
2.4.2 Table Lookup 46
2.4.3 Partial Fraction Expansion 46
2.4.4 Contour Integration in the Complex Plane 48
2.5 Transient and Steady-State Responses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.6 Frequency Response From z-Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
2.6.1 For Generalized Transfer Function 55
2.6.2 Relation to DTFT 55
2.6.3 Finite Impulse Response (FIR) 56
2.6.4 Infinite Impulse Response (IIR) Single Pole 63
2.6.5 Cascaded Single-Pole Filters 64
2.6.6 Off-Unit-Circle Zeros and Decaying Signals 69
2.7 Transfer Function & Filter Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
2.7.1 Direct Form 70
2.7.2 Direct Form Transposed 71
2.7.3 Cascade Form 71
2.7.4 Parallel Form 76
2.7.5 Lattice Form 79
CONTENTS xi
2.8 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
2.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3 The DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.2 Software for Use with this Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
3.3 Discrete Fourier Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
3.4 Sampling in the z-Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
3.5 From DFS to DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
3.6 DFT-IDFT Pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
3.6.1 Definition-Forward Transform (Time to Frequency) 101
3.6.2 Definition-Inverse Transform (Frequency to Time) 101
3.6.3 Magnitude and Phase 101
3.6.4 N, Scaling Constant, and DFT Variants 101
3.7 MathScript Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .102
3.8 A Few DFT Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
3.9 General Considerations and Observations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
3.9.1 Bin Values 106
3.9.2 Periodicity in n and k 107
3.9.3 Frequency Multiplication in Time Domain 109
3.10 Computation of DFT Via Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
3.11 DFT of Common Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
3.12 Frequency Resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
3.13 Bin width and Sample Rate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
3.14 The FFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
3.14.1 N-pt DFT from Two N/2-pt DFTs 121
3.14.2 Decimation-in-Time 123
3.14.3 Reassembly Via Butterfly 124
3.14.4 Algorithm Execution Time 126
3.14.5 Other Algorithms 127
3.15 The Goertzel Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
3.15.1 Via Single-Pole 128
3.15.2 Using Complex Conjugate Poles 130
3.15.3 Magnitude Only Output 130
3.16 Linear, Periodic, and Circular Convolution and the DFT . . . . . . . . . . . . . . . . . . . . . . . . .131
xii CONTENTS
3.16.1 Cyclic/Periodic Convolution 131
3.16.2 Circular Convolution 132
3.16.3 DFT Convolution Theorem 133
3.16.4 Linear Convolution Using the DFT 134
3.16.5 Summary of Convolution Facts 136
3.16.6 The Overlap-Add Method 136
3.17 DFT Leakage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
3.17.1 On-Bin/Off-Bin: DFT Leakage 140
3.17.2 Avoiding DFT Leakage-Windowing 141
3.17.3 Inherent Windowing by a Rectangular Window 142
3.17.4 A Few Common Window Types 144
3.17.5 DFT Leakage V. Window Type 146
3.17.6 Additional Window Use 150
3.18 DTFT Via Padded DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
3.19 The Inverse DFT (IDFT) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
3.20 Computation of IDFT Via Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
3.21 IDFT Via DFT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
3.22 IDFT Phase Descrambling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
3.22.1 Phase Zeroing 164
3.22.2 Phase Shifting 165
3.22.3 Equalization Using the DFT 165
3.23 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
3.24 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Biography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Preface to Volume II
0.1 INTRODUCTION
The present volume is Volume II of the series DSP for MATLAB ™ and LabVIEW ™ . The entire series
consists of four volumes which collectively form a work of twelve chapters that cover basic digital signal
processing in a practical and accessible manner, but which nonetheless include essential foundation
mathematics. The text is well-illustrated with examples involving practical computation using m-code
or MathScript (as m-code is usually referred to in LabVIEW-based literature), and LabVIEW VIs.
There is also an ample supply of exercises, which consist of a mixture of paper-and-pencil exercises
for simple computations, and script-writing projects having various levels of difficulty, from simple,
requiring perhaps ten minutes to accomplish, to challenging, requiring several hours to accomplish. As
the series title implies, the scripts given in the text and supplied in code form (available via the internet at
http://www.morganclaypool.com/page/isen) are suitable for use with both MATLAB (a product of The
Mathworks, Inc.), and LabVIEW (a product of National Instruments, Inc.). Appendix A in each volume
of the series describes the naming convention for the software written for the book as well as basics for
using the software with MATLAB and LabVIEW.
Forester W. Isen
December 2008
1
CHAPTER 1
http://www.morganclaypool.com/page/isen
The entire software package should be stored in a single folder on the user’s computer, and the full
file name of the folder must be placed on the MATLAB or LabVIEW search path in accordance with the
instructions provided by the respective software vendor (in case you have encountered this notice before,
which is repeated for convenience in each chapter of the book, the software download only needs to be
done once, as files for the entire series of four volumes are all contained in the one downloadable folder).
See Appendix A for more information.
The Fourier transform operates on continuous time, aperiodic signals and evaluates the frequency
response in the continuous frequency domain. The correlators are complex exponentials having constant
unity amplitude. Both t (time) and ω (frequency) run from negative infinity to positive infinity. The
Fourier Transform is a reversible transform; the inverse transform is
∞
x(t) = F (ω)ej ωt dω
−∞
Fourier Series
Many signals of interest are periodic, that is, they are composed of a harmonic series of cosines and sines.
For a periodic, continuous time signal of infinite extent in time, a set of coefficients can be obtained based
on a single period (between times to and to + T ) of the signal x(t):
to +T
1
ck = x(t)e−j kω0 t dt
T to
where T is the reciprocal of the fundamental frequency F0 and k = 0, ±1, ±2, ...
For real x(t), ck and c−k are complex conjugates. If we say
ck = |ck | ej θk
An equivalent expression is
∞
x(t) = a0 + ak cos(2π kF0 t) − bk sin(2π kF0 t)
k=1
∞
DT F T (x[n]) = X(e ) = jω
x[n]e−j ωn (1.1)
n=−∞
4 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
where ω (radian frequency) is a continuous function and runs from −π to π , and x[n] is absolutely
summable, i.e.,
∞
|x[n]| < ∞
n=−∞
DTFT theory will be discussed in detail below, while computation of the DTFT using the DFT
will be discussed in the chapter on the DFT.
N−1
=
DF S(x[n]) = X[k] x [n]e−j 2πkn/N
(1.3)
n=0
1
N−1
x[n] = X[k]ej 2πkn/N (1.4)
N
k=0
The DFS, a computable transform, forms an important theoretical basis for the Discrete Fourier
Transform and will be discussed in more detail in the chapter on the DFT.
The DFT (a computable transform) operates on discrete, or sampled signals, and evaluates fre-
quency response at a number (equal to about half the sequence length) of unique frequencies. The
correlators are complex exponentials having constant, unity amplitude, and the frequencies k range from
0 to N − 1 or, for even-length sequences, −N/2 + 1 to N/2 and −N/2 to −N/2 for odd-length DFTs.
The DFT (including its efficient implementation, the FFT) will be discussed extensively in the
chapter that follows the chapter on the z-transform.
1.3. INTRODUCTION TO TRANSFORM FAMILIES 5
1.3.2 LAPLACE FAMILY (TIME-VARYING-MAGNITUDE CORRELATORS)
Laplace Transform (LT)
The LT is defined as
∞ ∞
£(s) = x(t)e−st dt = x(t)e−σ t e−j ωt dt
−∞ −∞
The LT is the standard frequency transform for use with continuous time domain signals and
systems. The parameter s represents the complex number σ + j ω, with σ , a real number, being a damping
coefficient, and j ω, an imaginary number, representing frequency. Both σ and ω run from negative infinity
to positive infinity. The correlators generated by e−st are complex exponentials having amplitudes that
decay, grow, or retain unity-amplitude over time, depending on the value of σ . By varying both σ and ω,
the poles and zeros of the signal or system can be identified. Results are graphed in the s-Domain (the
complex plane), using rectangular coordinates with σ along the horizontal axis, and j ω along the vertical
axis. The magnitude of the transform can be plotted along a third dimension in a 3-D plot if desired, but,
more commonly, a 2-D plot is employed showing only the locations of poles and zeros.
The LT is a reversible transform, and can be used to solve differential equations, such as those
representing circuits having inductance and capacitance, in the frequency domain. The time domain
solution is then obtained by using the Inverse LT. The LT is used extensively for circuit analysis and
representation in the continuous domain. We’ll see later in the book that certain well known or classical
IIRs (Butterworth, Chebyshev, etc) have been extensively developed in the continuous domain using
LTs, and that the Laplace filter parameters can be converted to the digital domain to create an equivalent
digital IIR.
Note that the FT results when σ = 0 in the Laplace transform. That is to say, when the damping
coefficient is zero, the Laplace correlators are constant, unity-amplitude complex exponentials just as
those of the FT. Information plotted along the Imaginary axis in the s- or Laplace domain is equivalent,
then, to the FT.
z-Transform (z-T)
The z-transform (z-T) is a discrete time form of the Laplace Transform. For those readers not familiar
with the LT, study of the z-T can prove helpful since many Laplace properties and transforms of common
signals are analogous to those associated with the z-T. The z-T is defined as
∞
X(z) = x[n]z−n
n=−∞
The z-T converts a number sequence into an algebraic expression in z, and, in the reverse or inverse
z-T, converts an algebraic expression in z into a sequence of numbers.The z-T is essentially a discrete-time
version of the Laplace transform. The correlators are discrete-time complex exponentials with amplitudes
that grow, shrink, or stay the same according to the value of z (a complex number) at which the transform
is evaluated. Values of z having magnitudes < 1 result in a correlation of the signal with a decaying
(discrete) complex exponential, evaluation with z having a magnitude equal to 1 results in a Fourier-like
response, and evaluation with z having a magnitude greater than 1 results in a correlation of the signal with
a growing discrete complex exponential. Results can be plotted in the z-Domain, which is the complex
plane using polar coordinates of r and θ, where θ corresponds to normalized radian frequency and r to a
damping factor. The unit circle in the z-domain corresponds to the imaginary axis in the s-Domain; the
left hand s-plane marks a region of stable pole values in the s-plane that corresponds to the area inside
6 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
the unit circle in the z-plane. As in the s-plane, the z-T magnitude may be plotted using a 3-D plot, or,
using a 2-D plot, only the location of the poles and zeros may be plotted.
Among the discrete-signal transforms, the z-T is more general than the DTFT, since in the z-T,
the test exponentials may also have decay factors (negative or positive). All of the members of the Fourier
transform family use exponentials of constant unity amplitude to perform their correlations with the
signal of unknown frequency content, and thus cannot give pole and zero locations as can the Laplace
and z- transforms.
The z-transform will be discussed extensively in the next chapter.
Additional Transforms
There are also several other transforms that are derived from the DFT; namely, the Discrete Cosine
Transform (DCT), and the Discrete Sine Transform (DST). These transforms use multiples of half-
cycles of either the cosine or sine, respectively, as the correlators, rather than multiples of full cycles as in
the DFT. The bin values are real only. A form of the DCT called the MDCT (Modified DCT) is used
in certain audio compression algorithms such as MP3.
Reference [1] gives a thorough and very accessible development of the DFT, and also briefly
discusses the Laplace transform, the z-transform, the DCT, and the DST.
Example 1.1. Derive an algebraic expression for the DTFT of the function 0.9n u[n], and then evaluate
it numerically at frequencies between 0 and π radians, at intervals of 0.01 radian.
We note that x[n] = 0 for n < 0, that x[n] itself is absolutely summable since it is a decreasing
geometric series. The n-th term of the summation is
0.9n e−j ωn
and we note that each successive term is arrived at by multiplying the previous term by the number
0.9e−j ω and thus the net sequence forms a geometric series the sum of which is
1
(1.5)
(1 − 0.9e−j ω )
We can evaluate this expression at a finite number of values of ω and plot the result. The following
code directly evaluates expression (1.5) at frequencies between 0 and π radians, as specified by the vector
w:
1.4. THE DTFT 7
w = 0:0.01:pi; DTFT = 1./(1-0.9*exp(-j*(w)));
figure(8); plot(w/(pi),abs(DTFT));
xlabel(’Normalized Frequency’); ylabel(’Magnitude’)
Example 1.2. Evaluate and plot the magnitude of the DTFT of the following sequence: [1, 0, 1].
2
F (ω) = x[n]e−j ωn = [1, 0, 1][e−j ω0 , e−j ω1 , e−j ω2 ] = 1 + e−j ω2 (1.6)
n=0
From our earlier work, we recognize the impulse response [1,0,1] as that of a simple bandstop
filter. We can show that this is so by evaluating Eq. (1.6) at a large (but necessarily finite) number of
values of ω with the following code, the results of which are shown in Fig. 1.1.
w = 0:0.01:pi; DTFT = 1+exp(-j*2*w);
figure(8); plot(w/(pi),abs(DTFT));
xlabel(’Normalized Frequency’); ylabel(’Magnitude’)
1.8
1.6
1.4
1.2
Magnitude
0.8
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
Normalized Frequency
Figure 1.1: Magnitude of the DTFT of the simple notch filter [1, 0, 1].
8 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
Example 1.3. Write a script that will evaluate and plot the magnitude and phase of the DTFT for any
sequence; test it for the sequences [1, 0, 1], [1, 0,-1], and [1, 0, 0, 1].
Such a script should allow one to specify how many samples M of the DTFT to compute over the
interval 0 to Rπ, with R = 1 being suitable for real x[n] and R = 2 being suitable for complex x[n]. Values
of R greater than 2 allow demonstration of periodicity of the DTFT. The code creates an n-by-k matrix
dMat of complex correlators, where each column is a complex correlator of length n and frequency k.
The DTFT is obtained by multiplying the signal vector x on the right by dMat. Each element in the
resulting row vector of frequency responses is obtained as the inner or dot product of the signal vector x
with a column of dMat.
function LV_DTFT_Basic(x,M,R)
% LV_DTFT_Basic([1,0,1],300,1)
N = length(x); W = exp(-j*R*pi/M); k = 0:1:M-1;
n = 0:1:N-1; dMat = W.ˆ(n’*k); d = x*dMat; figure(9)
subplot(2,2,1); plot(R*[0:1:M-1]/M,abs(d));
grid; xlabel(’Norm Freq’); ylabel(’Mag’)
subplot(2,2,2); plot(R*[0:1:M-1]/M,angle(d))
grid; xlabel(’Norm Freq’); ylabel(’Radians’)
subplot(2,2,3); plot(R*[0:1:M-1]/M,real(d));
grid; xlabel(’Norm Freq’); ylabel(’Real’)
subplot(2,2,4); plot(R*[0:1:M-1]/M,imag(d))
grid; xlabel(’Norm Freq’); ylabel(’Imag’)
The result from making the call
LV_DTFT_Basic([1,0,1],300,1)
is shown in Fig. 1.2.
A more versatile version of the above code is the script (see exercises below)
Rπ([0 : 1 : M − 1])/M
and for the symmetrical option
2 2
1
1.5
Radians
0
Mag
1
−1
0.5
−2
0 −3
0 0.5 1 0 0.5 1
(a) Norm Freq (b) Norm Freq
2 2
1.5
1
1
Imag
Real
0
0.5
−1
0
−0.5 −2
0 0.5 1 0 0.5 1
(c) Norm Freq (d) Norm Freq
Figure 1.2: (a) Magnitude of DTFT of the sequence [1 0 1]; (b) Phase response of DTFT; (c) Real
component of DTFT ; (d) Imaginary component of DTFT.
LVxDTFT([1,0,1],[0:1:2],300,2,1,88)
which results in Fig. 1.3.
A second script (for a complete description of input arguments, see exercises below)
allows you to enter one sequence, and the second sequence is created as a modification of the first, delayed
by SampOffset samples and offset in frequency by the complex exponential FreqOffsetExp. Input arguments
M and R are as described for the script LVxDTFT ; F reqOpt determines whether the DTFT is computed
symmetrically or asymmetrically about frequency zero, as described above for the script LVxDTFT. For
the asymmetrical time option (determined by the input argument TimeOpt), the sequence time indices
of the first sequence are given as
n = 0 : 1 : N − 1;
10 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
4
Mag
2
0
−1 −0.5 0 0.5 1
Normalized Frequency (Multiples of π)
5
Radians
0
−5
−1 −0.5 0 0.5 1
Normalized Frequency (Multiples of π)
4
Real
2
0
−1 −0.5 0 0.5 1
Normalized Frequency (Multiples of π)
4
Imag
2
0
−1 −0.5 0 0.5 1
Normalized Frequency (Multiples of π)
Figure 1.3: (a) Magnitude of DTFT of the sequence [1,0,1]; (b) Phase of DTFT of same; (c) Real part
of DTFT of same; (d) Imaginary part of DTFT of same.
where N is the length of x. For the symmetrical time index option, the time indices are given as
This script is useful for demonstrating the effect on the DTFT of time and frequency shifts to a
first test sequence. A typical call, which results in Fig. 1.4, is
nN = (0:1:100)/100;
LVxDTFT_MS([cos(2*pi*25*nN)],0,...
exp(j*2*pi*12.5*nN),200,2,2,1)
We will make use of these scripts shortly while studying the various properties of the DTFT.
1.5. INVERSE DTFT 11
100 100
Mag
Mag
50 50
0 0
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(a) Norm Freq, x1[n] (e) Norm Freq, x2[n]
2 2
Radians
Radians
0 0
−2 −2
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(b) Norm Freq, x1[n] (f) Norm Freq, x2[n]
100 100
Real
Real
0 0
−100 −100
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(c) Norm Freq, x1[n] (g) Norm Freq, x2[n]
100 100
Imag
Imag
0 0
−100 −100
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(d) Norm Freq, x [n] (h) Norm Freq, x [n]
1 2
Figure 1.4: DTFT of first sequence, with its magnitude and phase and real and imaginary parts being
shown, respectively, in plots (a)-(d); DTFT of second sequence, which is the first sequence offset in
frequency by π/4 radian, with its magnitude, phase, and real and imaginary parts being shown, respectively,
in plots (e)-(h). All frequencies are normalized, i.e., in units of π radians.
Example 1.4. Using Eq. (1.7), compute x[0], x[1], and x[2] from the DTFT obtained in Eq. (1.6).
We get
12 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
π
1
x[0] = (1 + e−j ω2 )ej ω0 dω
2π −π
and
π
1
x[1] = (1 + e−j ω2 )ej ω1 dω
2π −π
and
π
1
x[2] = (1 + e−j ω2 )ej ω2 dω
2π −π
The formula for x[0] reduces to
π π π
1 1
(1 + e−j ω2 )dω = ( dω + e−j ω2 dω)
2π −π 2π −π −π
which is
π
1
(ω |π−π + e−j ω2 dω) = 1 + 0 = 1
2π −π
where we note that
π
2π if n=0
e±j ωn dω =
−π 0 if n = ±1, ±2...
For x[1] we get
π π
1 1
x[1] = (1 + e−j ω2 )ej ω1 dω = (ej ω1 + e−j ω1 )dω = 0
2π −π 2π −π
The formula for x[2] is the same as that for x[0] with the exception of the sign of the complex
exponential, which does not affect the outcome. The reconstructed sequence is therefore [1,0,1], as
expected.
Example 1.5. Using numerical integration, approximate the IDTFT that was determined analytically
in the previous example.
Let’s reformulate the code to obtain the DTFT from -pi to +pi, and to use a much finer sample
spacing (this will improve the approximation to the true, continuous spectrum DTFT), and then perform
the IDTFT one sample at a time in accordance with Eq. (1.2):
N=10ˆ3; dw = 2*pi/N; w = -pi:dw:pi*(1-2/N);
DTFT = 1+exp(-j*2*w);
x0 = (1/(2*pi))*sum(DTFT.*exp(j*w*0)*dw)
x1 = (1/(2*pi))*sum(DTFT.*exp(j*w*1)*dw)
x2 = (1/(2*pi))*sum(DTFT.*exp(j*w*2)*dw)
Running the preceding code yields the following answer, which rounds to the original sequence,
[1,0,1]:
1.6. A FEW PROPERTIES OF THE DTFT 13
x0 = 1.0000 - 0.0000i
x1 = -4.9127e-017
x2 = 1.0000 + 0.0000i
1.6.3 PERIODICITY
The DTFT of a sequence x[n] repeats itself every 2π :
nN = (0:1:100)/100; y = exp(j*2*pi*100*nN)
yields y = ones(1, 101), which clearly transforms the original sequence into itself, i.e., the new sequence
is the same as the old, and hence the DTFT is the same. In other words, the DTFT of a sequence repeats
itself for every frequency shift of 2π radians of the original sequence.
LVxDTFT_MS([1,0,1],0,exp(j*2*pi*1*(0:1:2)/16),100,2,1,2)
14 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
100 100
Mag
Mag
50 50
0 0
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(a) Norm Freq, x [n] (e) Norm Freq, x [n]
1 2
2 2
Radians
Radians
0 0
−2 −2
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(b) Norm Freq, x [n] (f) Norm Freq, x [n]
1 2
100 100
Real
Real
0 0
−100 −100
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(c) Norm Freq, x1[n] (g) Norm Freq, x2[n]
100 100
Imag
Imag
0 0
−100 −100
−1 −0.5 0 0.5 1 −1 −0.5 0 0.5 1
(d) Norm Freq, x1[n] (h) Norm Freq, x2[n]
Figure 1.5: DTFT of first sequence, with its magnitude and phase and real and imaginary parts being
shown, respectively, in plots (a)-(d); DTFT of second sequence, which is the first sequence offset in
frequency by 2π radians, with its magnitude, phase, and real and imaginary parts being shown, respectively,
in plots (e)-(h). All frequencies are normalized, i.e., in units of π radians.
which results in Fig. 1.6. The reader should be able to verify by visual comparison of plots (a) and (e) that
the magnitude of frequency response has in fact been shifted by π/8 radian.
1.6.5 CONVOLUTION
The DTFT of the time domain convolution of two sequences is equal to the product of the DTFTs of
the two sequences.
Example 1.6. Consider the two sequences [1, 0, 1] and [1, 0, 0, −1]. Obtain the time domain convo-
lution by taking the inverse DTFT of the product of the DTFTs of each sequence, and confirm the result
using time domain convolution.
1.6. A FEW PROPERTIES OF THE DTFT 15
2 2
Mag
Mag
1 1
0 0
0 0.5 1 1.5 2 0 0.5 1 1.5 2
(a) Norm Freq, x [n] (e) Norm Freq, x [n]
1 2
5 5
Radians
Radians
0 0
−5 −5
0 0.5 1 1.5 2 0 0.5 1 1.5 2
(b) Norm Freq, x1[n] (f) Norm Freq, x2[n]
2 2
Real
Real
0 0
−2 −2
0 0.5 1 1.5 2 0 0.5 1 1.5 2
(c) Norm Freq, x1[n] (g) Norm Freq, x2[n]
2 2
Imag
Imag
0 0
−2 −2
0 0.5 1 1.5 2 0 0.5 1 1.5 2
(d) Norm Freq, x1[n] (h) Norm Freq, x2[n]
Figure 1.6: DTFT of first sequence, with its magnitude and phase and real and imaginary parts being
shown, respectively, in plots (a)-(d); DTFT of second sequence, which is the first sequence offset in
frequency by π/8 radian, with its magnitude, phase, and real and imaginary parts being shown, respectively,
in plots (e)-(h). All frequencies are normalized, i.e., in units of π radians.
X1 (ej ω ) = 1 + e−j ω2
and for the second sequence
X2 (ej ω ) = 1 − e−j ω3
The product is
y = conv([1,0,1],[1,0,0,-1])
which produces the same result.
Example 1.7. Write a script that will demonstrate the above even-odd properties.
We can perform the even-odd decomposition using the script LVEvenOddSymmZero presented
earlier, and then use the script LVxDTFT in three separate calls to open three separate windows to show
X(ej ω ), XE(ej ω ), and XO(ej ω ); the following script also reconstructs the original DTFT as the sum
of its even and odd components, subtracts this from the DTFT of the original signal, and obtains the
RMS error, which should prove to be essentially zero, within the limits of roundoff error.
x = [1:1:9]; [xe,xo,m] = LVEvenOddSymmZero(x,[0:1:8]);
d = LVxDTFT(x,[0:1:8],200,2,2,10);
de = LVxDTFT(xe,m,200,2,2,11);
do = LVxDTFT(xo,m,200,2,2,12);
RMS = sqrt((1/200)*sum((d - (de+do)).ˆ2))
The value of RMS reported after running the above code was [1.0190e-016, -1.6063e-015i], which
is essentially zero, within the limits of roundoff error.
The rightmost expression in Eq. (1.8) is the input signal ej ω0 k scaled by the DTFT of h[n] evaluated at
ω0 . Since the DTFT evaluated at a single frequency is a complex number, it is sometimes convenient to
represent it as a magnitude and phase angle. Thus, for each frequency ω0 we would have the result
Example 1.8. Consider the LTI system whose impulse response is [1, 0, 1]. Determine the magnitude
of the response to the complex exponential.
exp(j*2*pi*(0:1:31)*5/32)
We note that the normalized frequency is 5/16 = 0.3125 and obtain the magnitude of H at the
given frequency as 1.111 using the following code:
w = 5*pi/16; DTFT = 1+exp(-j*2*w);
magH = abs(DTFT)
To obtain the magnitude of response via time domain convolution, we make the following call:
tdMagResp = max(abs(conv([1,0,1],exp(j*2*pi*(0:1:31)*5/32))))
which produces the identical result, 1.111.
Equation (1.9) may be generalized and applied to real sinusoids. Thus, the steady state response
y[n] of an LTI system to a cosine (or sine) of magnitude A, frequency ω0 and phase angle φ, with the
DTFT magnitude and angle being M and θ is
Example 1.9. Verify Eq. (1.10) using both cosine and sine waves having normalized frequencies of 0.53
for the LTI system whose impulse response is [1, 0, 1].
We’ll use a discrete cosine of the stated frequency with φ = 0 and M = 1, and then compute the
output according to Eq. (1.10) and then by convolution with the impulse response. The plot will show
that the results are identical except for the first two and last two samples (recall that Eq. (1.10) represents a
18 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
steady state response). In the code below, you can substitute the sine function (sin) for the cosine function
(cos) as well as change the frequency F and test signal length N .
F = 0.53; N = 128; w = F*pi; dtft = 1+exp(-j*2*w);
M = abs(dtft); theang = angle(dtft);
y1 = M*cos(2*pi*(0:1:N-1)*(N/2*F)/N + theang);
y2 = conv([1 0 1],cos(2*pi*(0:1:N-1)*(N/2*F)/N));
stem(y1,’bo’); hold on; stem(y2,’r*’)
Since LTI systems obey the law of superposition, Eq. (1.10) can be generalized for an input signal
comprising a sum or superposition of sinusoids:
K
y[n] = Mk Ak cos(ωk n + φk + θk ) (1.11)
k=1
K
M
y[n] + ak y[n − k] = bm x[n − m] (1.12)
k=1 m=0
K
M
H (ej ω )ej ωn + ak H (ej ω )ej ω(n−k) = bm ej ω(n−m)
k=1 m=0
which reduces to
M −j ωm
m=0 bm e
H (ej ω ) = K (1.13)
1 + k=1 ak e−j ωk
Example 1.10. Determine the frequency response of a certain LTI system that is defined by the following
difference equation, then compute and plot the magnitude and phase response for ω = 0 to 2π .
1 + e−j ω2
H (ej ω ) =
1 − 0.9e−j ω
which can be numerically evaluated using the following code:
N=10ˆ3; dw=2*pi/N; w = 0:dw:2*pi-dw;
H = (1+exp(-j*2*w))./(1-0.9*exp(-j*w));
figure; subplot(2,1,1); plot(abs(H)); subplot(2,1,2); plot(angle(H))
1.8 REFERENCES
[1] William L. Briggs and Van Emden Henson, The DFT, An Owner’s Manual for the Discrete Fourier
Transform, SIAM, Philadelphia, 1995.
[2] Steven W. Smith, The Scientist and Engineer’s Guide to Digital Signal Processing, California Technical
Publishing, San Diego, 1997.
[3] Alan V. Oppenheim and Ronald W. Schaefer, Discrete-Time Signal Processing, Prentice-Hall, Engle-
wood Cliffs, New Jersey, 1989.
[4] John G. Proakis and Dimitris G. Manolakis, Digital Signal Processing, Principles, Algorithms, and
Applications, Third Edition, Prentice Hall, Upper Saddle River, New Jersey, 1996.
[5] Vinay K. Ingle and John G. Proakis, Digital Signal Processing Using MATLAB V.4, PWS Publishing
Company, Boston, 1997.
1.9 EXERCISES
1. Determine analytically the DTFT of the following sequences:
(a) 0.95n u[n] - 0.8n−1 u[n − 1]
(b) cos(2π (0:1:3)/4)
(c) (0.85)n−2 u[n − 2]
(d) ([0,0,(0.85)n−2 u[n − 2]])u[n]
(e) (-0.9)n u[n] + (0.7)n−3 u[n − 3]
(f ) n(u[n] - u[n − 3])
2. Compute the DTFTs of the following sequences and plot the magnitude and phase responses (use
one of the scripts developed or presented earlier in this chapter, such as LV_DTFT_Basic). Be sure to
increase the number of DTFT samples as the signal length increases. It’s a good idea to use at least 10
times as many DTFT samples as the sequence length being evaluated. Consider plotting the magnitude
on a logarithmic scale to see fine detail better. To avoid the problem of taking the logarithm of zero, add a
small number such as 10−10 to the absolute value of the DTFT, then use the function log10 and multiply
the result by 20.
(a) cos(2*pi*k*(0:1:N-1)/N) for N = 8, 32, 128 and k = 0, 1, and N/2.
20 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
(b) [ones(1,10),zeros(1,20),ones(1,10),zeros(1,20)]
(c) b = fir1(21,0.5)
(d) [1,0,1]
(e) [1,0,1,0,1,0,1]
(f ) [1,0,1,0,1,0,1,0,1,0,1,0,1]
(g) [1,0,1,0,1,0,1,0,1,0,1,0,1].*hamming(13)’
(h) [1,0,1,0,1,0,1,0,1,0,1,0,1].*blackman(13)’
(i) [1,0,1,0,1,0,1,0,1,0,1,0,1].*kaiser(13,5)’
(j) [1,0,-1,0,1,0,-1,0,1,0,-1,0,1].*hamming(13)’
(k) [1,0,-1,0,1,0,-1,0,1,0,-1,0,1].*blackman(13)’
(l) [1,0,-1,0,1,0,-1,0,1,0,-1,0,1].*kaiser(13,5)’
(m) [real(j.ˆ(0:1:10))].*blackman(11)’
(n) [real(j.ˆ(0:1:20))].*blackman(21)’
(o) [real(j.ˆ(0:1:40))].*blackman(41)’
(p) [real(j.ˆ(0:1:80))].*blackman(81)’
3. Write a script that can receive b and a difference equation coefficients (according to Eq. (1.13)) in row
vector form (normalized so a0 = 1), compute, and display the following:
(a) The unit impulse response of the system defined by b and a.
(b) The unit step response of the system.
(c) The magnitude and phase of the DTFT.
(d) The response to a linear chirp of length 1024 samples and frequencies from 0 to 512 Hz (0 to
π radians in normalized frequency).
(e) The magnitude of response to a complex linear chirp of length 1024 samples and frequencies
from 0 to 512 Hz (0 to π radians in normalized frequency). Such a chirp can be generated by the following
code:
N = 1024; t = 0:1/N:1; y = chirp(t,0,1,N/2) + ...
j*chirp(t,0,1,N/2,’linear’,90)
(f ) The response to a signal of length 1024 samples containing a cosine of frequency 128.
(g) The response to a signal of length 1024 samples containing a cosine of frequency 256.
Use the script to evaluate the LTI systems defined by the following difference equations or b and
a coefficients. You should note that some of the systems are not stable. Compare the plot of DTFT
magnitude to the two chirp responses for each of the difference equations below. Where can the steady-
state magnitude of the responses specified in (b), (f ), and (g) above be found on the DTFT magnitude
plot? State whether each of the systems is stable or unstable.
(I) y[n] = x[n] + x[n-1] + 0.9y[n-1]
(II) y[n] = x[n] + 1.4y[n-1] - 0.81y[n-2]
(III) y[n] = x[n] + 1.4y[n-1] + 0.81y[n-2]
(IV) y[n] = x[n] - 2.45y[n-1] +2.37y[n-2] -0.945y[n-3]
(V) y[n] = x[n] +1.05y[n-1]
(VI) y[n] = 0.094x[n] + 0.3759x[n-1] + 0.5639x[n-2] + 0.3759x[n-3] + ...
0.094x[n-4] + 0.486y[n-2] + 0.0177y[n-4]
(VII) b = [0.6066,0,2.4264,0,3.6396,0,2.4264,0,0.6066];
a = [1,0,3.1004,0,3.7156,0,2.0314,0,0.4332]
4. For the following different functions, compute the DTFT, then plot the function on a first subplot
and its DTFT magnitude on a second subplot. The sinc function can be evaluated using the function
1.9. EXERCISES 21
sinc(x). What kind of filter impulse response results from the functions below? What effect does the
parameter c have, and what effect does the length of the vector n have?
(a) n =-9:1:9; c = 0.8; y = sinc(c*n);
(b) n =-9:1:9; c = 0.4; y = sinc(c*n);
(c) n =-9:1:9; c = 0.2; y = sinc(c*n);
(d) n =-9:1:9; c = 0.1; y = sinc(c*n);
(e) n =-39:1:39; c = 0.8; y = sinc(c*n);
(f ) n =-39:1:39; c = 0.4; y = sinc(c*n);
(g) n =-39:1:39; c = 0.2; y = sinc(c*n);
(h) n =-39:1:39; c = 0.1; y = sinc(c*n);
(i) n =-139:1:139; c = 0.8.; y = sinc(c*n);
(j) n =-139:1:139; c = 0.4.; y = sinc(c*n);
(k) n =-139:1:139; c = 0.2.; y = sinc(c*n);
(l) n =-139:1:139; c = 0.1.; y = sinc(c*n);
5. Compute and plot the magnitude and phase of the DTFT of the following impulse responses x. Note
the effect of the frequency parameter f and the difference in impulse responses and especially phase
responses between (a)-(e) and (f )-(j).
(a) n = -10:1:10; f = 0.05; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(b) n = -10:1:10; f = 0.1; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(c) n = -10:1:10; f = 0.2; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(d) n = -10:1:10; f = 0.4; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(e) n = -10:1:10; f = 0.8; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(f ) n = 0:1:20; f = 0.05; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(g) n = 0:1:20; f = 0.1; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(h) n = 0:1:20; f = 0.2; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(i) n = 0:1:20; f = 0.4; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
(j) n = 0:1:20; f = 0.8; x = ((0.9).ˆ(abs(n))).*cos(f*pi*n)
6. An ideal lowpass filter should have unity gain for |ω| ≤ ωc and zero gain for |ω| > ωc , and a linear
phase factor or constant sample delay equal to e−j ωM where M represents the number of samples of delay.
Use the inverse DTFT to determine the impulse response that corresponds to this frequency specification.
That is to say, perform the following integration
π
1
x[n] = X(ej ω )ej wn dω
2π −π
where
1 · e−j ωM |ω| ≤ ωc
X(e ) =
jω
0 |ω| > ωc
After performing the integration and obtaining an expression for x[n], use n = -20:1:20 and M =
10, and obtain four impulse responses corresponding to the following values of ωc :
(a) 0.1π
(b) 0.25π
(c) 0.5π
(d) 0.75π
22 CHAPTER 1. THE DISCRETE TIME FOURIER TRANSFORM
Convolve each of the four resulting impulse responses with a chirp of length 1000 samples and
frequency varying from 0 to 500 Hz. For each of the four impulse responses, plot the impulse response
on one subplot and the chirp response on a second subplot. On a third subplot, plot the result from
numerically computing the DTFT of each impulse response, or instead use the script LV_DTFT_Basic
or the similar short version presented in the text to evaluate the DTFT and plot it in a separate window.
To display on the third subplot, create a script
d = LV xDT F T _Basic(x, M, R)
based on LV_DTFT_Basic, but which delivers the DTFT as the output argument d and which does not
itself create a display.
7. For each of the four impulse responses computed above, obtain a new impulse response by subtracting
the given impulse response from the vector [zeros(1,20),1,zeros(1,20)] (this assumes that the vector n in
the previous example ran from -20 to +20).
Determine what kind of filter the four new impulse responses form. To do this, plot the magnitude
of the DTFT of each original impulse response next to the DTFT of each corresponding new impulse
response.
8. Create a script in accordance with the following call syntax, which should create plots similar to that
shown in Fig. 1.3; test it with the sample calls given below.
function LVxDTFT(x,n,M,R,FreqOpt,FigNo)
% Computes and displays the magnitude, phase, real, and
% imaginary parts of the DTFT of the sequence x having
% time indices n, evaluated over M samples.
% Pass R as 1 to evaluate over pi radians, or 2 to evaluate
% over 2*pi radians
% Use FreqOpt = 1 for symmetrical frequency evaluation
% about frequency 0 or FreqOpt = 2 for an asymmetrical
% frequency evaluation
% Sample calls:
% LVxDTFT([cos(2*pi*25*(0:1:99)/100)],[0:1:99],500,2,1,88)
% LVxDTFT([cos(2*pi*25*(-50:1:50)/100)],[-50:1:50],500,2,1,88)
% LVxDTFT([cos(2*pi*5*(0:1:20)/20)],[0:1:20],100,2,1,88)
% LVxDTFT([cos(2*pi*5*(-10:1:10)/20)],[-10:1:10],100,2,1,88)
% LVxDTFT([cos(2*pi*25*(0:1:100)/100)],[-50:1:50],500,2,1,88)
% LVxDTFT([exp(j*2*pi*25*(0:1:99)/100)],[0:1:99],500,2,1,88)
% LVxDTFT([cos(2*pi*25*(0:1:99)/100)],[0:1:99],1000,2,1,88)
9. Create a script that conforms to the following call syntax, which should create plots similar to that
shown in Fig. 1.6; test it with the sample calls given below.
function LVxDTFT_MS(x,SampOffset,FreqOffsetExp,...
% M,R,TimeOpt,FreqOpt)
% Computes and displays the magnitude, phase, real, and
% imaginary parts of the DTFT of the sequence x, evaluated
% over M samples, then computes the same for a
% modified version of x that has been shifted by
% SampOffset samples and multiplied by a complex
% exponential FreqOffsetExp.
1.9. EXERCISES 23
% Pass R as 1 to evaluate from 0 to pi radians, or
% Pass R as 2 to evaluate from 0 to 2*pi radians
% Pass TimeOpt as 1 to let n (the time indices for x1
% and x2) be computed as n = -(N-1)/2:1:(N-1)/2 for N odd
% or n = -N/2+1:1:N/2; for even N.
% Pass FreqOpt as 1 for symmetrical frequency computation
% and display (-R*pi to +R*pi, for example) or as 2 for
% frequency comp.and display from 0 to R*pi
% Sample calls:
% LVxDTFT_MS([cos(2*pi*25*(0:1:100)/100)],0,...
% exp(j*2*pi*10*(0:1:100)/100),500,2,1,1)
% LVxDTFT_MS([cos(2*pi*25*(0:1:100)/100)],0,...
% exp(-j*2*pi*10*(0:1:100)/100),500,2,1,1)
% LVxDTFT_MS([cos(2*pi*25*(0:1:100)/100)],0,...
% exp(-j*pi/2),500,2,1,1) % shifts phase
% LVxDTFT_MS([exp(j*2*pi*25*(0:1:100)/100)],0,...
% exp(-j*2*pi*10*(0:1:100)/100),500,2,1,1)
% LVxDTFT_MS([cos(2*pi*25*(0:1:100)/100)],0,...
% exp(j*2*pi*12.5*(0:1:100)/100),1000,2,1,1)
% LVxDTFT_MS([1 0 1],2,1,300,2,1,1)
% LVxDTFT_MS([1 0 1],0,exp(j*2*pi*1*(0:1:2)/3),...
% 100,2,1,1)
% LVxDTFT_MS([cos(2*pi*25*(0:1:100)/100)],0,...
% exp(j*2*pi*12.5*(0:1:100)/100),200,2,1,1)
% LVxDTFT_MS([1 0 1],0,exp(j*2*pi*(0:1:2)/3),300,2,1,1)
10. Compute 1200 evenly distributed frequency samples of the DTFT (i.e., a numerical approximation
of the DTFT) for the three following sequences:
(a) [0.1,0.7,1,0.7,0.1]
(b) [1,0,0,0,1]
(c) [0.95n - 0.85n ] for 0 ≤ n ≤ ∞
11. Numerically compute the inverse DTFTs of the three numeric DTFTs computed in the previous
exercise (for item (c), compute the inverse DTFT for n = 0:1:2).
12. Compute the net output signal obtained by convolving the signal
CHAPTER 2
The z-Transform
2.1 OVERVIEW
In the previous chapter, we took a brief look at the Fourier and Laplace families of transforms, and a
more detailed look at the DTFT, which is a member of the Fourier family which receives a discrete
time sequence as input and produces an expression for the continuous frequency response of the discrete
time sequence. With this chapter, we take up the z-transform, which uses correlators having magnitudes
which can grow, decay, or remain constant over time. It may be characterized as a discrete-time variant
of the Laplace Transform. The z-transform can not only be used to determine the frequency response
of an LTI system (i.e., the LTI system’s response to unity-amplitude correlators), it reveals the locations
of poles and zeros of the system’s transfer function, information which is essential to characterize and
understand such systems. The z-transform is an indispensable transform in the discrete signal processing
toolbox, and is virtually omnipresent in DSP literature. Thus, it is essential that the reader gain a good
understanding of it.
The z-transform mathematically characterizes the relationship between the input and output
sequences of an LTI system using the generalized complex variable z, which, as we have already seen, can
be used to represent signals in the form of complex exponentials. Many benefits accrue from this:
• An LTI system is conveniently and compactly represented by an algebraic expression in the vari-
able z; this expression, in general, takes the form of the ratio of two polynomials, the numerator
representing the FIR portion of the LTI system, and the denominator representing the IIR portion.
• Values of z having magnitude 1.0, which are said to “lie on the unit circle” can be used to evaluate
the z-transform and provide a frequency response equivalent to the DTFT.
• Useful information about a digital system can be deduced from its z-transform, such as location of
system poles and zeros.
• Difference equations representing the LTI system can be constructed directly from inspection of
the z-transform.
• An LTI system’s impulse response can be obtained by use of the Inverse z-transform, or by con-
structing a digital filter or difference equation directly from the z-transform, and processing a unit
impulse.
• The z-transform of an LTI system has, in general, properties similar or analogous to various other
frequency domain transforms such the DFT, Laplace Transform, etc.
By the end of this chapter, the reader will have gained a practical knowledge of the z-transform, and
should be able to navigate among difference equations, direct-form, cascade, and parallel filter topologies,
and the z-transform in polynomial or factored form, converting any one representation to another. Addi-
tionally, an understanding will have been acquired of the inverse z-transform, and use of the z-transform
to evaluate frequency response of various LTI systems such as the FIR and the IIR.
26 CHAPTER 2. THE Z-TRANSFORM
http://www.morganclaypool.com/page/isen
The entire software package should be stored in a single folder on the user’s computer, and the full
file name of the folder must be placed on the MATLAB or LabVIEW search path in accordance with the
instructions provided by the respective software vendor (in case you have encountered this notice before,
which is repeated for convenience in each chapter of the book, the software download only needs to be
done once, as files for the entire series of four volumes are all contained in the one downloadable folder).
See Appendix A for more information.
where z represents a complex number. The transform does not converge for all values of z; the region of
the complex plane in which the transform converges is called the Region of Convergence (ROC), and
is discussed below in detail. The sequence z−n is a complex correlator generated as a power sequence of
the complex number z and thus X(z) is the correlation (CZL) between the signal x[n] and a complex
exponential the normalized frequency and magnitude variation over time of which are determined by the
angle and magnitude of z.
In terms of numbers, if
x[n + 1]
x[n] = 0.9
for example, then it is required that |z| > 0.9 for convergence to occur.
If in fact x[n] is a geometrically convergent series, and z is properly chosen, the sum of the infinite
series of numbers consisting of x[n]z−n may conveniently be written in a simple algebraically closed form.
Example 2.1. Determine the z-transform for a single pole IIR with a real pole p having a magnitude
less than 1.0.
[p 0 (= 1), p1 , p2 , p3 , ... pn ]
0≤n<∞
is
1
(2.2)
1−c
For the single pole IIR with a pole at p, and by letting c = pz−1 (note that p 0 = 1) in Eq. (2.2),
we get the closed-form z-transform as
1 z
A(z) = −1
= (2.3)
1 − pz z−p
The z-transform in this case is defined or has a finite value for all z with |z| > |p| or
p
<1
z
28 CHAPTER 2. THE Z-TRANSFORM
Example 2.2. Plot the ROC in the z-plane for the z-transform corresponding to the sequence 0.8n u[n].
The z-transform is
1
X(z) =
1 − 0.8z−1
which converges for |z| > 0.8. The shaded area of Fig. 2.1 shows the ROC.
1
0.8
0.6
0.4
Imaginary
0.2
0
−0.2
−0.4
−0.6
−0.8
−1
−1 −0.5 0 0.5 1
Real
Figure 2.1: The Region of Convergence for a system having one pole at 0.8 is shown as the shaded area
outside (not including) a circle of radius 0.8. The unit circle is shown as a dotted circle at radius 1.0.
Example 2.3. Write the z-transform for the sequence 0.7n u[n], evaluate it at 500 values of z lying on
the unit circle (i.e., having a magnitude of 1.0, and radian frequencies between 0 and 2π ), and plot the
magnitude of the result.
Values of z on the unit circle have magnitude greater than 0.7 and thus lie in the ROC for the
z-transform, which is 1/(1- 0.7z−1 ); Figure 2.2 shows the result of running the following m-code, which
computes and plots the magnitude of the z-transform:
radFreq = [0:2*pi/499:2*pi]; z = exp(j*radFreq);
2.3. DEFINITION & PROPERTIES 29
3.5
2.5
Magnitude
1.5
0.5
0 0.5 1 1.5 2
Frequency, Units of π
Figure 2.2: The magnitude of H (z) = 1/(1 − 0.7z−1 ) evaluated at z = exp(jω) for ω = 0 to 2π .
For the positive-time or causal sequence x[n], convergence of the z-transform is guaranteed for all
z with magnitude greater than the pole having greatest magnitude (sometimes referred to as the dominant
pole) in a transfer function.
For example, a transfer function having two poles at 0.9 and 0.8, respectively, would have the
z-transform
1
A(z) =
(1 − 0.9z−1 )(1 − 0.8z−1 )
which would converge for all z having |z| > 0.9.
The z-transform is undefined where it does not converge. Consider an example where p = 0.9,
and we choose to evaluate the transform at z = 0.8. We write the first few terms of the definition of the
z-transform as
Example 2.4. Determine, and verify using a numerical computation, the z-transform and ROC of the
sequence defined as
the first few terms of which are 0.9z−1 , 0.81z−2 , 0.93 z−3 , etc., which is a geometric series having its
first term F T equal to 0.9z−1 and the ratio R between successive terms equal to 0.9z−1 . The sum of a
geometric series is F T /(1 − R), which leads to the z-transform as
0.9z−1
X(z) = (2.5)
1 − 0.9z−1
with ROC: |z| > 0.9.
To verify the validity of this expression, we can first compute the summation in Eq. (2.4) to a large
number of samples until convergence is (essentially) reached, using a value of z lying in the ROC. Then
we will substitute the chosen value of z in Eq. (2.5) and compare results, using the following code. Note
that in accordance with Eq. (2.4), we start each sequence, x[n] and the negative power sequence of z, at
power 1 rather 0.
N = 150; z = 1; zpowseq = z.ˆ(-1:-1:-N); x = 0.9.ˆ(1:1:N);
NumAns = sum(zpowseq.*x)
zXformAns = (0.9/z)/(1-0.9*(1/z))
Note that as |z| gets closer to 0.9, a larger value of N is necessary for convergence. For example, if
z = 0.91, N will need to be about 1500.
Infinite Length, Negative Time Sequence
An infinite-length sequence that is identically zero for values of n equal to or greater than zero is called
a negative-time sequence. A geometric sequence defined as
∞
z 1 z 1
X(z) = 1 − ( )n = 1 − = =
b 1 − z/b z−b 1 − bz−1
n=0
Example 2.5. A certain negative-time sequence is defined by x[n] = −0.9n u[−n − 1] where n = −1 :
−1 : −∞. Determine the z-transform and the ROC. Pick a value of z in the ROC, numerically compute
the z-transform, and then compare the answer to that obtained by substituting the chosen value of z into
the determined z-transform.
The z-transform is 1/(1-0.9z−1 ), and the ROC includes all z having magnitude less than 0.9. The
value of the transform for z = 0.6 is 1/(1-0.9/0.6) = -2.0.
We can numerically compute the z-transform, say, for 30 points, using z = 0.6, which gives the
answer as -2.0:
N = 30; b = 0.9; n = -N:1:-1; z = 0.6; sig = -(b.ˆn); z2n = z.ˆ(-n);
subplot(2,1,1); stem(n,sig); xlabel(’n’); ylabel(’Signal Amp’)
subplot(2,1,2); stem(n,z2n); xlabel(’n’); ylabel(’zˆ {-n}’)
zXform = -sum( (b.ˆn).*(z.ˆ(-n)) )
Infinite Length, Two-Sided
Sequences that have infinite extent toward both +∞ and -∞ are called two-sided and the ROC is the
intersection of the ROC for the positive and negative sequences.
Example 2.6. Determine the z-transform and ROC for the following two-sided sequence:
The net z-transform is the sum of the z-transforms for each of the two terms, and the ROC is the
intersection of the ROCs for each. Thus, we get
z z
X(z) = −
z − 0.8 z − 0.9
with the ROC for the left-hand term (the right-handed or positive-time sequence) comprising |z| > 0.8
and for the left-handed or negative-time sequence, the ROC comprises |z| < 0.9. The net ROC for the
two-sided sequence is, therefore, the open annulus (ring) defined by
Example 2.8. Evaluate the z-transform and state the ROC for the following three sequences:
z0 − z−2 + z−4
which has its ROC as the entire complex plane except for z = 0. For (b) we get
z5 − z3 + z1
which has its ROC as the entire complex plane except for z = ∞. For (c) we get
z2 − z0 + z−2
which has its ROC as the entire complex plane except for z = 0 and z = ∞.
Y (z) 1 + bz−1
= ; ROC: |z| > |a|
X(z) 1 − az−1
34 CHAPTER 2. THE Z-TRANSFORM
Convolution
The z-transform of the convolution of two functions x1 [n] and x2 [n] is the product of the z-transforms
of the individual functions. Stated mathematically,
Z(x1 [n] ∗ x2 [n]) = X1 (z)X2 (z); ROC: ROC(x1 [n]) ∩ ROC(x2 [n])
where the symbol ∗ is used here to mean convolution.
Example 2.10. Compare the convolution of two sequences using linear convolution and the z-transform
technique.
Consider the two time domain sequences [1,1,1] and [1,2,-1]. The time domain linear convolution
is y = [1,3,2,1,-1]. Doing the problem using z-transforms, we get
Y (z) = (1 + z−1 + z−2 )(1 + 2z−1 − z−2 ) = [1 + 3z−1 + 2z−2 + z−3 − z−4 ]
from which we can write the equivalent impulse response by inspection, [1,3,2,1,-1], which is identical
to the time domain result.
Z(x[n]) = X(z)
then
Z(x[−n]) = X(1/z)
and the ROC is inverted.
Example 2.11. A sequence is x[n] = [1, 0, −1, 2, 1], having time indices of [2, 3, 4, 5, 6]. Determine
the z-transform of x[−n].
— Mitä sinä niin suu supussa istut ja mietit? kysyi hän Tuomaalta.
Isäntä naurahti.
— Että mitä?
— Mitä sanot, jos antaisimme pois liikaa maata, jota meillä vielä
on?
*****
Nyt se oli sanottu irti, eikä Tuomas vielä tietänyt, mistä rahat olisi
siihen ottanut.
Oli tämä totisesti aikaa. Raha meni kuin hiekka sormien lomitse.
Veljeltään Pentiltä, joka oli liikemies, olisi Tuomas kai saanut,
mutta ei tahtonut mennä pyytämään, koska veli oli rahansa saanut
keinottelulla.
Hänkö tässä muka oli viisaampi kuin toiset, ja hänkö aikoi päästä
vähemmillä kustannuksilla taloudessaan kuin muut?
Omaansa kai hän säästi minkä säästi. Ja eikö hän senkin vuoksi
pienentänyt talouttaan, että maattomat saivat maata?
Nyt hän olisi voinut myydä metsää, mutta sitä ei ostettu. Sen
myyntiä vastaan ei voinut käsirahojakaan ottaa, jos olisi saanutkaan.
Sekin olisi kuin kerjäämistä.
Tuomas:
Eipä ole kiirettä sillä ottamisella, kunhan tietää varmasti, että saa.
Käy tässä kaupungissa ja tuo sieltä sille leninkikankaan.
— Mitähän oltanee.
— Ota sitten näistä omiin tarpeisiisi. Ota niin monta kuin haluat.
Voithan niitä käyttää miehesi tietämättä.
Vikki oli koko piru miehekseen. Suurta touhua piti, mutta näkyvää
ei tullut kuin nimeksi.
Antaahan olla, kaikki irtain siltä menee velasta, jota pankki kuuluu
hakevan. Hyvä jos riittääkään.
Ja kun heillä oli mallivaltiona itäinen naapuri, olisi näin ollen täällä
tiedossa sama kurjuus kuin rajan takanakin.
Omalta osaltaan hän oli kyllä koettanut tehdä mitä oli voinut. Joku
viikko sitten oli tehty samana päivänä kahdet kauppakirjat, joilla sai
kaksi paikkakunnan perheellistä päivätyöläistä viidentoista hehtaarin
suuruiset maapalat omikseen kolmentuhannen hinnalla ja
kolmenkymmenen vuoden maksuajalla, kaikki ilman
koronmaksuvelvollisuutta. Kaksi palstaa oli vielä jäljellä, ja niillekin oli
lukuisasti halukkaita ostajia.
*****
Tuomas nauroi.
No, eihän siinä niin mitään erikoista ihmettä. Olihan Saara kerran
näyttänytkin kyntötaitoaan. Kääräissyt helmansa vyölleen ja
tarttunut kouriinsa sylkäisten sahrojen tappiin. Iso renki oli vieressä
irvistellyt, mutta Saaralta syntyikin suorempi vako kuin häneltä.
Tuomas mietti.
Miks’ei se sopinut. Saisivathan nähdä, että yksinäinen nainenkin
pystyi saamaan maasta kaikin puolin riittävän ja huolettoman
elannon. Ja olisihan se muutenkin…
9.
*****
Ja sitten.
*****
Niille piti pelloistaan kylvää monta sarkaa, ja jos kato kävi, niin
antaa viimeinenkin jyvä.
Turhaan sai sieltä odotella siunausta pelloilleen, jollei itse painanut
auraansa syvemmälle.
*****
— Niin se kävi viime talvenakin, että sata äyriä sai maksaa se,
jonka piti velkaa kerjätä, mutta viidelläkymmenellä pääsi se, jolle jäi
tuhansia puhtaaksi tuloksi.
— Voi helvetti!
— Sepä se. Ei ole maata, vaikka sitä kuitenkin on. Sanokaa sille,
että minulta saa palstan, vaikka ilmaiseksi, jos jättää pillinsä ja
piiparinsa, sanoi Tuomas.
*****
— Poisko jo?
— Niin, kotinurkille.
— Niinpä taitaa…
10
Huutokauppapäivä tuli.
Ja sitten huutokauppa.