You are on page 1of 41

Chapter 2:

Analog-to-Digital Conversion
(Digital signal processing)

Nguyen Linh Trung, Tran Duc Tan, Huynh Huu Tue


University of engineering and technology
Vietnam national university,Hanoi

1/2018
Content

Overview

Sampling method

Quantization

Coding and binary presentation


Chapter 2
Overview
I As is well known, a physical quantity represented by a Overview

function that varies with time is known as a continuous Sampling method

signal. Quantization

Coding and binary


I In order to process continuous signals by computers, the presentation

first thing to do is digitization, that is to present the


continuous signal by a sequence of numbers which
computers can understand and process.
I Digitization process has three steps in order, as below:
sampling, quantization và coding.

3 / 41
I Sampling: gets values of the signal at discrete times. Chapter 2

Therefore, sampling is also called discretization.


I Quantization: approximates values of the signal samples Overview

according to some quantum levels (discrete values). Sampling method

Quantization is determined by the accuracy of Quantization

computers. Coding and binary


presentation
I Coding: efficiently represents a number by binary
system so that computers can read. Therefore, this is
the most important operation in digitalization.
I Three steps above are combined in an analog-to-digital
converter (ADC).

4 / 41
I Let us illustrate the digitization process. Consider an Chapter 2

analog signal x(t) “./figures/ADC_0” — 2012/6/11 — 18:24 — pag


x( t) Overview

Sampling method

Quantization

Coding and binary


t presentation

5 / 41
I Now, sample x(t) at the equidistant points every T Chapter 2

seconds to get the signal x(nT ); n is integer. T is


called the sampling period. This method is called Overview
uniform sampling. Sampling method

Quantization

Coding and binary


presentation

6 / 41
x( t) Chapter 2

Overview

t Sampling method

Quantization

Coding and binary


“./figures/ADC_1” — 2012/6/11 — 18:24 — pag
presentation

x( nT )

7 / 41
I Next, instead of using x(nT ) with time nT , we can Chapter 2

simply use x(n) with sample n and call it a


discrete-time signal. “./figures/ADC_1” — 2012/6/11 — 18:24
Overview — pag

x( nT ) Sampling method

Quantization

Coding and binary


presentation

“./figures/ADC_2” — 2012/6/11 — 18:24 — pag


x( n)

8 / 41
I Because samples of x(n) are real-valued, we need to Chapter 2

approximate them by finite numbers corresponding to


different pre-defined quantum levels. For example, we Overview
choose eight levels {−1, 2; −0, 8; . . . ; 1, 6}, Sampling method

Quantization

Coding and binary


presentation

9 / 41
x( n) Chapter 2

Overview

n Sampling method

Quantization

Coding and binary


“./figures/ADC_3” — 2012/6/11 — 18:25 — pag
presentation

x( n)
1.6
1.2
0.8
0.4
n
0.0
-0.4
-0.8
-1.2

10 / 41
I Then, we round x(n) to get the quantized signal x̃(n). Chapter 2

This step produces errors, which is called quantization


errors. “./figures/ADC_3” — 2012/6/11 — 18:25
Overview
— pag
x( n) Sampling method

Quantization
1.6
1.2 Coding and binary
0.8 presentation
0.4
n
0.0
-0.4
-0.8

“./figures/ADC_4”
-1.2
— 2012/6/11 — 18:25 — pag
x q ( n)

1.6
1.2
0.8
0.4
n
0.0
-0.4
-0.8
-1.2

11 / 41
I With eight selected levels of quantization, we can use Chapter 2

“./figures/ADC_4” — 2012/6/11
3-bit binary numbers in order to represent the levels. — 18:25 — pag
x q ( n) Overview

Sampling method
1.6
1.2 Quantization
0.8
Coding and binary
0.4
n presentation
0.0
-0.4
-0.8

“./figures/ADC_5”
-1.2
— 2012/6/11 — 18:25 — pag
x q ( n)

111
110
101
100
n
011
010
001
000

12 / 41
I Therefore, quantized signal x̃(n) is represented in a Chapter 2

“./figures/ADC_5”
binary sequence x = {010101 · · · }. — 2012/6/11 — 18:25 — pag
x q ( n) Overview

Sampling method
111
110 Quantization
101
Coding and binary
100
n presentation
011
010
001

