Digital Signal Processing Ed1 v1
Digital Signal Processing Ed1 v1
RN
LEA ER,
FA RN
T
BOOCs Digital Signal Processing
Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
DIGITAL SIGNAL
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
PROCESSING
Paolo Prandoni
and Martin Vetterli
2
ULE 5 1:33:34
MOD
S T
BET
RN
T
LEA ER,
FA RN
LEA ER!
M
O
DU
LE
6
1:
51
:3
6
EPFL
BOOCs
Paolo Prandoni
2:36:58
and Martin Vetterli
ULE 4
Digital Signal Processing
MODULE
1
M OD
LESSONS
1:28
:2 8
M
O
DU
LE
2
1:0
3:1
3
2
2:34:1 MODULE 3
RN
LEA ER, BOOCs Digital Signal Processing
3
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
CONTENT
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
MODULE 1
1.1 Introduction to Digital Signal Processing 5
1.2 Discrete Time Signals 6
1.3.a How Does Your PC Play Discrete-Time Sound? 9
1.3.b The Karplus-Strong Algorithm 9
Signal of the Day: Goethe’s Temperature Measurement 11
1.4 Complex Exponentials 12
MODULE 2
2.1 Signal Processing and Vector Spaces 13
2.2.a Vector Space 14
2.2.b Signal Space 15
2.3 Bases 16
2.4 Subspace-Based Approximation 18
Signal of the Day: Exoplanet Hunting 19
MODULE 3
3.1.a The Frequency Domain 20
3.1.b The DFT as a Change of Basis 20
3.2.a The Definition of DFT 22
3.2.b Examples of DFT Calculation 23
3.2.c Interpreting a DFT Plot 25
3.3.a DFT Analysis 27
3.3.b DFT Example – Analysis of Musical Instruments 27
3.3.c DFT Synthesis 28
3.3.d DFT Example – Tide Prediction in Venice 30
3.3.e DFT Example – MP3 Compression 31
Signal of the Day: The First Man-Made Signal from Outer Space 31
3.4.a The Short-Time Fourier Transform 32
3.4.b The Spectrogram 32
3.4.c Time-Frequency Tiling 33
3.5.a Discrete Fourier Series 34
3.5.b Karplus-Strong Revisited and DFS 35
3.6.a Karplus-Strong Revisited and DTFT 36
3.6.b Existence and Properties of the DTFT 37
3.6.c The DTFT as a Change of Basis 38
3.7.a Sinusoidal Modulation 39
3.7.b Tuning a Guitar 40
Signal of the Day: Tristan Chord 40
RN
LEA ER, BOOCs Digital Signal Processing
4
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
MODULE 4
4.1.a Linear Time-Invariant Filters 41
4.1.b Convolution 41
Signal of the Day: Camera Resolution and Space Exploration 42
4.2.a The Moving Average Filter 43
4.2.b The Leaky Integrator 44
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
MODULE 5
5.1.a The Continuous-Time Paradigm 60
5.1.b Continuous-Time Signal Processing 60
5.2.a Polynomial Interpolation 62
Signal of the Day: Fukushima 62
5.2.b Local Interpolation 63
5.3.a The Spectrum of Interpolated Signals 64
5.3.b The Space of Band-Limited Functions 65
5.3.c The Sampling Theorem 66
5.4.a Raw Sampling 67
5.4.b Sinusoidal Aliasing 68
5.4.c Aliasing for Arbitrary Spectra 68
5.4.d Sampling Strategies 71
5.5.a Stochastic Signal Processing 72
5.5.b Quantization 72
Signal of the Day: Lehman Brothers 73
MODULE 6
6.1.a The Success Factors for Digital Communication 74
6.1.b Constraints of the Analog Channel 74
6.1.c The Design Problem 75
6.2.a Upsampling 76
6.2.b Fitting the Transmitter Spectrum 78
6.3.a Noise and Probability of Error 79
6.3.b PAM and QAM 80
6.4.a Modulation and Demodulation 82
6.4.b Design Example 84
6.5.a Receiver Design 85
6.5.b Delay Compensation 85
6.5.c Adaptive Equalization 86
6.6.a ADSL Design 88
6.6.b Discrete Multitone Modulation 89
Signal of the Day: Moiré Patterns 90
RN
LEA ER, BOOCs Digital Signal Processing
5
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Let us first define the main concepts of this course. A signal is a description of the evolution of a physical
phenomenon. Processing is where we make sense of the information that has been described by the signal.
There are two ways we can process a signal:
–– We can analyze it: understand the information carried by the signal and perhaps extract a more high level
description.
–– We can synthesize it: create a physical phenomenon that contains a certain amount of information that
we want to put out in the world.
The digital paradigm is composed of two fundamental ingredients: discrete time and discrete amplitude.
Discrete models are extremely easy to use computationally speaking. Mathematically these are mappings
from a set of integers to a set of values, V, which could be a set of real numbers. We will indicate a discrete-
time signal as x[n]. The index n does not have a physical dimension, it is just an ordinal number that orders
the samples one after another.
The continuous-time representation and the discrete-time representation are equivalent. Mathematically,
the result is known as a sampling theorem, and it has a very simple statement:
Discrete amplitudes have very important consequences in three domains, as it is easier to deal with a finite
set of values:
–– storage
–– processing
–– transmission
RN
LEA ER, BOOCs Digital Signal Processing
6
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Now we will consider discrete time signals and operators. First, we will define what discrete time signals
are. A discrete time signal is a sequence of complex numbers. For now, most of the signals we will study
will have one dimension, which typically will be time. Notation is particularly important: indices of a signal
named x are integers such that the nth term of the signal will be denoted as x[n]. Note that the indices are
dimensionless; the analysis of the signal implies the periodicity of measurements, also known as sampling.
Typically, we have two-sided sequences x: Z → C meaning they could go from –infinity to +infinity.
The delta signal
Among the formal signals used in this class, there is the delta signal, x[n] = ∂[n] (fig. 1). This is the simplest
signal you will encounter in this class, it is equal to 1 whenever n = 0 and 0 otherwise.
x[n] = δ[n]
0
−15 −10 −5 0 5 10 15
FIGURE 1
5:15 16:29
59
The delta signal
x[n] = u[n]
0
−15 −10 −5 0 5 10 15
FIGURE 2
6:26 16:29
62
The unit step signal.
RN
LEA ER, BOOCs Digital Signal Processing
7
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The third signal we will study in this lecture is exponential decay. x[n] = |a|nu[n] where |a| < 1, which is a
combination of the unit step, meaning it is equal to 0 before the origin and then is positive. At that point,
The exponential decay
we apply an exponential where the root is smaller than 1. As it is taken to the nth power, it comes down as
an exponential.
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
0
−15 −10 −5 0 5 10 15
FIGURE 3
6:55 16:29
64
The exponential decay signal
The sinusoid
Nowadays, most of the signals we encounter in real life are oscillations, a combination of sinusoids. A
sinusoid is a signal such that x[n] = sin(ω0n + ø).
x[n] = sin(ω0 n + θ)
0
−15 −10 −5 0 5 10 15
−1
FIGURE 4
13:11 16:29
68
The sinusoid
RN
LEA ER, BOOCs Digital Signal Processing
8
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
There are four classes of signals and each is used in a different case:
–– The finite length signal: can either be written as a sequence notation, x[n] where n = 0, ... ,N–1, or as a
vector notation x = [x0 x1 ... xN-1]T. They are very useful for numerical entities (e.g., Matlab).
–– The infinite length signal: can also be written as a sequence notation, x[n] where n ∈ . Very good for
mathematical abstraction and theorems.
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
–– The periodic signal: for an N-periodic sequence ~ x[n] = ~x[n + kN] where n, k, N ∈ and one of these
periods has all the information_ needed. It is thus a bridge between finite and infinite length sequences.
–– The finite support sequence: x[n] = x[n] for 0 ≤ n ≤ N–1 and 0 otherwise it has the same information as
a finite length signal of length N. It is another possible bridge between finite and infinite length signals.
Let’s now look at the elementary operators that we can apply to these elementary signals:
–– scaling: y[n] = αx[n], where α is a scalar
–– sum: y[n] = x[n] + z[n]
–– product: y[n] = x[n]·z[n]
–– shift by k (delay): y[n] = x[n–k]
Two conceptual characteristics of a signal are its power and energy. The energy is the sum of the squares
of the samples. It may or may not be finite. The notion of power is simply the energy of one period divided
by the length of the period.
For periodic signals, energy will be infinite and power will be the same formula as stated above, but applied
to a single period.
RN
LEA ER, BOOCs Digital Signal Processing
9
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
A computer has interfaces that allow you to visualize the signals that you create by writing a few lines of
code. You can visualize them as plots on the screen, and more importantly, you can materialize the signals
as audio signals that you can hear. However, an interface is needed, as our ears are analog devices and the
PC is a digital device.
In discrete time, n has no physical dimension, and periodicity is determined by how many samples we have
to observe before the pattern repeats. In the physical world, periodicity is measured in how many seconds
wesounds
How your PC plays have to wait before the pattern repeats, and frequency is measured in Hertz (s–1). Figure 1 shows how
the PC bridges this gap with a sound card.
FIGURE 1
2:05 3:33
40
How your PC plays sound
This is an example of what signal processing can be applied to. We will see that there are some simple
primitives that can be used to build signal processing devices. We will first consider digital signal processing
as Lego blocks.
DSPLegoas blocks
Legohave various colors and shapes but they all fit together. A block diagram, as you
can see in figure 1, takes a sequence x[n] as an input and outputs another sequence y[n] through multipliers,
adders, or delays.
a b
x[n] + + y [n]
z −1 −1
c
+ z −3
z −1
FIGURE 1
0:10 19:42
x[n]
+ x[n] + y [n] An adder takes two signals and outputs their sum (fig. 2).
y [n]
FIGURE 2
0:40 19:42
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
cks: Multiplier
Adder
The delay is denoted by z–N and the output of a delay is the same
sequence shifted by an integer N to the right (fig. 4).
x[n] z −1 x[n − 1]
FIGURE 4
1:21 19:42
Delay
Let’s study an operator: the moving average. The 2-point moving average is a simple average:
83
84
We can now use blocks to build a diagram for the 2-point moving average in figure 5.
1/2
x[n] + y [n]
z −1
FIGURE 5
4:00 19:42
11
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
x[n] + y [n]
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
z −1
FIGURE 6
7:20 19:42
In figure 7, we can see a generalized version of that reversed loop. If we fix α to 1, then we can observe that
a delay of M implies an M-sample periodicity, which could be very useful in playing sounds. Going further
into that generalized version:
–– M controls the frequency (pitch).
–– α controls the envelope (decay whenever α < 1).
The Karplus-Strong algorithm is a range invented to simulate guitar sounds. It is initialized with a sequence
An interesting generalization
of random numbers. We apply the generalized version of the reversed loop to it, and we can listen to the
output that sounds surprisingly like a guitar. We encourage you to listen to it on the video (15:50/19:42).
x[n] + y [n]
α
z −M
y [n] = α y [n − M] + x[n]
FIGURE 7
11:30 19:42
100
Signal
of the
GOETHE’S TEMPERATURE MEASUREMENT Day
The aim of the “signal of the day” video type is to show you some real-life applications of signal processing,
which will be related to the theory taught in other videos. This video consists in investigating the longest
recorded signal in daily measurements: a series of daily mean temperatures recorded in Jena (Germany).
For convenience, we computed the annual mean daily temperature. We then applied a moving average over
this obtained signal with a window of 25 years: we can observe that the resulting function increases over
time which provides a perfect illustration of the effect of global warming.
RN
BOOCs Digital Signal Processing
12
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
ex exponential
1.4 COMPLEX EXPONENTIALS
e jα = cos α + j sin α
Most elementary and fundamental discrete time signals are oscillations.
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
Mathematically, it is simpler
20 to use a complex exponential than sines
FIGURE 1 and cosines. The complex exponential relies on the unit circle whenever
4:10 14:45
A = 1, as in figure 1.
ex exponential
Spatial representation of a complex exponential
rotation: z′ = z e jα
Let z be a point on the complex plane, and we want to rotate it by α.
We can simply multiply it by a complex number z’ of argument α.
Im
13
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
As linear algebra is a prerequisite for this course, it is important that you understand how a matrix-vector
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
2
As weAddition in Rwith
will be dealing vectors, an important rule is the vector addition rule that you can observe in
figure 1.
T
x + y = x0 + y0 x1 + y1
x+y
3
y
2
1
x
−4 −3 −2 −1 1 2 3 4 5 6 7
−1
FIGURE 1
22
0:30 4:03
As we have four types of signals, it would very complicated to specialize the theory to each of the cases
explained, so we need a common framework: vector space. It is very convenient as it provides the same
framework for different classes of signals and also for continuous-time signals. Vector spaces are very
general objects; they are defined by their properties (not by the shape of the vectors they contain), and
once these are satisfied, we can use all the tools of the space.
RN
BOOCs Digital Signal Processing
14
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Here, the key point is that vectors can be arbitrarily complex entities, such as functions. And this will be very
useful in unifying our approach to signal processing.
Note that some spaces can be represented graphically (R 2, R 3) and others cannot (R N for N > 3). What all
these vectors spaces have in common is that they obey a set of axioms that define the properties of the
vectors and what we can do with these vectors.
The inner product (dot product) provides an additional operation to measure and compare vectors. It takes
a couple of vectors and returns a scalar:
It measures the similarity between two vectors; if the inner product is zero, then the vectors are orthogonal
(maximally different). It is also defined axiomatically:
RN
BOOCs Digital Signal Processing
15
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
We know that finite-length and periodic signals live in C N, a vector x is denoted by [x0 x1 ... xN–1]T, all
operations are well defined, and the space of N-periodic signals is sometimes indicated by C
e N.
For infinite-length sequences, we will define the vector space of square-summable sequences l2(Z) to avoid
the “explosion” of the sum:
Now, let us talk about completeness: if a vector space is closed under the limiting operation, we say that
the vector space is complete, which will be useful to prove some fundamental results such as the sampling
theorem. When a vector space equipped with an inner product is also complete, we call the vector space a
Hilbert space.
RN
BOOCs Digital Signal Processing
16
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
2.3 BASES
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
The axioms of a vector space tell us how to combine vectors together. A linear combination of vectors is the
basic operation that we perform in vector spaces:
When we combine vectors together to obtain new vectors in the space, one usual question is whether we
can find a minimal set of vectors {w(k)} so that we can express any vector in the space as a linear combination
of this base factor. This set of building blocks will be called the bases. Here is an example: the canonical
basis for the Euclidean plane (canonical R2 basis):
It is possible to find a basis for infinite-dimensional spaces and for function vector spaces. An infinite number
of bases exists for these spaces. For functions, one of the most famous is the Fourier basis, where for [–1,1]:
Now let us give you a formal definition of a basis for a vector space H: let W be a set of K vectors such that
W = {w(k)}k=0,1,...,K–1, W is a basis for H if:
17
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
A frequent question is how to find the coefficients: if the basis is orthonormal, this is the direct computation:
Also, this is how to find the new coefficients when a change of basis is made:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
RN
BOOCs Digital Signal Processing
18
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
A vector subspace is a subset of vectors closed under addition and scalar multiplication. We can extend the
concept of subspace to more complicated vector spaces such as function vector spaces. Subspaces have
Approximation
their own bases.
x e(2)
Problem:
vector x ∈ V
subspace S ⊆ V
approximate x with x̂ ∈ S
e(0)
x̂ e(1)
69
FIGURE 1
2:18 16:18
Consider an orthonormal basis {s(k)}k=0,1,...,K–1, for the subspace S. The orthogonal projection of a vector x onto
this subspace is defined by:
The orthogonal projection is the best approximation for a given vector x onto the given subspace S. It has
two fundamental properties:
–– The orthogonal projection has minimum-norm error:
–– Its error is orthogonal to the approximation:
If we apply the Gram-Schmidt procedure to the set of polynomials PN([–1,1]) we obtain a set of orthonormal
polynomials called the Legendre polynomials, which are very useful for function approximations.
RN
BOOCs Digital Signal Processing
19
LEA ER,
S
FA RN
T Paolo Prandoni
Legendre EPFL
LEA ER!
BET
T Polynomials and Martin Vetterli
1
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
−1
−2
-1
−1 0 1
FIGURE 2
79
12:50 16:18
Legendre polynomials
Signal
of the
EXOPLANET HUNTING Day
Looking at an image of the universe taken by the space telescope Hubble, the universe contains an estimated
100 billion galaxies, each containing hundreds of billions of stars. Thus there is a very high likelihood that
another star planet system exists, comparable to our solar system. We are going to study a method for
finding exoplanets: the transit method. As the planet transits in front of its star, the observer measures the
reduction in the flux of light. It can be shown that the relative change in the flux is equal to the ratio between
the radius of the planet and the radius of the star to the square: it is called the transit depth. We can adopt
another point of view and use a CCD camera to measure the amount of light (technically the amount of
photons) from the star that reaches the observer. This is where Digital Signal Processing comes into play.
For further information, you will have to follow a course on statistical signal processing.
RN
BOOCs Digital Signal Processing
20
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The goal of the discrete Fourier transform (DFT) is to express a signal in terms of its sinusoidal components.
Every sustainable dynamic system exhibits an oscillatory behavior, which is easy to describe and
parameterize. From the analysis point of view, the Fourier transform basically changes from the time domain
to the frequency domain. A signal is decomposed into different frequencies, which reveals hidden signal
properties. The converse of this process is to revert from the frequency domain to the time domain and
synthesize a signal from its frequency components. We can use that to generate signals that have a known
frequency content, which can in turn be used in signal processing to fit signals to specific frequency regions.
For a finite-length signal, the Fourier analysis is simply a change of basis. The Fourier basis for CN is the
following:
As an example, we will study w(3); the fundamental frequency of this vector will be 2π/3, so we have three
periodsBasis
both on the realwand
vector (3) imaginary
∈ C64 axes.
1
Re
−1
0 32 64
1
Im
−1
0 32 64
49
FIGURE 1
5:29 10:49
Example of w (3)
RN
BOOCs Digital Signal Processing
21
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
As we go up with the basis index, the vectors start moving faster. As we increase the index of the Fourier
vector, the underlying frequency increases as well. Because of the discrete nature of the signal, it sometimes
might be hard to understand the signs of the shape of the signal. A tell-tale sign of high frequency is a sign
alternation. This constitutes a set of orthogonal vectors in n and can be proved by simple calculus: the inner
product.
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
8
N
X −1 N
X −1 >
<N for h = k
2⇡ 2⇡ 2⇡
< w(k) , w(h) >= (ej N nk )⇤ ej N nh = ej N (h−k)n = 1 ej2⇡(h−k)
>
: = 0 otherwise
n=0 n=0 2⇡
1 ej N (h−k)
How do we solve the last sum? When h = k, we take the inner product of a vector with itself. All the elements
in the sum will be equal to 1, so the sum will converge to N. When h ≠ k, then it is a type
p a series. Note that
N
they are not orthonormal, we will have to normalize the vectors, dividing them by N .
RN
BOOCs Digital Signal Processing
22
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Given the arbitrary element of n, the analysis formula will give us N new coefficients for the vector in the
new basis, each of which will be denoted by X[k]; the synthesis formula will allow us to retrieve the original
vector in the canonical basis.
We can express the change of basis in matrix notation. The Hermitian operator is a combination of
transposition and conjugation of each element of the matrix.
A third way of looking at the DFT is to explicitly consider the operations involved as a sum:
RN
BOOCs Digital Signal Processing
23
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The DFT is a linear operator. DFT of the delta signal: the delta signal will isolate the 0-component of each
basis vector, so the product will be 1 for all the values of the index k. So the Fourier transform of discrete
time delta is constant 1.
N−1
2π
nk
X [k] = δ[n] e −j N
n=0
=1
1 1
0 0
0 15 0 15
23
FIGURE 1
0:3013:37
N−1
2π
nk
X [k] = e −j N
n=0
= Nδ[k]
1 16
0 0
0 15 0 15
24
FIGURE 2
1:00 13:37
DFT of a sinusoidal function of frequency multiple of 2π /N: one trick is to decompose the sines and cosines into
exponentials (using Euler’s formula), which then will correspond to a vector of our basis. Here is an example:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
A clear way to plot a Fourier transform is to plot both the magnitude and phase of the Fourier coefficients.
DFT of the step vector: from the following calculus, we can see that X[0] = M, W[k] = 0 is Mk/N is an integer
and that the phase of X[k] is linear (except at time changes), leading to the plot on the following figure 3.
DFT of length-4 step in C64 DFT of length-4 step in C64 (phase wrapped)
|X [k]|
|X [k]|
0 32 64 0 32 64
0 π
−π
∠X [k]
∠X [k]
−2π 0
−3π
−4π −π
0 32 64 0 32 64
38
FIGURE 3
12:20 13:37
Often, the phase displayed is wrapped over [–π, π], adding or subtracting 2π.
RN
BOOCs Digital Signal Processing
25
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
We have frequency coefficients from 0 to N – 1: for example, the first N/2 coefficients correspond to frequencies
less than π – counter-clockwise movement, the other N/2 coefficients correspond to frequencies more than
π – clockwise movement. Low frequencies are around 0 and N – 1, whereas high frequencies are around N/2.
|X [k]|
0 N/2 N −1
0:20 4:58
41
Interpreting a DFT plot
|X [k]|
0 N/2 N −1
0:30 4:58
41
Interpreting a DFT plot
|X [k]|
0 N/2 N −1
FIGURE 1c
41
0:45 4:58
The DFT of real signals is symmetric in magnitude. In discrete-time, we have two situations in function of
the parity of the signal. We say that the magnitude of the kth coefficient will be equal to the magnitude of
DFT
the (N – k)thof real signals
coefficient.
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
0 1 2 3 4 0 1 2 3 4 5
FIGURE 2 47
4:00 4:58
27
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The presence of spikes on the DFT plot indicates a strong sinusoidal component. More importantly, the
sinusoidal component has a frequency that is a multiple of the basic frequency for the space that the signal
lives in.
The DFT coefficient for k = 0 is a non-normalized average of all the data points. The period of the signal
can be found by dividing the number of points N by the index corresponding to the main peak. The fastest
positive frequency is π. So, two samples are required to complete a full revolution. Now, the clock Ts can
also be expressed as 1/Fs, where Fs is the frequency of the system. This is the standard relationship between
period and frequency for any system. So, if the real world for the fastest sinusoid in a digital system is 2Ts
measured in seconds, the real world frequency for the fastest sinusoid is Fs/2. Therefore the maximum
frequency once the period between samples has been determined is Fs/2 or equivalently 1/2Ts.
Harmonics are what actually give the timbre of the instrument. For a signal of frequency w, we say that
the harmonics are the multiples of w. We will look at the Fourier spectra of three instruments: the cello,
saxophone, and violin (fig.1). A mathematical method to help us differentiate those three sounds from one
another and guess at the frequency is to use the DFT over a few periods (fig. 2). The spectra look different
but the peaks are at the same places, because the frequency played is 220 Hz and the harmonics are
multiples of 220.
FIGURE 1
2:02 4:41
FIGURE 2
2:50 4:41
Now let’s look at the sinusoidal generator. We have a complex exponential with a frequency, which is a
multiple of 2π/N and has an initial phase. The way this generator works is by successively generating points
on the unit circle starting at the phase and proceeding in increments of 2π/N.
Im
2π k
wk [3] N
Re
3
FIGURE 1
0:20 5:46
Sinusoidal generator
RN
BOOCs Digital Signal Processing
29
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The DFT synthesis formula can be imagined as a machine composed of N sinusoidal generators, each of
which is initialized with a gain and phase factor. All their outputs will be summed together, which will give
us the original signal back.
A0 ∼ 0
φ0
A1 ∼ 1
φ1
2π
Ak ∼ k Ak e j( N kn+φk )
φk A2 ∼ 2 + x[n]
φ2
...
AN−2 ∼ N−2
φN−2
AN−1 ∼ N−1
φN−1
4
FIGURE 2
1:14 5:46
What happens if we turn the crank of the machine more than N times? The output will become periodic.
x[n + N] = x[n]
This is actually quite apparent from the structure of the synthesis and analysis formulae of the DFT. Let’s
start with the synthesis formula. The complex exponential is 2π periodic, so if you push n over N – 1, this
will simply cycle over, as if N was looping over the 0 to N – 1 range. So in the end, you can actually safely
take N to be from the set of integers and the output will be an N-periodic signal in a time domain. The same
holds for the analysis formula. You can let the index, k, roam over the entire set of integers. And since it
appears only in this complex exponential here, again, it will be as if k was looping over the 0 to N – 1 range.
So what really happens is that you can consider the sequence of DFT coefficients as an N-periodic signal in
the frequency domain.
RN
BOOCs Digital Signal Processing
30
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Tides are periodical phenomena. We will try to find out whether we can predict tides using Fourier transforms.
Using Fourier coefficients we can recover a signal very close to the original one and thus continue further
than the original data set, predicting what is going to happen in the future.
FIGURE 1
1:18 4:10
Data set
FIGURE 2
1:41 4:10
FIGURE 3
4:00 4:10
31
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Compression introduces noise and loss, so why can’t we hear it on an MP3 record? Because this noise has
been shaped to fool the human hearing system. One of the key elements of the compression algorithm is to
shape errors adaptively as the Fourier transform spectrum varies, constantly adapting using the short time
Fourier transform domain. The idea is essentially a local DFT.
Signal
of the
THE FIRST MAN-MADE SIGNAL Day
FROM OUTER SPACE
Sputnik was the first artificial Earth satellite, launched by the Soviet Union on October 4, 1957. Its main
spherical body was surrounded by four external radio antennae, which transmitted a signal. This signal was
thus the first man-made signal sent from outer space. Amateur radio operators could detect the signal from
all over the world. The transmitted signal was just a sequence of beeps. If we plot the magnitude of the
Fourier transform of the signal transmitted by Sputnik, there is a large component at ω = 0. We can also
observe two small peaks, which correspond to the frequency of the transmitted beeps. We see that the two
peaks now appear at 1653 Hertz and –1653 Hertz.
RN
BOOCs Digital Signal Processing
32
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Dual-Tone Multi Frequency dialing signaling is a method used in analog telephones. For each button press,
we generate a sinusoid composed of two frequencies taken from a specific matrix. This is done to minimize
the error whenever someone tries to recover the sequence of numbers dialed on an analog phone. When
we take the DFT of these signals, the frequencies associated with each number will appear, but we cannot
tell in which order the numbers have been pressed. The idea behind the short-time Fourier transform is
to take small pieces of the original signal in order to localize in time the results obtained on the Fourier
transform. We move the analysis window.
The spectrogram is a way of showing time-varying spectral information in one single plot. We color-code
the magnitudes: dark hues correspond to small values and light hues correspond to high values. We use the
logarithm of the magnitude in order to compress the range of values. We put the spectral slices one after
DTMF spectrogram
another in order to get an image like the following image (fig. 1). On the vertical axis, we place the DFT
coefficients.
L/2
k
0
0 N
m
FIGURE 1
1:17 7:41
77
DTMF spectrogram (analog telephone example, 3.4.a)
33
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Speech is a particularly difficult signal to analyze. The idea is to split the signals.
0 2.5s
Play
FIGURE 1
85
0:55 5:31
Spectrograms can be useful for getting information: narrow-band spectrograms give us information on the
harmonic parts of speech and wide-band spectrograms give us information on the pulse-like and noise-like
consonant sounds in speech.
The short time Fourier transform determines a tiling of the time-frequency plane, where the size of each tile
is specified by the time and frequency resolution of the STFD.
RN
BOOCs Digital Signal Processing
34
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
When we talk about the periodicity of the Fourier transform, we refer to the Discrete Fourier Series (DFS).
The DFS is basically the DFT with periodicity explicit. The DFS maps an N-periodic signal onto an N-periodic
sequence of Fourier coefficients, and the inverse DFS maps an N-period sequence of Fourier coefficients
onto an N-periodic signal. If we take the DFS of this periodic sequence with a shift, we can easily work
out that the DFT coefficient for index k is equal to the DFT coefficient for index k of the original sequence
without the shift. The DFS helps us understand how to define time shifts for finite-length signals.
35
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
An N-periodic sequence has only N degrees of freedom. The DFS provides us with a sequence that only has
N distinct Fourier coefficients.
x[n] + y [n]
α
z −M
y [n] = α y [n − M] + x[n]
FIGURE 1
0:22 7:54
Karplus-Strong circuit 22
Consider a finite-length signal of length M. What happens if we take the DFT of two periods of a finite-
length signal? The DFT is the same as if it were one period with extra 0-valued coefficients. Let’s generalize
this case by taking L periods, and let y be that signal. Let’s calculate its DFT:
L
(
X1 L, if k multiple of L
j 2⇡
L pk
e =
p=0
0, otherwise
Moreover, these nonzero coefficients are just scaled versions of the DFT coefficients of the original finite-
length sequence. Therefore, all the spectral information of an N-periodic sequence is entirely captured by
the DFT coefficients of one period.
RN
BOOCs Digital Signal Processing
36
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
How do we calculate the Fourier transform of infinite non-periodic signals? We can use the Karplus-Strong
algorithm simply by putting the factor alpha to less than 1 and then compute its DFT. As N goes to infinity,
the frequency becomes smaller, and the set of frequencies in the [0, 2π] range becomes denser. In the limit,
the set of multiples of the fundamental frequency 2π/N will become so dense that we will try to replace
this by a real valued variable frequency. And this real valued variable will last for the [0, 2π] interval. So if we
replace that in the formulation for the DFT, we now get a sum over all the points in the signal.
Here is a definition of the Discrete-Time Fourier Transform: the signal needs to be square summable (finite
energy).
F(ω) is 2π-periodic. To stress its periodicity, we will write F(ω) as X(e jω), reminding us that it is 2π-periodic.
We choose [–π, π] interval as the representative interval.
The factor M in the exponent simply implies that there is scaling of the frequency axis.
So here we have derived the DTFT, namely the spectrum of an infinite non periodic signal that is not a trivial
signal. Now so far we have treated the DTFT as a formal operator. And in the next module we will see how
the DTFT relates to the concept of change of basis in an appropriate Hilbert space.
RN
BOOCs Digital Signal Processing
37
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Existence means that the sum defining the DTFT does not explode. Our initial hypothesis is that our signal
is absolutely summable.
The inversion of the integral and the sum is possible because x is absolutely summable.
Formally, the DTFT is a change of basis over an infinite, uncountable basis. The DTFT exists for all square-
summable sequences.
Review: DFT Review: DFS
DTFT
2π 2π
X [k] = ⟨e j N
nk
, x[n]⟩ X̃ [k] = ⟨e j N
nk
, x̃ [n]⟩ X (e jω ) = ⟨e jωn , x[n]⟩
2π 2π
CN basis: {e j N
nk
}k CN C̃N basis: {e j N
nk
}k CN ℓ2 (Z) “basis”: {e jωn }ω L2 ([−π, π])
X (e jω )e jωn dω
2π 2π x[n] = (1/2π)
X [k] e j nk
X̃ [k] e j nk
x[n] = (1/N) N x̃[n] = (1/N) N
69
FIGURE 1 70
4:10 7:10
The DFT of the constant 1 is very well defined, and is equal to N times the delta function in frequency. But
the DTFT of 1 is, by definition, the sum from n goes from – ∞ to + ∞ of e–jwn, at w = 0, and that sum diverges.
This is because the unit sequence is not square summable, as are many other interesting signals. We will
thus introduce the Dirac delta function.
Graphical representation
The area under this curve is equal to 1, as it is basically the function limk → inf k · rect(kt). We will be using the
Dirac delta function in the frequency domain; as all DTFT spectra are 2π periodic, and so to use this tool in
the frequency domain, we have to periodize it: its 2π-periodic version is called a pulse train.
FIGURE 1
6:04 9:48
Z ⇡ Z ⇡
1 j!n
15
IDTFT{δ̃(!)} = δ̃(!)e d! = δ(!)ej!n d! = ej! |!=0 = 1
2⇡ ⇡ ⇡
• DTFT{1} = δ̃(ω)
• DTFT{ejω0 n } = δ̃(ω − ω0 )
• DTFT{cos(ω0 n)} = [δ̃(ω − ω0 ) + δ̃(ω + ω0 )]/2
• DTFT{sin(ω0 n)} = −j[δ̃(ω − ω0 ) − δ̃(ω + ω0 )]/2
RN
BOOCs Digital Signal Processing
39
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
There are three broad categories of signals, in both discrete and continuous times, according to where the
spectral energy mostly concentrates:
–– Lowpass signals (a.k.a. “baseband” signals): the energy is mostly concentrated around 0 and there is no
energy outside.
–– Highpass signals: the energy is mostly concentrated around pi and –π and there is no energy around 0.
–– Bandpass signals: the energy is mostly concentrated around –π/2 and π/2.
Let’s now consider a sinusoidal modulation, which is done by multiplying a signal by a cosine:
Example Example
⇢ �
1 j!c n 1 j!c n 1
DTFT{x[n]cos(!c n)} = DTFT e x[n] + e x[n] = [X(ej(! !c ) ) + X(ej(!+!c ) )]
2 2 2
−π 0 π −π −ωc 0 ωc π
FIGURE 1
Careful when the modulation frequency is too large! Careful when the modulation frequency is too large!
2:45 7:06
Example of demodulation 58
FIGURE 2
3:32 7:06
Now we are going to see a real application: tuning your guitar. The abstraction of the problem is that you
have reference sinusoid at a frequency ω0. You have a tunable sinusoid of frequency ω. And we would like
to make ω and ω0 as close as possible, simply by listening to it. What we are going to do here is to beat
between these two frequencies once they are close enough. And then by tuning, we can bring this beating
to frequency zero: ω = ω0. And we have tuned our guitar string with respect to a reference frequency.
First, we bring ω close to ω0. When these two frequencies are close, we play both sinusoids together. We
write x[n] as a sum of both cos(ω0n) and cos(ωn). An error signal will appear: the cos(∂[ωn]). When ω is close
to ω0, the error signal occurs at very low frequency. Because it’s at such a low frequency, we cannot really
hear it. So modulation will it bring up to hearing range. And we’ll actually be able to hear it as an oscillation
of the carrier frequency.
An electric bass has an E-string frequency of 41.2 Hertz and an A-string frequency of 55 Hertz. We usually
use these two harmonics for tuning.
Signal
of the
TRISTAN CHORD Day
The Tristan Chord is the first chord in Wagner’s opera Tristan und Isolde. It first appears in the introductory
bars of the opera’s prelude. It is dissonant and does not sound pleasing to the ear. We will apply the fast
Fourier transform to this chord to analyze its frequency components. From this analysis we see that there
are many components: there is an F3, a B3, a D4 sharp, and a G4 sharp, and there appears to be an F4,
which is a regular octave, but also B4. Now that we know the frequency components of this chord we can
try to synthesize it, using, for example, the Karplus-Strong algorithm we have studied during lectures.
RN
BOOCs Digital Signal Processing
41
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
We say that H is linear if the output of a linear combination of inputs is equal to the linear combination of
the outputs:
We say that H is time-invariant if the system will behave in exactly the same way independently of when it
is switched on:
H{x[n – n0]} = y[n – n0]
The system H is causal if it can only have access to input and output values from the past: the output is a
linear functional of past values of the input and past values of the output.
4.1.b CONVOLUTION
The impulse response h[n] fully characterizes an LTI system: h[n] = H{∂[n]}.
First, we time-reverse the impulse response. And at each step, from –infinity to +infinity, we center the
time-reversed impulse response in the current sample n, so as to shift the time-reversed equal response by
minus n. And then we compute the inner product between this shifted replica of the impulse response and
theexample
Convolution input sequence. Convolution example Convolution example
4 4 4
x[k]
x[k]
x[k]
2 2 2
0 0 0
−8 −4 0 4 8 12 16 20 −8 −4 0 4 8 12 16 20 −8 −4 0 4 8 12 16 20
h[n − k]
h[n − k]
h[n − k]
1 1 1
0 0 0
−8 −4 0 4 8 12 16 20 −8 −4 0 4 8 12 16 20 −8 −4 0 4 8 12 16 20
6 6 6
4
y [n]
4
y [n]
4
y [n]
2 2 2
0 0 0
−8 −4 0 4 8 12 16 20 −8 −4 0 4 8 12 16 20 −8 −4 0 4 8 12 16 20
20 20 20
FIGURE 1
4:30 6:40
Example of convolution
RN
BOOCs Digital Signal Processing
42
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Convolution properties:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
Signal
of the
CAMERA RESOLUTION Day
AND SPACE EXPLORATION
The Rosetta spacecraft was launched about ten years ago by the European Space Agency with the mission of
reaching the comet Churyumov–Gerasimenko. This comet is also known with the more technical name 67P.
Rosetta managed to send back to Earth increasingly detailed pictures of the comet as it got progressively
closer to it. As Rosetta approached the comet, the quality of the pictures progressively improved. From that
example we can see that resolution is not limited by pixel density: resolution is limited by diffraction. You
might be surprised to learn that the resolution of Rosetta’s camera is only about four megapixels.
RN
BOOCs Digital Signal Processing
43
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
This formula can helps us to average a noisy output. The moving average filter is based on this, as h[n] =
H{∂[n]}:
The smoothing effect of the filter i proportional to the length of the impulse response, M. As a consequence,
the number of operations and the storage are proportional to M.
1/M
0
0 M −1
FIGURE 1
3:34 8:05
1−λ
0
0 15 30
FIGURE 1
36
3:46 5:19
45
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
According to the shape of its impulse response, we can label a filter as belonging to one of the following
categories:
–– Finite Impulse Responses (FIR): their impulse response has a finite support, only a finite number of samples
are involved in the computation of each output sample, e.g., moving average filter.
–– Infinite Impulse Responses (IIR): their impulse response has an infinite support, hence potentially an infinite
number of samples involved in the computation of each output sample, e.g., leaky integrator filter.
–– Causal: their impulse response is zero for n < 0, only past samples are involved in the computation, e.g.,
moving average filter.
–– Noncausal: their impulse response is nonzero for some n < 0, e.g., zero-centered moving average filter.
Stability guarantees that the system will not behave unexpectedly if the input of the system is well-behaved,
i.e., a bounded input. The concept of Bounded-Input Bounded-Output (BIBO) Stability requires that a system
produces a bounded output when the input is bounded.
FIR filters are always stable, because their impulse response only contains a finite number of nonzero values,
and therefore the sum of their absolute values will always be finite. On the other hand, when it comes to IIR
filters, we have to explicitly check for stability.
RN
BOOCs Digital Signal Processing
46
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
LTI filters cannot change the frequency of sinusoids. The DTFT of the impulse response fully determines the
frequency characteristic of a filter.
47
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
In general, if H(ejω) = A(e jω)e–jωd, it means that the filter operates by combining the action of a zero phase.
Therefore a zero delay component
Moving Average, only affects theresponse
magnitude magnitude of the input, followed by a delay of these samples.
1
sin( ω M )
|H(e jω )| = M
2
sin( ω2 )
1 M=9
|H(e jω )|
0
−π −π/2 0 π/2 π
FIGURE 1
64
0:26
Linear phase 14:13
Magnitude of MA DTFT
x[n] D x[n − d]
y [n] = x[n − d ]
Y (e jω ) = e −jωd X (e jω )
H(e jω ) = e −jωd
linear phase term
FIGURE 2
Linear-phase term
1
λ = 0.9
|H(e jω )|
0
−π −π/2 0 π/2 π
FIGURE 3
9:49 79 14:13
We can classify filters according to four broad categories based on the shape of their magnitude response:
–– Lowpass filters are filters that let the low frequencies live and kill everything else.
–– Highpass filters do the opposite. They let high frequencies go through and they kill low frequencies, in
particular frequencies around zero.
–– Bandpass filters only let a band of frequencies go through in the middle of the frequency band.
–– Allpass filters are filters for which the magnitude is a constant over the entire frequency band.
The magnitude of the ideal lowpass filter would be 1 over the passband, a perfectly flat passband, and
identically 0 over the stopband and an infinite attenuation over the stopband. To make matters even better
we would require the magnitude response to be a real function so that the filter has zero phase and therefore
introduces no delay.
What isBOOCs
RN Digital Signal Processing
49
LEA ER,
S
FA RN
T Paolowe
the best lowpass Prandoni
can think of?
LEA ER!
BET
T EPFL and Martin Vetterli
ωb = 2ωc
1
H(e jω )
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
0
−π −ωc 0 ωc π
FIGURE 1
ωc /π
−20 −10 0 10 20
FIGURE 2
2:56 6:50
7
This impulse response results in a problem, as it has an infinite support in both directions, which means that
it cannot be implemented in practice. Also, as it decays very slowly in time, it requires too many samples.
(
1, |x| 1/2
rect(x) =
0, |x| > 1/2
8
< sin(⇡x) , x 6= 0
sinc(x) = ⇡x
:
1, x = 0
The sinc function is not absolutely summable, which means that the ideal filter is not BIBO stable.
RN
BOOCs Digital Signal Processing
50
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
1
H(e jω )
0
−π −ωc 0 ωc π
FIGURE 1
1
H(e jω )
0
−π −ω0 0 ω0 − ωc ω0 ω0 + ωc π
FIGURE 2
1:15 18 2:34
The bandpass filter is actually a demodulation of the lowpass filter seen previously, meaning the following:
RN
BOOCs Digital Signal Processing
51
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
In the previous module, we applied sinusoidal modulation to an input signal x[n] to obtain y[n], which is
equal to x[n]·cos(w0n). And we tried to demodulate the modulated signal by multiplying the modulator
signal, again by the carrier, cos(w0n). And we found that the demodulated signal contained unwanted high
frequency components that, at the time, we did not know how to remove.
Now we can modulate it, obtain two copies at half the amplitude, multiply it again by cos(w0n), and apply a
Demodulation revisited
lowpass filter as follows in figure 1. Demodulation revisited
X (e jω ) Y (e jω )
0 ω0 π 2π 3π 4π
Demodulation
−π
revisited 0 Demodulation
π −4π
revisited
−3π −2π −π−ω0
X ′ (e jω ) X ′ (e jω )
22
ω0 ω0 ω0 ω0
Solution: lowpass
−4π filtering
−3π −2π −π−ω0 0 ω0 π 2π Solution:
3π 4π lowpass
−4π filtering
−3π −2π −π−ω0 0 ω0 π 2π 3π 4π
X ′ (e jω ) X ′ (e jω )
23
−π 0 π −π 0 π
FIGURE 1
Revisited demodulation
RN
BOOCs Digital Signal Processing
52
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
he idea is that we could approximate an ideal lowpass filter by truncating the impulse response to make it
a finite support impulse response.
But the reason why this would not be a good idea is because it looks as though the maximum error near
the transition point for the frequency response never really goes down in spite of the number of points that
we used for the approximation. We can prove mathematically that the maximum error around the cutoff
frequency is about 9% of the height of the jump, regardless of the number of points. This is known as the
Gibbs phenomenon.
Signal
of the
IS IT POSSIBLE TO HEAR Day
THE SHAPE OF A ROOM?
We will investigate how sound propagates in a room between a sender, or a loud speaker, s, and the
receiver, or a microphone, r. Every time a sound hits the wall, part of the sound is reflected in such a way
that the incident angle equals the reflection angle. These angles are defined with respect to the normal of
the walls. Sound propagation is a fairly complex phenomenon involving the superposition of a signal and its
different echoes, and means that the derivation of a model might not be very simple. Nevertheless, in room
acoustics, sound levels are low, and so the linear model is a good approximation. The question is whether
we can reconstruct the shape of a room using only echoes. We experimented with this in our lab for two
different shapes of rooms and obtained quite accurate results.
RN
BOOCs Digital Signal Processing
53
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The impulse truncation can be interpreted as the product of the ideal filter response and a rectangular
window of N points. From the modulation theorem, the DTFT of the product of two signals is equivalent to
the convolution of their DTFTs:
Z ⇡
j! 1
IDTFT{(X ? Y )(e )} = (X ? Y )(ej! )ej!n d!
2⇡ ⇡
Z ⇡ Z ⇡
1
= X(ejσ )Y (ej(! σ) )ej!n dσd!
(2⇡)2 ⇡ ⇡
Z ⇡ Z ⇡
1
= X(ejσ )Y (ej(! σ) )ejσn ej(! σ)n dσd!
(2⇡)2 ⇡ ⇡
Z ⇡ Z ⇡
1 jσ jσn 1
= X(e )e dσ Y (ej(! σ) )ej(! σ)n d!
2⇡ ⇡ 2⇡ ⇡
= x[n]y[n]
Hence, the choice of window influences the quality of the approximation results. The window method is just
a generalization of the impulse truncation method, where we use a different window shape. For example,
by using a triangular window, we reduce the Gibbs error at the price of a longer transition.
The idea here is to say, what if we draw the desired frequency response in the frequency domain. Then we
sample this frequency response at regularly spaced intervals and calculate the IDFT of these values – the
inverse DFT. We can always do this for a finite set of frequency points and use the result as an M-tap impulse
response hat h[n].
The interpolator turns out to be, once again, the transform of an N-tap rectangular window. So we’re not
really escaping from the indicator function that we used in the impulse truncation method. And, because of
that, we have no control over mainlobe and sidelobes of the interpolator.
These are good methods to be familiar with in order to quickly try something out when we are faced with
a filtering problem. But they are definitely not optimal and they leave a lot be desired in terms of the fine
control that we can have over the maximum error.
RN
BOOCs Digital Signal Processing
54
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
As ideal filters cannot be implemented, we want to figure out what is the most realizable LTI transformation.
How do we compute the frequency response of such an equation?
The tool we will use is called the z-transform. z-transform is a formal operator that maps the discrete type
sequence x(n) onto a function of the complex variable z, defined as follows:
Whenever we evaluate the z-transform in z = e jw it becomes the DTFT. Two key properties of the z-transform
are linearity and time-shifting:
Also:
RN
BOOCs Digital Signal Processing
55
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
al systems
4.7.b REGION OF CONVERGENCE AND STABILITY
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
Re
+
FIGURE 1
3:20 7:57 23
From the definition of the transfer function we can obtain the following:
–– The zeros (resp. the poles) are the roots of the numerator (resp.
denominator) of the rational transfer function.
–– The region of convergence is only determined by the magnitude of
the poles.
–– The z-transform of a causal LTI system extends outwards from the
largest magnitude pole.
–– An LTI system is stable if its region of convergence includes the unit
circle.
This last condition in particular offers a simple method for studying the
stability of LTI systems.
Estimating the frequency response
|H(z)|
Consider a filter with impulse response h[n]:
+
Re Im
The shape of the frequency response will be the level curve computed
around the unit circle of the rubber sheet.
32
FIGURE 2
5:31 7:57
We can derive simple filters from known structures. In general, with low order systems, it is possible to
analyze and predict their characteristics from their pole zero plot. Furthermore, to obtain a real filter, poles
and zeros are added in complex conjugate pairs. More especially, we have studied the following filters.
–– The resonator that selects one specific frequency ω0. It is derived by shifting the passband of a leaky
integrator to ω0 (fig. 1).
–– The DC (Direct Current) notch that removes the direct current component. It contains a zero at z = 1 (i.e.
ω = 0) and a pole at λ < 1. DTFT equal to 0 at ω = 0 (fig. 2).
–– The hum removal that removes a specific frequency ω0. It is a DC notch whose stopband is shifted to a
particular
Resonator, λ = 0.9,frequency
ω0 = π/3 ω (fig. 3).
0
Resonator, filter structure
1 G0
x[n] + y [n]
|H(e jω )|
0 z −1
−π −2π/3 −π/3 0 π/3 2π/3 π
2λ cos ω0
π
+
∠H(e jω )
z −1
−π
−|λ|2
−π −2π/3 −π/3 0 π/3 2π/3 π
FIGURE 1 61 60
x[n] + + y [n]
|H(e jω )|
1
z −1
λ −1
0
−π −π/2 0 π/2 π
FIGURE 2
69
6:30 10:03
65
x[n] + + y [n]
1
z −1
|H(e jω )|
2λ cos ω0 −2 cos ω0
+ +
0 z −1
−π −π/2 0 π/2 π −|λ|2
FIGURE 3 74
73
9:30 10:03
57
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
We are interested in realizable filters, therefore our final design will be expressed in the form of a rational
transfer function.
Our problem is to find the degree of the numerator and of the denominator as well as the coefficients of the
polynomials involved in order to best fulfill the requirements. In general, if we want very small transmission
bands, we need to use a filter of high order. And similarly, if we want small error tolerances, we need a high
order filter. We also must take into account the fact that a high filter order implies more computation and
hence a larger delay.
0
0 ωp ωs π
FIGURE 1
2:40 6 6:24
An important case is what we call the equiripple error, where the error, in this case in the passband, oscillates
between a maximum and a minimum, and the local extrema of the frequency response coincides with the
upper and lower limit of the tolerance region.
RN
BOOCs Digital Signal Processing
58
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
IIR design are translations from known analog design. The routines for calculating them are available in most
DSP numerical packages. From the specifications, a first filter is computed with a certain order N. Then the
filter is tested to verify that it meets the desired requirements. If it is not the case, the procedure is run again
Butterworth
with a higher value of thelowpass example
order 4.9.c FIR design.
N = 4, ωc = π/4
1
|H(e jω )|
0
−π −3π/4 −π/2 −π/4 0 π/4 π/2 3π/4 π
FIGURE 1
16
1:55 3:53
Chebyshev lowpass example
Butterworth lowpass
1
|H(e jω )|
0
−π −3π/4 −π/2 −π/4 0 π/4 π/2 3π/4 π
FIGURE 2
19
2:37 3:53
Chebychev lowpass
RN
BOOCs Digital Signal Processing
59
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
FIR design only exists in discrete-time. In FIR filter design, we only have to determine the coefficients of
one polynomial. In the 1970s, Parks and McClellan devised a procedure to compute an optimal linear phase
and equiripple error both in stopband and passband. The algorithm proceeds by minimizing the maximum
error in the stopband and the passband. FIR are calculated from a list of specifications (frequency response
and ratio of maximum equiripple error between the passband and the stopband). Linearity of the phase is
achieved by designing an impulse response, which is either symmetric or antisymmetric. This procedure is
optimal
Linearin phase
the minimax sense as it minimizes the maximum error.
in FIRs
Symmetric or antisymmetric impulse responses have linear phase
Type II
Type I
Type IV
Type III
FIGURE 1 28
0:56 7:56
A Type I filter is an odd length symmetric FIR, where the taps are symmetric around an index. Type III filters
have an odd number of taps; they are antisymmetric around the center tap, which imposes, of course, the
zero center type. Type II and Type IV filters are symmetric and antisymmetric filters, respectively, both of
which have an even number of taps.
A good way to compare the performance of different filters is to express their magnitude in decibels.
Let G be the maximum magnitude in the passband, the attenuation of the filter expressed in decibels is:
AdB = 20 log10 (|H(e jw)|/G)
Any of these designs can be used to obtain lowpass, bandpass, and highpass filters. Optimal FIR bandpass
and highpass filters can be designed directly with the Parks-McClellan algorithm. You can also design optimal
FIR with piecewise linear magnitude responses.
RN
BOOCs Digital Signal Processing
60
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
During this course, we look at two different views: the analog and digital view. Some examples of applications
in digital worldview are arithmetics, combinatorics, computer science, and digital signal processing, while
some examples of applications of the analog worldview are calculus, distributions, system theory, and
continuous-time electronics. Related to our course we have the following differences between the two:
How do we bridge the gap between those two worlds? The relationship between going from continuous
time x(t) to x as a sequence is called sampling. From x the sequence to x(t) is called interpolation. And we
have to be able to clearly understand at what point we can go from one to the other, when these two are
tightly related, and when they are not faithful images of each other.
We wouldAnaloglike x(t),
LTIour signal, to be a complex function of a real variable and of finite energy (∈ L2(R)). Let
filters
us define the inner product of two complex signals: < x(t), y(t) > = ∫x*(t)y(t)dt, hence the energy of a signal:
||x(t)||2 = < x(t), x(t) >. As discrete-time filters exist, we will now study continuous-time filters.
x(t) H y (t)
y (t) = (x ∗ h)(t)
∞
= x(τ )h(t − τ )d τ
−∞
= ⟨h∗ (t − τ ), x(τ )⟩
FIGURE 1
0:59 5:50
61
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Note the –τ which corresponds to a time-reversal when computing the integral. Regarding Fourier analysis,
there is no maximum frequency Ω. The corresponding formula is thus given by:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
Convolution
This real-world theorem
frequency Ω is important: it is expressed in rad/sec which we can convert to Hertz using the
frequency F computed as F = Ω/2π, the period of the signal will thus be given by T = 1/F = 2π/Ω.
The convolution theorem in discrete time also holds for continuous time: the convolution of two signals in
the time domain corresponds to their multiplication in the Fourier domain.
x(t) H y (t)
FIGURE 2
3:30 5:50
Let us now introduce a new concept: band-limitedness. It means that the Fourier transform of a function
19 x
The interpolation problem seeks to fill the gaps between two samples: how should we do this? First of
all, we have several requirements for interpolation: we have to decide on the value Ts which is the space
between two samples, make sure that x(nTs) = x[n], and make sure that x(t) is smooth. In general, we would
like interpolators to be infinitely differentiable for them to make sense physically. A natural solution for this
would thus be polynomial interpolation. For N point, we will obtain a polynomial of degree N–1. Let IN = [–N,
... , N] and PN be the space of degree-2N polynomials over IN. A basis for PN is the family of 2N + 1 Lagrange
polynomials s.t.:
Signal
of the
FUKUSHIMA Day
On March 11, 2011, after an earthquake and several tsunamis had devastated the northeast coast of Japan,
a multiple core meltdown happened at the Fukushima Daiichi Nuclear Power plant, leading to a substantial
release of radioactive material into the environment.
Due to a general lack of detailed radiation measurement, SafeCast, a citizen science group based in Japan,
started building instruments for geo-localized measurements of radioactivity. The idea behind the project
was to reconstruct a map of radioactivity from these measurements. Instruments were loaned to volunteers
in the field and measurements were carried out by attaching the sensors to cars. The sensors would then
take a measurement of the radiation every five seconds. Therefore, sampling was generally limited to areas
accessible by car. Fairly high measurement levels were observed in some places. This is a typical example
where the location of measurements is constrained by available infrastructure. Since the measurements were
done by car, it was only possible to measure on roads. It would then be necessary to apply interpolation to
get an estimate of the intensity of radiation in areas where no samples were available, such as in forests and
fields. The function so obtained is then resampled on the regular grid and displayed. A decent estimate of
the total radiation field is obtained in this way.
RN
BOOCs Digital Signal Processing
63
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Now, let us assume that infinite differentiability is no longer a requirement. The zero-order interpolation is
the approximation by rect-function:
The interpolation kernel is thus rect(t). Even if it holds, there are discontinuities at some points.
The next type of interpolation is the first-order piece-wise linear interpolation that consists in drawing
straight lines between the samples. It is called the “connect the dots” strategy:
The third-order interpolator is more interesting as its kernel is composed of two cubic polynomials making
it continuous up to its second derivative.
So basically, a common scheme appears in local interpolation based on its kernel ic:
One of the key properties of local interpolation is that the same interpolating function is used independently
of N but the main drawback is the lack of smoothness.
In the limit, local and global interpolation are actually the same as:
A very elegant and powerful formula is thus (the sinc interpolation formula):
RN
BOOCs Digital Signal Processing
64
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The ingredients of a sinc interpolation are a discrete-time signal x[n] with DTFT X(e jω), an interpolation
interval Ts, and the sinc function properly scaled to have zero crossings at multiples of Ts. The result will be
a smooth, continuous signal x(t). What is its spectrum? Here are some key facts about the sinc:
If the samples spread apart, the function becomes slower. If the samples are closer together, the signal
becomes faster. So when you pick the interpolation period Ts, the interpolated signal has only got a band-
limited spectrum where ΩN is π/Ts.
RN
BOOCs Digital Signal Processing
65
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
General case derivations can be found in the book, but for now, let us assume that we will proceed with
Ts = 1 and ΩN = π. The space of π-band-limited functions is a Hilbert space. The set of functions φ(n)(t) =
sinc(t – n) forms a basis for the space. If x(t) is π-band-limited, then the sequence x[n] = x(n) is a sufficient
representation, i.e., if we have the samples x[n], we can perfectly reconstruct x(t), which is the essence of
the sampling theorem. Let us now prove that the sinc function and its shifts by integer are the orthonormal
basis for the π-band-limited space:
Not all band-limited functions are precisely band-limited to [–π,π] – what happens to ΩN band-limited
functions? We will need to rescale those functions by Ts:
We can now conclude on the sampling theorem: for any ΩN-band-limited function x(t), we can define a
sequence x[n] by taking equally-spaced samples every Ts seconds that unequivocally represents this
sequence. In the continuous-time domain, if a signal has a maximum frequency of FN Hertz, it is a sufficient
condition to take samples of at least 2FN H to faithfully represent this function.
RN
BOOCs Digital Signal Processing
67
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Raw sampling is almost the same, the difference here is that we do not need to worry about taking the inner
product before sampling, we just take x(t) every Ts seconds.
x(t) x[n]
FIGURE 1
0:30 5:47
2
Sinc sampling block diagram
Ts
FIGURE 2
0:45 5:47
“Raw” sampling
Now let us analyze the wagon-wheel effect. The continuous-time complex exponential x(t) = e j Ω 0 t is always
18
periodic with T = 2π/Ω0, any angular speed is allowed, and FT{e jΩ0t} = 2π∂(Ω – Ω0), which is band-limited
Aliasing
to Ω0. Taking snapshots at regular intervals of a rotating point is raw sampling. The resulting digital
frequency is ω0 = Ω0Ts n. When Ts < π/Ω0 or ω0 < π, then the rotating point goes the “right”/positive way.
When π/Ω0 < Ts < 2π/Ω0 or π < ω0 < 2π, then the phaser advances in big steps, and it seems like it is
going the “wrong”/negative way. Finally, when Ts > 2π/Ω0, then the phaser has already done a full rotation
added to some other displacement. This effect is called aliasing.
x[n]
x(t) interp x̂(t) =?
Ts Ts
12
FIGURE 3
3:45 5:47
Aliasing
RN
BOOCs Digital Signal Processing
68
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Sampling a Sinusoid
If we want to avoid aliasing we will have to make sure the following is satisfied:
FIGURE 1
0:58 4:03
Sampling a sinusoid
16
What is the spectrum of the raw sampled signals? Let us start by the inverse Fourier transform:
69
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
−ΩN 0 ΩN
X˜c (jΩ)
27
FIGURE 1
7:00 8:25
Xc (jΩ) −ΩN 0 ΩN
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
X˜c (jΩ)
28
FIGURE 2
7:30 8:25
−ΩN 0 ΩN
X˜c (jΩ)
29
FIGURE 3
8:05 8:25
71
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Given a sampling frequency Ts, if the signal is band-limited to π/Ts (or less), then raw sampling is fine,
otherwise,
Sinc we have two choices:
Sampling and Interpolation
–– Band-limit using a lowpass filter in the continuous-time domain before sampling (fig. 1).
–– Raw sample the signal and incur aliasing (which gives a poor-quality sound, so we usually go for the first choice).
t − nTs
x̂[n] = ⟨sinc , x(t)⟩ = (sincTs ∗ x)(nTs )
Ts
t − nTs
x̂(t) = x[n] sinc
n
Ts
x(t) x̂(t)
ΩN Ts Ts
FIGURE 1 31
1:40 4:03
Sinc sampling
Least squares and interpolation
approximation Least squares approximation with sinc sampling and interpolation
with sinc sampling and interpolation
Xc (jΩ)
Xc (jΩ)
Xc (jΩ)
−ΩN 0 ΩN −ΩN 0 ΩN
X˜c (jΩ)
X˜c (jΩ)
−4ΩN −2ΩN −ΩN 0 ΩN 2ΩN 4ΩN −4ΩN −2ΩN −ΩN 0 ΩN 2ΩN 4ΩN
33 3
X (e jω )
33
FIGURE 2
2:50 4:03
Stochastic signals can be described in terms of a probabilistic model. Is it possible to process random
signals? Yes, it is, and we will give an indication of how to deal with such signals as noise.
The frequency-domain representation for stochastic processes is the power spectral density:
A stochastic process is characterized by its power spectral density (PSD). It can be shown that the PSD is
x
(e jω) = DTFT{rx[n]} where rx[n] = E[x[k]x[n +k]] is the autocorrelation of the process x. For a filtered stochastic
process, y[n] = H{x[n]}: Px(e jω) = |H(e jω)|2Px(e jω).
We can model noise as a stochastic signal, where the most important type of noise is white noise. “White”
indicates the independencies of the samples, hence: rW[n] = σ 2 ∂ [n] and PW(e jω) = σ 2 where σ 2 is the variance
of the noise.
Very often we use Gaussian distribution to model the underlying probability distribution function for the
sample. The reason is that Gaussian distribution is the model of choice when we want to represent the effect
of many unknown superimposed sources, as is the case for noise. In this case we call the noise additive white
Gaussian noise, or AWGN for short.
5.5.b QUANTIZATION
Digital devices can only deal with integer values, so we need to map the numeric range of a signal onto a
finite set of values, which leads to an irreversible loss of information. Samples are stored and processed as
Quantization
integers. This operation schemes It maps the numeric range of the discrete samples onto a
is called quantization.
finite set of integers.
• probability distribution
FIGURE 1
4
0:37 9:03
73
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Because of the difference between the actual value and the represented integer, the quantizer introduces
noise into the original signal. We focus on scalar quantizers, that is, ones where samples are quantized
individually and independently.
If the signal is bounded on an interval [A,B], the optimal quantizer is a uniform quantizer where the interval
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
is divided into 2R intervals of equal size. Moreover, if the input signal is uniformly distributed on this interval,
the optimal representation value for each subinterval in terms of minimizing the mean-squared error is
the subinterval midpoint. In this case, the error energy is ∆2/12, ∆ = (B–A)/2R, the signal-to-noise ratio
R
(ratio between the power of the signal and power of the noise) of a uniform quantizer is equal 22 , which
in decibels corresponds to 6R. Of course, we are analyzing a very simple type of quantization over a very
simple class of signals, and quantizers can be designed to be much more complicated than that.
Signal
of the
LEHMAN BROTHERS Day
We are going to look at an application of signal processing to financial data, more specifically, the time
series of stock prices of Lehman Brothers around 2008. Lehman Brothers was a global financial services firm,
and one of the largest investment banks in the US. On September 15, 2008, after more than 150 years of
existence, the firm filed for bankruptcy.
The bankruptcy was just the final act in a series of events that ultimately led up to it. Lehman Brothers was
highly exposed to the US housing market, in particular to a type of loan known as a subprime mortgage.
These loans were typically granted to clients who were not able to afford standard loans due to their limited
financial capabilities. With the burst of the real estate bubble in the US, these clients were the first to default
on their mortgages. This led to huge financial losses for the banks that were exposed to this market. If we
take a look at Lehman Brothers’ stock price at the time around this event (2004–2014), we can observe
a drastic drop at the time of bankruptcy. Evolution of the stock does not exhibit clear patterns. But the
underlying statistical characteristic might be more stable over time. With random signals, certain tools that
we have developed are still valid, such as filtering. But we also need to introduce new tools, which is the
subject of another class on statistical signal processing.
RN
BOOCs Digital Signal Processing
74
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The first one is the DSP paradigm: the fact that DSP works with integers makes signals easy to regenerate,
digital filters allow us to implement a very precise phase control, and we can also seamlessly integrate
adaptive algorithms into a DSP system.
The second success factor for digital communication comes from the algorithmic nature of DSP techniques:
for example, JPEG in image coding where signal processing techniques such as discrete cosine transformation
can be matched to information theory techniques (which involve compression of bit streams).
Finally, the third success factor is related to hardware advancements. Communication devices have become
very power efficient, so we can have large data centers or central offices that process an enormous number
of communication channels in parallel.
The capacity of a channel is the maximum amount of information that can reliably be delivered along it
(usually expressed in bits/seconds). Every analog channel has two inescapable limits: bandwidth and power
constraints, both affecting the final capacity of the channel.
Let us focus on the relationship between bandwidth and capacity. Suppose we are going to transmit
information encoded over a continuous-time channel: we take the samples, interpolate them with a sampling
period Ts, if Ts is very small, then we can send more samples per second but the bandwidth will grow to 1/Ts.
So we see that capacity and the amount of information that we can send per second are related.
Similarly, the relationship between the power constraint and capacity can be appreciated because we can
never do away with noise: as the receiver, we have to guess what has been sent after it has been corrupted
by noise. It is rather intuitive that a signal with a wider range will have more power.
RN
BOOCs Digital Signal Processing
75
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The all-digital paradigm is basically keeping everything digital until we hit the physical channel (using a
Digital-to-Analog converter).
s[n]
..01100
TX D/A s(t)
01010...
Fs = 1/Ts
FIGURE 1
0:103:53
16
Let’s look at the channel constraints
The channel constraints look like a filter design problem: we have a bandwidth that is specified in term of
a maximum and minimum frequency, so we can only operate over this band, and then we have a power
constraint that restricts the power associated to the signal that we produce.
bandwidth constraint
power constraint
0 Fmin Fmax
FIGURE 2
0:49 3:53
Channel constraints
17
Here are some working hypotheses that are common to most transmission systems you will come across.
We start from a bitstream, and we will convert this bitstream into a sequence of symbols or samples a[n] via
a mapper. The mapper associates a groups of bits to a specific symbol. Now, we have to figure out what to
do before converting those symbols into an analog signal: we have to fulfill both the bandwidth and power
constraints. If we assume that the data is randomized (by a scrambler) and therefore the symbol sequence
is a white sequence, we know that the power spectral density is simply equal to the variance, which implies
that the power will be constant over the entire frequency band. To satisfy the bandwidth frequency we will
have to introduce a new concept: upsampling.
RN
BOOCs Digital Signal Processing
76
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
6.2.a UPSAMPLING
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
We need to be able to “shrink” the support to a full-band signal so that it fits on the band allowed by the
channel. We will thus use multirate techniques. In multirate, the main goal is to increase or decrease the
number of samples in discrete-time signal. One way of doing this is to interpolate the digital signal we are
given and resample it at a different sampling rate. However, we want to avoid the transition to discrete time
and we want to perform this artificial change of sampling rate entirely in the digital domain. Let us then
consider the upsampling operation.
FIGURE 1
0:48 7:46
Let Ts = 1,
FIGURE 2
2:45 7:46
77
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
How can we achieve this in the digital domain only? We need to increase the number of samples by K,
obviously the new signal will be built such that xu[m] = x[n] for m being a multiple of K, and insert K – 1
zeros after each sample. Then, moving to the frequency domain, we will apply an ideal lowpass ωc = π/K,
the result in sequence is thus:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
Upsampling by K = 3
1
X (e jω )
0
−π −π/2 0 π/2 3π/4 π
1
X (e jω )
0
−5π −4π −3π −2π −π 0 π 2π 3π 4π 5π
XU (e jω )
0
−π −π/2 0 π/4 π/2 π
24
FIGURE 3
5:00 7:46
In general, if we have an upsampled sequence, we can always recover the original sequence by downsampling.
Downsampling is a more complex operation than upsampling, just as sampling is more complicated than
interpolation. We encourage you to read about multirate signal processing in the book.
RN
BOOCs Digital Signal Processing
78
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
0 Fmin Fmax Fs /2
FIGURE 1
0:00 4:51
Bandwidth constraints
25
Let W = Fmax – Fmin then pick Fs < 2Fmax to avoid aliasing, Fs = KW, where K is a positive integer. In the digital
domain, we can simply upsample the symbol sequence by K so that its bandwidth in the digital domain will
be ωmax – ωmin = 2 π W/Fs = 2 π /K.
Transmitter design, continued
Upsampling does not change the data rate, we produce W symbols per second. W is the fundamental
data rate of the system, it is sometimes called the Baud rate of the system and it is equal to the available
bandwidth.
a[n]
..01100 K↑
Scrambler Mapper
01010...
b[n] s[n]
× D/A s(t)
cos ωc n
FIGURE 2
Raised Cosine
2:07 4:51
0
−π −π/2 0 π/2 π
FIGURE 3
4:00 30 4:51
79
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The transmitter sends a sequence a[n] and the receiver obtains a sequence â[n], but even if there is no
distortion, we cannot avoid â[n] = a[n] + η[n], where η is the noise that corrupts the original sequence. When
the noise is very large, our estimate of the original sequence will be off and we will make a decoding error.
The probability of this error will depend on the power of the noise with respect to the power of the signal
and on the decoding strategy. One way of maximizing our chances at correctly guessing the transmitted
symbols is to use a suitable alphabet of transmission symbols.
Let’s assume we have a randomized bitstream coming in, and we want to send upsampled and interpolated
samples over the channel before transmitting them. How do we go from the bitstream to the samples, i.e.,
how does the mapper work? It splits incoming bitstreams into chunks and assigns a symbol a[n] from a
finite alphabet A to each of them. To undo the mapping operation, and recover the bitstream, the receiver
performs a slicing operation which consists in deciding which symbol is “closest” to â[n] and then piecing
back together the corresponding bitstream.
Let’s assume that the noise and the signal are independent, and that the noise is AWGN with zero mean
and σ0 variance. If we consider the example of a binary sequence sent mapped to {+G,–G}, the two-level
signaling example, the probability of error will be:
From that example, we can see that in order to reduce the probability of error, we should increase the
amplitude of the signal G, which increases the power of the signal. But we also know that we cannot go
above the channel’s power constraint.
Pulse Amplitude Modulation (PAM): the mapper splits the incoming bitstream into chunks of M bits so
that each chunk corresponds to an integer k[n] ∈ {1, 2, ... , 2M – 1}. This sequence is then mapped onto a
sequence a[n] = G((–2M + 1) + 2k[n]), G being the gain factor.
−3 −1 0 1 3
FIGURE 1
1:05 11:33
PAM for M = 2, G = 1
47
The error analysis for PAM is very similar to what we carried out for bilevel signaling (which is basically a
PAM where M = 1) and the result is again an exponentially decaying function of the SNR. If we want to
increase the throughput even further, we can use complex numbers and build a complex valued transmission
system. The name of this complex valued map and scheme is Quadratic Amplitude Modulation (QAM). The
mapper takes the incumbent bitstream and splits it into chunks of M bits with M even. Then it uses half of
the bits to define a PAM sequence, ar[n], and the remaining M/2 bits to define another independent PAM
sequence, ai[n]. The final symbol sequence is a sequence of complex numbers a[n]= G(ar[n] + jai[n]). At the
receiver,
= 1 the slicer works by finding
M, M = 2, G
received symbol.
QAM,the Msymbol
= 4, G in the alphabet that is closest in Euclidian distance to the
=1
Im Im
−1 1 Re −3 −1 1 3 Re
−1
−1
−3
50
FIGURE 2
3:17 11:33
QAM for M = 2, 4 , G = 1
RN
BOOCs Digital Signal Processing
81
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
The way the slicer works is by defining decision regions around each point, which is a square of side 2G
centered around the point. As long as the received point is received within the decision region, we will not
make an error; it will be decoded correctly. To quantify the probability of error, again we assume â[n] =
a[n] + η[n], where the noise is a complex-valued Gaussian variable with variances in the real and imaginary
axes of σ0/2:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
Probability of error
100
10−10
Perr
4-point QAM
16-point QAM
10−20 64-point QAM
0 10 20 30
SNR (dB)
FIGURE 3
9:00 11:33
58
Let b[n] = br[n] + jbi[n] be a complex-valued baseband signal. We can create the following real-valued
passband signal:
If we receive this as the receiver, we will be able to recover the original signal.
FIGURE 1
3:30 7:41
83
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
To recover the baseband signal, we have to multiply by the carrier at the receiver as follows:
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
FIGURE 2
4:19 7:41
Recovering the in-phase component (filtering out the unnecessary components with a lowpass filter)
Similarly for the quadrature part of the baseband signal, we can multiply s[n]:
then filter out the unnecessary values with a low pass filter.
RN
BOOCs Digital Signal Processing
84
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
Let us now see how we can put everything we have learned so far and design a practical system to send data
over the telephone channel. Suppose that the bandwidth constraint for the telephone channel stipulates
that we can only transmit data from Fmin = 450Hz to Fmax = 2850Hz, with the center frequency Fc = 1650Hz.
This gives us a usable bandwidth of W = 2400Hz. As we have to pick a sample frequency that is at least twice
the highest frequency, let us choose Fs = 3·2400 = 72000Hz. When we translate this back to the original
domain, the modulating frequency is ωc = 0.458π. Let us also assume that the maximum SNR is 22 dB. Let
us pick Perr = 10–6. Plugging those values in the formula, using QAM:
a[n]
..01100 K↑
Scrambler Mapper
01010...
e jωc n
FIGURE 1
0:10 5:19
j
H(z) e −jωc n
â[n]
K↓ ..01100
Slicer Descrambler
01010...
FIGURE 2
0:20 5:19
15
Shannon’s capacity formula is the upper bound on the amount of information that we can send C =
W·log2(1+SNR) [bits/second], which in our case gives C ~17500bps. With our design we are basically hitting
half of the capacity of the channel, but that gap can be narrowed by more sophisticated coding techniques.
RN
BOOCs Digital Signal Processing
85
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
As this video treats an example around an audio file we encourage you to watch it.
You may have recognized the sound as the obligatory soundtrack every time you used to connect to the
Internet. This is the sound made by a V34 modem. And you probably wondered what was going on. The
receiver has to cope with four potential sources of problem: interference, the propagation delay (the delay
introduced by the channel), the linear distortion (introduced by the channel), and drifts in the internal clocks
between the digital system inside the transmitter and the digital system inside the receiver. When it comes
to interference the handshake procedure and line probing pilot tones are used in clever ways to circumvent
the major sources of interference. Propagation delay is tackled with a delay estimation procedure. Distortion
for displaying the channel is compensated for by using adaptive equalization techniques. Clock drifts are
tackled by using timing recovering techniques.
To simplify the analysis we will assume that the clocks at the transmitter and receiver are synchronized and
synchronous. Assume the channel acts as a simple delay: ^ s (t) = s(t – d) which implies that the frequency
response of the channel is D(jΩ)= e–jΩd. It introduces a delay of d seconds, which we can write as d = (b + τ)
Ts , where b is a positive integer and |τ| < 1/2, b is called the bulk delay, and τ is called the fractional delay.
It is relatively simple to compensate for the bulk delay; imagine the transmitter begins transmission by
sending just one impulse over the channel. The discrete time signal is just a delta in zero. It gets to the
receiver after a delay, D, that we can estimate, for instance, by looking at the placement of the peak of
the intervalation function. So for the receiver to offset the bulk delay we will just set the nominal n = 0, to
coincide with the location of the maximum value of the sample sequence.
To compensate for the fractional delay, the transmitter sends an initial known sequence from which the
receiver derives an estimate of the fractional delay. Given this estimation, the receiver implements a Lagrange
interpolation (as in module 6.2) that uses a neighborhood of points around the current observations to
compensate for the fractional delay. We then obtain 2N + 1 Lagrangian coefficients. Then we filter with the
resulting FIR. The latter can be implemented as a simple FIR filter, a great advantage in practice.
RN
BOOCs Digital Signal Processing
86
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
In figures 1 and 2, we would like to undo the effects of the channel on the transmitted signal.
olo
Pas[n]
s(t) ŝ(t)
D/A D(jΩ) A/D ŝ[n]
Example: adaptive equalization
FIGURE 1
0:105:17
ŝ[n]
s[n] D(z) E (z) sˆe [n] = s[n]
37
FIGURE 2
0:50 5:17
ŝe [n]
ŝ[n] E (z)
e[n]
- s[n]
FIGURE 3
1:55 5:17
Adaptive equalization
41
RN
BOOCs Digital Signal Processing
87
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
How do we get the exact transmitting signal at the receiver’s end? Using two tricks: the first one is
Adaptive equalization: bootstrapping via a training sequence
bootstrapping (the transmitter will send a prearranged sequence of symbols to the receiver), and the second
one is the online mode. Both are explained in figures 4 and 5 via block diagrams.
s[n]
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
at [n] TX ...
ŝe [n]
ŝ[n] E (z)
e[n] s[n]
- Modulator at [n]
3:00 5:17
42
Bootstrapping via a training sequence
e[n] s ′ [n]
- Modulator
FIGURE 5
3:30 5:17
Online mode
43
There are still so many questions that we would have to answer to be thorough. For instance, how do we
carry out the adaptation of the coefficients in the equalizer? How do we compensate for different clock
rates in geographically diverse receivers and transmitters? How do we recover from the interference from
other transmission devices and how do we improve noise resilience? The answers to all those questions
require a much deeper understanding of adaptive signal processing. And hopefully, that will be the topic of
your next signal processing class.
RN
BOOCs Digital Signal Processing
88
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
When you talk on the phone, voice communication is sent to the voice network and then relayed to what is
calledThe
the plain
ADSL old telephone
channel system, POTS.
POTS
upstream
downstream
0 1MHz
FIGURE 1
1:30 8:05
48
Copper wire has both a very large bandwidth and can experience many different sources of disturbances,
such as radio interferences. Therefore, it is hard to design a global solution for the entire channel. In ADSL
the channel is divided into equally-spaced subchannels. The low frequency ones are reserved for voice
communication. Then a portion is used for the upstream and a bigger portion for the downstream. It is
this asymmetry in the differing sizes that explains the A in the ADSL acronym. ADSL stands for asymmetric
digital subscriber line. Each subchannel is treated independently and transmits data according to its own
SNR. Some might not even be used if the interferences are too high, for example. In ADSL, each subchannel
implements an indecent QAM based on the local SNR. There is a simple implementation of this bank of
independent signaling schemes as an inverse FFT. This ease of implementation is certainly an important
reason behind the huge commercial success of ADSL.
RN
BOOCs Digital Signal Processing
89
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
ADSL transmission can be efficiently implemented with simply an inverse FFT. We will look at a very efficient
implementation of that signaling strategy that goes under the name of discrete multitone modulation.
e j(2π/2N)(0·n)
a0 [⌊n/2N⌋] ×
e j(2π/2N)(1·n)
a1 [⌊n/2N⌋] ×
e j(2π/2N)(2·n)
c[n]
a2 [⌊n/2N⌋] × + Re s[n]
...
e j(2π/2N)(N−2)n
aN−2 [⌊n/2N⌋] ×
e j(2π/2N)(N−1)n
aN−1 [⌊n/2N⌋] ×
FIGURE 1
4:38 9:37
therefore
Schematically, we can draw up the ADSL transmitter as one big inverse FFT. And the inputs to this FFT are
twice the baseband symbol, followed by the symbols for the subchannels from 1 to N – 1.
RN
BOOCs Digital Signal Processing
90
LEA ER,
S
FA RN
T Paolo Prandoni
BET EPFL
LEA ER!
ADSL transmitter
T and Martin Vetterli
s[2Nm]
2a0 [m]
s[2Nm + 1]
a1 [m]
s[2Nm + 2]
a2 [m]
s[2Nm + 3]
s[2Nm + 4]
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
s[2Nm + 5]
parallel to serial
aN−2[m]
IFFT
aN−1[m]
∗ s[n]
∗
∗
s[2Nm + N − 4]
s[2Nm + N − 3]
∗ s[2Nm + N − 2]
∗ s[2Nm + N − 1]
FIGURE 2
68
8:26 9:37
ADSL transmitter
Signal
of the
MOIRÉ PATTERNS Day
Moiré is a French word that indicates a form of textile with a lot of surface decoration. If you ever get called
in for a TV interview, do not wear a striped shirt. A moiré pattern will appear and give your shirt a different
aspect.
The simplest way to generate moiré patterns is to take a regular pattern, such as a set of vertical lines, and then
make a copy of the same pattern, rotate it a little bit differently, and then superpose them. There are other
types of moiré patterns of other dimensions and it can even be noticed in music. They are caused by aliasing.
Let’s look at a practical application of moiré patterns, which comes in the form of secure printing. Take
a 20 euro banknote. The banknote is embedded with very, very fine lines, too fine for most scanners or
camera to capture correctly. So if you take this banknote and try to make more money by photocopying it
or scanning it, the moiré patterns appear in the secure zone of the banknote, and prevents you from making
an accurate copy of it.
RN
BOOCs Digital Signal Processing
91
LEA ER,
S
FA RN
T Paolo Prandoni
LEA ER!
BET
T EPFL and Martin Vetterli
IMPRESSUM
Ce document est la propriété exclusive de Paolo Prandoni ([email protected]) - vendredi 27 octobre 2023 à 17h35
© EPFL Press, 2017. Developed by the EPFL Press, BOOCs (Books and Open Online
All rights reserved. Courses) provide the accompanying text for MOOCs at the Swiss
Federal Institute of Technology in Lausanne (EPFL).
Layout : They create a real learning advantage and bring added value to the
Emphase Sàrl, Lausanne MOOC, summarizing the main points to remember to help obtain
the qualification.
Summary : Brune Bastide Learn faster, learn better. Happy studying!
ISBN 978-2-88914-425-9
full catalogue
here