Professional Documents
Culture Documents
0.1
EECS 451
Digital Signal Processing and Analysis
Lecture Notes
J. Fessler
DSP is everywhere, and hardly needs a motivating introduction these days: modems, cell phones, computer sound cards, digital
video.
Course Overview
2 Discrete-time signals
2 Discrete-time systems (LTI, convolution)
3 z-transform
4 Discrete-time Fourier transform (DTFT)
8 Filter design
5 Discrete Fourier transform (DFT)
6 Fast Fourier transform (FFT)
9 A/D and D/A (sampling, quantization, reconstruction)
Multirate signal processing (upsampling, downsampling)
Image processing (as time permits)
Chapter 1
Introduction
Contents
Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Signals, Systems, and Signal Processing . . . . . . . . . . . . . . . . . .
Basic Elements of a DSP System . . . . . . . . . . . . . . . . . . . . . .
Advantages of Digital over Analog SP . . . . . . . . . . . . . . . . . . .
Classification of Signals . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dimensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Time characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Value characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other types of classifications . . . . . . . . . . . . . . . . . . . . . . . .
Deterministic vs Random signals . . . . . . . . . . . . . . . . . . . . . .
Periodicity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Energy and power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Continuous-Time Sinusoidal Signals . . . . . . . . . . . . . . . . . . . .
Discrete-Time Sinusoidal Signals . . . . . . . . . . . . . . . . . . . . . .
Instantaneous frequency . . . . . . . . . . . . . . . . . . . . . . . . . . .
Analog to Digital and Digital to Analog Conversion . . . . . . . . . . . .
Sampling Analog Signals . . . . . . . . . . . . . . . . . . . . . . . . . .
The Sampling Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . .
Quantization of continuous-amplitude signals . . . . . . . . . . . . . . . .
Quantization of sinusoidal signals . . . . . . . . . . . . . . . . . . . . . .
Coding of quantized samples . . . . . . . . . . . . . . . . . . . . . . . .
D/A conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Analysis of digital signals and systems vs discrete-time signals and systems
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Notation
set of real numbers: R
set of complex numbers: C
set of integers: Z
set of natural numbers: N = {1, 2, . . .}
square root of 1:
1.1
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1.1
1.2
1.2
1.3
1.3
1.4
1.4
1.5
1.6
1.6
1.6
1.6
1.6
1.7
1.7
1.8
1.10
1.11
1.11
1.11
1.11
1.11
1.11
1.12
1.12
1.12
1.2
Overview
Defines terms, e.g., DSP
Basic elements of a DSP system
Basic types of signals
Frequency
Sampling A/D and D/A conversion
Much of this chapter is review of 206/306, so it will covered only briefly in lecture.
Why digital over analog? Cheaper. More reliable. Programmable - flexible. Often higher precision.
These notes will follow organization, notation, and mathematical content of text fairly closely.
They will fill in the whys, and extend concepts to 2D for image processing.
1.1
Signals, Systems, and Signal Processing
Mathematically speaking, a signal is just a function. But usually we think of signals as representing some physical quantity that
varies with time or space (or any other independent variable or variables).
Often when we discuss signals we refer to the mathematical representation of the physical quantity.
Example: An approaching ambulance siren produces a time-varying change in acoustic pressure that our ears perceive as sound. A
simplified representation of the siren signal is
s(t) = (1 + t) cos(2[1000 + 10t + 300 cos(22t)]t)
The (1 + t) amplitude term represents increasing loudness as the ambulance approaches, the sinusoidal term represents the siren
oscillation, the frequency is time-varying; the 300 cos(22t) term represents the eeh-ooh-eeh-ooh periodic variation in pitch, and
the 10t term represents increasing pitch due to the Doppler effect as the ambulance approaches. The point is that the primary
physical attributes can often be captured in a mathematical representation that we call a signal.
Often, however, signals are very complicated and not easily described by a concise mathematical formula.
A system is a physical device that performs an operation on a signal.
Example. The human ear converts acoustic signals into electrical nerve synapses (another signal) that are processed by the brain.
In this case the input and output signals for the system are different physical quantities.
Example. The tone controls (bass treble) in an audio amplifier perform filtering of an audio signal (represented as analog voltages
in the amplifier). In this case the input and output signals are both voltage waveforms.
One of the main roles of electrical engineers is to design and analyze systems that take some input signal and produce some related
(but almost always different) output signal. We refer such operations as signal processing.
Example. For an audio amplifier, ideally the output signal is simply an amplified version of the input signal. (On paper it is easy:
sout (t) = asin (t). But implementing this in analog hardware with minimal distortion is nontrivial.)
Example. The input to a fingerprint recognition system is an image of a fingerprint. The output is (most likely) some bits within
a digital device that correspond to the identity of the person with that fingerprint, or a list of likely matches.
We call this type of application signal analysis or signal classification.
This course will emphasize signal processing methods for digital signals - to be defined soon.
1.3
1.1.1
Basic Elements of a DSP System
Typical analog signal processing system:
Analog input signal
Analog output signal
Analog signal processor
xa (t)
ya (t)
In EE (since after all the first E in EE is electrical) typically the input and output signals are voltages or currents.
Since most physical quantities are analog, a DSP system usually needs an interface between the analog physical world and the
digital computer world.
Typical digital signal processing system
Analog input
Digital input
Digital output
Analog output
A/D
DSP
D/A
xa (t)
x[n]
y[n]
ya (t)
Often the final D/A step is not needed.
Example. In a speech recognition system the analog voice signal (from microphone) is digitized, and then the processing converts
the digital signal into ASCII characters representing letters, numbers, punctuation, etc.
Although DSP systems have many advantages over analog SP, the A/D and D/A interfaces are the Achilles heel of DSP, since
they limit the speed and accuracy of a DSP system. Of course the speed and accuracy of A/D converters is continually increasing
with improvements in circuit technology, but faster and more accurate A/D chips are also usually more expensive, so a DSP system
designer must consider the tradeoff between cost and performance.
Example. Music CD at 44kHz. Higher sampling rate might give higher quality, but less music on CD.
1.1.2
Advantages of Digital over Analog SP
Programmable - flexible (just a software change rather than complete redesign)
Often more accurate (higher precision) (cf. 10% tolerance resistors and other passive circuit elements)
Can store, transmit, duplicate digital signals with no (additional beyond A/D) loss of fidelity.
Cheaper (sometimes), i.e., due to flexibility.
More reliable (cf. temperature drifts of analog components).
1.4
1.2
Classification of Signals
A signal is a function of one or more independent variables.
1.2.1
Dimensionality
Domain dimension
We can classify signals by the dimension of the domain of the function, i.e., how many arguments the function has.
A one-dimensional signal is a function of a single variable, e.g., time.
An M -dimensional signal is a function of M independent variables.
Example. An audio signal xa (t) is a one-dimensional, or 1D, signal, since it is a function of time.
Example. A color photograph is a two-dimensional (2D) signal, which we call an image, since it is a function of two spatial
coordinates, e.g., f (x, y).
Example. What is an example of a 3D signal?
A black and white movie is a time-varying sequence of pictures I(x, y, t), i.e., it is a (scalar valued) function of two spatial
coordinates x and y and of time t, so it is a 3D signal.
We will focus on one-dimensional signals in this course, generally considering the independent variable to be time t. We will also
consider images, which are 2D signals.
Range dimension
We can also classify signals by the dimension of the range of the function, i.e., the space of values the function can take.
scalar or single-channel signals
real-valued scalar
complex-valued
multichannel signals
real vector
complex vector
Example. A color TV picture can be described by a red, blue and green signal, so it is a three-channel signal, whereas a BW TV
picture is scalar valued.
We will focus on scalar signals in this course, both real and complex.
Most of the design/analysis techniques generalize to multichannel and multidimensional signals.
1.5
1.2.2
Time characteristics (type of domain)
Continuous-time signals or analog signals
Defined for all times t (, ), or at least over some continuous interval (a, b).
2
Example. xa (t) = et , < t < . Picture
Discrete-time signals
Defined only at certain specific values of time.
Typically use tn , n = 0, 1, 2, . . . to denote time instants where signal is defined.
In this course we focus on uniformly spaced time samples
tn = nT,
where T denotes the time-spacing between samples.
In this case we can (and will) use the short hand x[n] as follows:
x[n] = xa (tn ) = xa (nT ) .
Some authors use the notation xn or x(n).
Example.
0,
n < 0,
1
n = 0, 1, 2,
x[n] =
Picture
0,
n
= 3, 4
0.5n , n = 5, 6, . . .
1.6
1.2.3
Value characteristics (type of range)
A continuous-valued signal can take any value in some continuous interval, e.g., voltage between 0 and 5 volts.
A discrete-valued signal only takes values from a finite set of possible values.
Example. In heart attack example above, x[n] could be 0, 1, 2, . . . , population of world.
A binary signal only takes two values.
A digital signal is a discrete-time signal that is also discrete-valued.
If the input to a DSP system is originally an analog signal (e.g., an acoustic voice signal that has been converted to a voltage signal
by a microphone), then the A/D converter will convert the analog signal to digital form by quantizing its values to a finite discrete
set of values.
Example. An 8-bit A/D converter can represent 28 = 256 different values. Each value of the input signal must be rounded to the
nearest of the 256 output values.
Other types of classifications
1.2.4
Deterministic vs Random signals
Deterministic signals can be described by an explicit mathematical representation.
Random signals evolve over time in an unpredictable manner.
Example: Hiss or noise in an audio system.
We will focus on deterministic signals, although reducing noise (eliminating a random component) is often a goal in a DSP system.
Periodicity
A discrete-time signal x[n] is called periodic with period N N, or N -periodic, if and only if
x[n] = x[n + N ], n Z.
The smallest such N is called the fundamental period of the signal.
If no such N exists, the signal is called aperiodic.
A constant signal, e.g., x[n] = c, is a degenerate type of periodic signal. In fact it is N -periodic for every N N. From a timedomain perspective, it is natural to say that the fundamental period of this signal is N = 1. However, from a frequency-domain
perspective, it is also reasonable to say that its fundamental period is . Which definition is used is not particularly important in
practice.
Energy and power
For concepts that were introduced in detail in 1D in 206, these notes will sometimes present only the 2D versions. The 1D versions
can be obtained easily from the 2D versions.
The energy of an image x[n, m] is defined as
Ex =
|x[n, m]| .
n= m=
Px = lim
N
X
n=N m=N
|x[n, m]| .
1.7
1.3
Frequency
There are similarities and differences between the meaning of frequency for continuous-time and discrete-time signals.
Point: to begin to see similarities and differences between discrete- and continuous-time.
1.3.1
Continuous-Time Sinusoidal Signals
Consider an analog continuous-time sinusoidal oscillation
xa (t) = A cos(2F0 t + ), < t <
A is the amplitude
is the phase in radians
F0 is the frequency in Hz (cycles per second)
Some books express the frequency in radians per second using = 2F0 .
A cos( t + ), A=2, =0.5, =1.5
1.5
x (t)
0.5
0.5
1.5
2
10
0
t
10
e = cos sin .
1.8
1.3.2
Discrete-Time Sinusoidal Signals
A discrete-time sinusoidal signal may be expressed
x[n] = A cos(n + ), n = 0, 1, 2, . . .
1.5
x(n)
0.5
0.5
1.5
2
20
15
10
0
n
10
15
20
1.5
x(n)
0.5
0.5
1.5
2
20
15
10
0
n
10
15
20
1.9
0
2
To convert a quantity, such as the period N , from units samples to time units (e.g., seconds), multiply by the sampling rate
Ts = 1/Fs .
B2 DT sinusoidal signals with frequencies separated by an integer multiple of 2 are identical (indistinguishable).
If 2 = 1 + k2 then
cos(2 n + ) = cos((1 + 2k)n + ) = cos(1 n + + 2kn) = cos(1 n + )
since cos is 2 periodic.
Discrete-time sinusoidal signals with frequencies in the range 0 are distinct.
Any DT sinusoidal signal with frequency outside the range 0 is identical to a DT sinusoidal signal with a frequency
within that range (possibly with the negative phase). Hence we refer to such signals as aliases, since they are the same
signal with a different name.
Example.
19
n+
7
9
n+
cos
7
cos
=
3
=
3
5
5
n + 2n +
n+
= cos
7
3
7
3
9
5
5
n
n 2n
n
cos
= cos
= cos
7
3
7
3
7
3
cos
x[n] = A e(n+)
For sinusoidal signals, we usually take the frequency to be nonnegative. For complex exponential signals, we allow the frequency
to be both positive and negative.
1.10
Aliasing illustrated
10
x0(t)
5
0
5
10
0
0.005
0.01
0.015
0.005
0.01
0.015
0.01
0.015
10
x1(t)
5
0
5
10
0
10
x2(t)
5
0
5
10
0
0.005
Instantaneous frequency
For a sinusoidal function of the form
xa (t) = cos(2g(t)),
the instantaneous frequency is given by
Ft =
Example. If g(t) = F0 t, then
Example. If g(t) = t2 , then
called a chirp signal.
d
dt g(t)
d
g(t).
dt
= F0 , as usual.
d
dt g(t)
= 2t, meaning that the instantaneous frequency is increasing (linearly) with time. This is
1.11
1.4
Analog to Digital and Digital to Analog Conversion
Before an analog signal can be processed by a digital system, the signal must be converted into digital form. This process is called
analog-to-digital (A/D) conversion and the corresponding devices are called A/D converters or ADCs.
An A/D converter has the following components, at least conceptually.
Analog signal
Discrete-time signal
Quantized signal
Sampler
Quantizer
Coder 01011 . . .
xa (t)
x[n]
xq [n]
Sampling the analog signal at discrete time instants, to form a discrete-time signal.
Quantizing the sampled signal to form a discrete-time, discrete-valued signal. The values of x q [n] are from some finite set.
Coding the discrete-valued signal using a unique binary sequence for each element in the set of possible values.
The difference between the unquantized signal x[n] and the quantized signal x q [n] is called the quantization error.
1.4.1
Sampling Analog Signals
Ideal periodic sampling or uniform sampling is defined by
x[n] = xa (nTs )
where Ts is the sampling period or sampling interval. (See Ch. 9 for practical discussions of sampling.)
Its reciprocal, Fs = 1/Ts is called the sampling rate or the sampling frequency.
x[n]
n=
2Fmax
sinc(2Fmax (t n/Fs ))
Fs
sin(t)
.
t
is called the Nyquist rate.
4
Because of this property, A/D converters are often preceded by an anti-aliasing filter that is a low-pass filter with cutoff frequency
appropriately coupled to the sampling rate of the A/D converter.
Note: if Xa (F ) does not have any Dirac delta functions at Fmax , then it is sufficient to sample at Fs 2Fmax . But if xa (t) =
sin(2Fmax t + ), then we need Fs > 2Fmax .
1.4.3
Quantization of continuous-amplitude signals
Quantization of audio signals illustrated in first computer assignment.
If signal quantized to 2b levels, what is bit rate out of coder? bFs (bits/sample) (samples/sec)
1.4.4
Quantization of sinusoidal signals
1.4.5
Coding of quantized samples
An n-bit code can represent 2n discrete signal values.
1.12
1.4.6
D/A conversion
Example: CD players and PC sound cards...
15
10
xa(t)
5
0
5
10
15
0T
1T
2T
3T
4T
5T
t
6T
7T
8T
9T
10T
10
10
15
10
x(n)
5
0
5
10
15
0
5
n
16
12
x(n) and xq(n)
8
4
0
4
8
12
16
0
5
n