“./figures/ADC_6” — 2012/6/11
000
— 18:25 — page 6 — #1
x( n)

x= 010 101 111 111 110 110 110 111 111 101 010 000 011 110 101 111 011 000 011

13 / 41
I To reduce the quantization error, we can use more Chapter 2

quantum levels. However, that means we need more


binary bits to represent the levels and thus the required Overview
memory storage increases. Sampling method

Quantization

Coding and binary


presentation

14 / 41
Content

Overview

Sampling method

Quantization

Coding and binary presentation


Chapter 2
Sampling method
I There are many sampling methods, depending on the Overview

nature of the signal or the information that we need to Sampling method

process. Here we only consider the simplest method, but Quantization

Coding and binary


is the most fundamental, which is uniform sampling. presentation

I Uniform sampling (for short, it is now referred to as


sampling) a continuous signal x(t) is to records a
sequence of signal values at time points t = nT ; n is a
integer varies from −∞ to +∞. T is a constant whose
unit is second (s), and is called the sampling period.
I Discretizing signal x(t) to get the sequence x(nT ) is
only valid/useful if later x(t) can be perfectly
reconstructed. The set of conditions to ensure perfect
reconstruction is called the sampling conditions. To
understand the sampling conditions, we now examine
the spectrum of the sampled signal.

16 / 41
Chapter 2
Spectrum of sampling signal
I Let X(Ω) is spectrum of x(t), using the definition of Overview

X(Ω) with Fourier transform of x(t) as below: Sampling method

Quantization
Z ∞
Coding and binary
X (Ω) = x (t) e−jΩt dt. presentation
−∞

Note, in this definition, the unit of Ω (read as “big


omega”) is radian/second.

17 / 41
I Consider the following signal: Chapter 2


X
∆ (t) = δ (t − nT ) , (1) Overview

n=−∞ Sampling method

Quantization
I δ(t) is Dirac pulse “./figures/ADC_7” — 2012/6/11 — 18:25 — page
Coding 7 —
and binary
presentation
δ( t )
1

I ∆ (t), periodic with period T , contains a train of Dirac


pulses at time points nT“./figures/ADC_8”
. — 2012/6/11 — 18:25 — page 7 —
∆( t)
1

t
−3T −2T −T T 2T 3T

18 / 41
I Expand ∆ (t) into Fourier series Chapter 2


X
∆ (t) = Cn ejnΩ0 t . Overview

n=−∞ Sampling method

Quantization
in which Ω0 = 2π/T and Coding and binary
presentation
Z
1
Cn = ∆ (t) e−jnΩ0 t dt.
T T

The integral range of T takes on any interval of length


T ; we usually use the interval [−T /2, T /2].

19 / 41
I We have Chapter 2

Z T
1 2
Cn = ∆ (t) e−jnΩ0 t dt Overview
T − T2 Sampling method
T ∞
" #
Quantization
Z
1 2 X
= δ(t − kT ) e−jnΩ0 t dt Coding and binary
T − T2 presentation
k=−∞
∞ Z T
1 X 2
= δ(t − kT )e−jnΩ0 t dt
T − T
k=−∞ 2
Z T
1 2
= δ (t) e−jnΩ0 t dt
T −T
2
1
=
T
I Hence

1 X jnΩ0 t
∆(t) = e . (2)
T n=−∞

20 / 41
I So, ∆(t) can be represented by two different ways in Chapter 2

the time domain:



X Overview

∆ (t) = δ (t − nT ) , Sampling method

n=−∞ Quantization
∞ Coding and binary
1 X
∆(t) = ejnΩ0 t . presentation

T n=−∞

21 / 41
I Next, using ∆(t) to sample the signal x(t) to obtain the Chapter 2

sampled signal
Overview
x∆ (t) = x(t)∆(t). Sampling method

Quantization
This signal is considered as sampling x(t) with period T
Coding and binary
by the Dirac pulses. presentation

I We have two expressions for x∆ (t) in the time domain


X
x∆ (t) = x(t)δ (t − nT )
n=−∞
X∞
= x(nT )δ (t − nT ) , (3)
n=−∞

1 X
x∆ (t) = ejnΩ0 t x(t). (4)
T n=−∞

22 / 41
I Taking the Fourier transform of x∆ (t) to obtain two Chapter 2

expressions of its spectrum X∆ (Ω):


I We then have two expressions for X∆ (Ω): Overview

Sampling method

" #
Z ∞ X Quantization
X∆ (Ω) = x(nT )δ(t − nT ) e−jΩt dt Coding and binary
−∞ n=−∞ presentation

X
= x(nT )e−jnΩT (5)
n=−∞

" #
Z ∞
1 X jnΩ0 t
X∆ (Ω) = e x(t) e−jΩt dt
−∞ T n=−∞
∞ Z ∞
1 X
= x(t)e−j(Ω−nΩ0 )t dt
T n=−∞ −∞

1 X
= X(Ω − nΩ0 ) (6)
T n=−∞

23 / 41
I Two expressions (5) và (6) show that the spectrum Chapter 2

X∆ (Ω) can be represented either directly by the


sampled signal x(nT ) or by the spectrum X(Ω) of the Overview
analog signal x(t). And therefore we see the relation Sampling method
between the spectrum X(Ω) and the sampled signal Quantization
x(nT ). Coding and binary
presentation

24 / 41
Chapter 2
Signal reconstruction
I Equation (6) shows that from X∆ (Ω) we can derive Overview

X(Ω) with perfect accuracy if the components Sampling method

X (Ω + Ω0 ), X (Ω), and X (Ω − Ω0 ) are not Quantization

Coding and binary


overlapped in the frequency domain. This condition is presentation
called là non-aliasing.
“./figures/ADC_9” — 2012/6/11 — 18:29 — page 9 — #1
X ∆ (Ω )


−W
“./figures/ADC_10” W 2012/6/11
— Ω0 — 18:29 — page 9 — #1
X (Ω)


−W W

25 / 41
I To satisfy non-aliasing, there are two conditions: Chapter 2

I Spectrum X(Ω) of original signal x(t) must be


band-limited; with bandwidth of W , Overview
I For X (Ω + Ω0 ), X (Ω), X (Ω − Ω0 ) not to have any
Sampling method
overlap, we must have: Ω0 > 2W .
Quantization
I Nyquist sampling theory: A signal x(t) and its sampled Coding and binary
presentation
signal x(nT ) are completely equivalent if the spectrum
of x(t) has a finite bandwidth W and the sampling
frequency must be larger than twice the signal
bandwidth.
I Hence, processing an analog signal or its equivalent
discrete-time signal will yield the same result if the two
conditions are met.

26 / 41
I If true, from spectrum X∆ (Ω), we only use a ideal Chapter 2

lowpass filter Hr“./figures/ADC_11”


(Ω) to obtain X(Ω)— 2012/6/11 — 18:39 — page 10 —

X ∆ (Ω ) H r (Ω) X (Ω ) Overview

Sampling method
I Hr (Ω) is given by Quantization

( Coding and binary


presentation
1, if |Ω| ≤ W0
Hr (Ω) =
0, otherwise

in which W0 is satisfy W < W0 < Ω0 − W .


I Usually, we choose W0 = Ω0 /2.
I Frequency B0 = W0 /2π in unit of Hz and is called the
Nyquist frequency.

27 / 41
I In the time domain, we have Chapter 2

x(t) = hr (t) ? x∆ (t),


Overview

Sampling method
I hr (t) is the impulse response of the filter Hr (Ω) and is
Quantization
obtained as the inverse Fourier transform of Hr (Ω)
Coding and binary
presentation
hr (t) = 2πB0 sinc(B0 t),

where sinc(x) = sin(πx)/πx.


I Therefore,

X
x(t) = 2πB0 x(nT ) sinc B0 (t − nT ) . (7)
n=−∞

I We see that, when all sampling conditions are satisfy,


equation (7) ensure that x(t) is perfectly reconstructed
from its samples x(nT ) .
I (7) is usually called interpolation formula of x(t).
28 / 41
Chapter 2
Practical sampling
I Above, Overview

X Sampling method
∆ (t) = δ (t − nT ) , Quantization
n=−∞ Coding and binary
presentation
is used for sampling x(t).
I The mathematical Dirac impulse δ(t) cannot be built in
practice.
I In practice, we replace ∆(t) by

X
p(t) = w(t − nT ), (8)
n=−∞

in which T is sampling period and


(
1, if − T20 ≤ t ≤ T0
2
w(t) = (9)
0, otherwise

29 / 41
“./figures/ADC_12”
I Using signal p(t) to sample — 2012/6/11
x(t) in the circuit as below:— 18:41Chapter
— page2

x( t) x p ( t)
Overview

Sampling method

Quantization

Coding and binary


p ( t) presentation

Therefore

xp (t) = x(t)p(t). (10)

30 / 41
I Fourier series expansion of p(t): Chapter 2


X
p(t) = Cn ejnω0 t , Overview

n=−∞ Sampling method

Quantization
in which Coding and binary
presentation
Z T0  
1 2 T0 T0
Cn = ejnω0 t dt = sinc n .
T −
T0 T T
2

I Hence, xp (t) is given by



X
xp (t) = Cn ejnω0 t x(t). (11)
n=−∞

31 / 41
I Take the Fourier transform of both sides of Chapter 2

equation (11):
∞ Overview
X
Xp (Ω) = Cn X (Ω − nΩ0 ) . (12) Sampling method

Quantization
n=−∞
Coding and binary
presentation
I This result shows that spectrum X(Ω) can be derived
from spectrum Xp (Ω) if two sampling conditions are
satisfy.
I In practice, we choose T0 = T for simplicity; in this
case, this method is called sample-and-hold.

32 / 41
Content

Overview

Sampling method

Quantization

Coding and binary presentation


Chapter 2
Quantization
I After sampling, the next step of digitization operation is Overview

quantization. At sampling time, each sample value can Sampling method

change continuously from the lowest to the highest level Quantization

Coding and binary


of signal.Therefore, the corresponding binary presentation
representation must need a new infinite length with
absolute precision.
I In reality, the computer only certain accuracy, we must
accept approximately the samples with some determined
level by the accuracy of the computer. The thickness of
each level is called quantum level and this device is call
quantum device quantum device.

34 / 41
I The levels of the same quantum device may be different Chapter 2

each other in order to operate for many different


situations that always ensure the quality of the system. Overview
In the case of sampling uniform, the quantum device is Sampling method
called the uniform quantum. Quantization

Coding and binary


presentation

35 / 41
“./figures/ADC_13” — 2012/6/11 — 18:39Chapter
I Tail cutting approximation — page2

Q ( x)
Overview

3q Sampling method

Quantization
2q Coding and binary
presentation

−3 q −2 q −q x
q 2q 3q
−q

−2 q

−3 q

36 / 41
“./figures/ADC_14” — 2012/6/11 — 18:39Chapter
I Rounding approximation — page2

Q ( x)
Overview

3q Sampling method

Quantization
2q Coding and binary
presentation

−3 q −2 q −q x
q 2q 3q
−q

−2 q

−3 q

37 / 41
I Quantization approximate a signal with errors Chapter 2

x(n) = xq (n) + eq (n). (13)


Overview

Sampling method
Error eq (n) has absolute value smaller than q/2, in
Quantization
which q is quantum level.
Coding and binary
I We see that, quantization and sampling can exchange presentation

together without changing the results. Typically, the


sampling is performed before quantization. However, if
the sampling is performed after quantization,sampling
velocity need higher than Nyquist sampling velocity of
original signal. Because this case cause sample error
signal, with this signal can has bandwidth greater than
origin signal.Thus, if not careful, after sampled signals
can be affected by spectrum folding phenomenon.

38 / 41
Content

Overview

Sampling method

Quantization

Coding and binary presentation


Chapter 2
Coding and binary presentation
I After quantization, we need presenting xq (n) such that Overview

computer can understand; computer use binary system Sampling method

to present a value. Thus, we only present xq (n) in Quantization

Coding and binary


binary system. presentation

I Note: two presenting methods fixed-point and floating


point, because those method are equivalent to the
different level of accuracy.
I With fixed-point calculations, multiplication always lead
to round errors while the addition does not generate
errors.
I With floating-point calculations, all addition and
multiplication creates this kind of error.
I Fixed-point calculations may give rise to over-floating
phenomena.

40 / 41
I The over-floating phenomenon does not appear in Chapter 2

floating point calculations.


Overview

Sampling method

Quantization

Coding and binary


presentation

41 / 41

You might also like