Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views91 pages

Chapter 3 Samplingandquantization

Chapter 3 discusses the process of sampling and quantization in digital signal processing (DSP), highlighting the need for analog-to-digital (A/D) and digital-to-analog (D/A) conversion. It explains the concepts of sampling, quantization, and coding, and introduces the sampling theorem, which states that a band-limited analog signal can be sampled without loss of information if the sampling rate exceeds twice the maximum frequency of the signal. The chapter also covers the implications of different sampling rates, including oversampling, critical sampling, and undersampling, along with examples and exercises to illustrate these concepts.

Uploaded by

afifahaliasabd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views91 pages

Chapter 3 Samplingandquantization

Chapter 3 discusses the process of sampling and quantization in digital signal processing (DSP), highlighting the need for analog-to-digital (A/D) and digital-to-analog (D/A) conversion. It explains the concepts of sampling, quantization, and coding, and introduces the sampling theorem, which states that a band-limited analog signal can be sampled without loss of information if the sampling rate exceeds twice the maximum frequency of the signal. The chapter also covers the implications of different sampling rates, including oversampling, critical sampling, and undersampling, along with examples and exercises to illustrate these concepts.

Uploaded by

afifahaliasabd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 91

CHAPTER 3

SAMPLING AND QUANTIZATION


Faculty of Electrical and Electronic
Engineering

All right reserved. Copyright © 2019. FKEE 1


Introduction
 DSP systems are all in digital, but must be
interface to an analog external world.
 Analog signals being input to a DSP system
must be digitized using an analog to digital
(A/D) converter, and outputs from the DSP
system must be converted to analog using a
D/A converter

All right reserved. Copyright © 2019. FKEE 2


 Sampling and quantization is a part of process in ADC
– Sampling
• the conversion of a continuous-time signal into a discrete-time
signal obtained by taking samples of the continuous-time signal
at discrete-time instants
– Quantization
• the conversion of a discrete-time continuous-valued signal into
a discrete-time, discrete-valued (digital) signal
– Coding
• each discrete value, 𝑥𝑞[𝑛] is represent by a b-bit binary
sequence

All right reserved. Copyright © 2019. FKEE 3


Basic part of an
analog to digital (A/D) converter
A/D Converter

xa(t) x[n] xq[n] 01011…


Sampler Quantizer Coder

Analog Discrete-time Quantized Digital


signal signal signal signal

All right reserved. Copyright © 2019. FKEE 4


Ideal Sampling
 Ideal sampling describes a sampled signal as
a weighted sum of impulses
 Weights are equal to the values of the analog
signal at the impulse locations.
 An ideally sampled signal 𝑥𝐼 (𝑡) is the product
of an analog signal 𝑥(𝑡) & a periodic impulse
train 𝑖(𝑡).
xI t   xt it 

All right reserved. Copyright © 2019. FKEE 5


The ideal sampling operation
x(t) xI(t)

Multiplier
×
Analog signal ts
i(t) Ideally sampled signal

ts
Sampling function

All right reserved. Copyright © 2019. FKEE 6


 The ideally sampled signal is given by:

  
xI t   x t i t   x t   t  nts  
n  
 xnt  t  nt    xn t  nt 
n  
s s
n  
s

 The discrete signal x[n] represents the sequence of


sample values 𝑥(𝑛𝑡𝑠).
 The sampling operation leads to a potential loss of
information in the ideally sampled signal 𝑥𝐼 (𝑡), when
compared with its underlying analog counterpart 𝑥(𝑡).

All right reserved. Copyright © 2019. FKEE 7


 The smaller the sampling interval 𝑡𝑠, the less is the
loss of information.
 There must always be some loss of information, no
matter how small an interval we used.
 It is possible to sample signals without any loss of
information?
– The signal 𝑥(𝑡) must be band-limited to some
finite frequency B

All right reserved. Copyright © 2019. FKEE 8


Example 3.1
Given a signal x(t) with 100 Hz. If the signal
sampling at 𝑓𝑠 . How many sample/period? What
is the impact of the sampling frequency to
sample/period?
a) 𝑓𝑠 = 3𝑘𝐻𝑧
b) 𝑓𝑠 = 80𝐻𝑧

All right reserved. Copyright © 2019. FKEE 9


Solution
1 1
a) 𝑡= = = 0.01 𝑠 (1 cycle)
𝑓 100
1
Given 𝑓𝑠 = 3𝑘𝐻𝑧, Sampling time,𝑡𝑠 = = 0.0003𝑠
𝑓𝑠
number of sample,n = 0.01/𝑡𝑠 = 30 samples/period
(small sampling interval)

All right reserved. Copyright © 2019. FKEE 10


Solution
1
b) Given 𝑓𝑠 = 80𝐻𝑧, Sampling time,𝑡𝑠 = = 0.0125𝑠
𝑓𝑠
0.01
number of sample,n = = 0.8 samples/period
𝑡𝑠
(big sampling interval)  loss of information

All right reserved. Copyright © 2019. FKEE 11


 Graphical illustration of the spectra associated with the
various signals in ideal sampling.
xt 

it 
(1) (1)
t t t

Ts Ts

Sampling function and Ideally sampled signal


Analog signal and its
its spectrum and its spectrum
spectrum

Xf  I f  X I  f   X  f  I  f 
A S  Convolve SA
… … … …

f f
-B B S S 2S S -B B S 2S

All right reserved. Copyright © 2019. FKEE 12


 The impulse train 𝑖(𝑡) is a periodic signal with period
𝑇 = 𝑡𝑠 = 1/𝑆.
 Fourier series coefficients 𝐼[𝑘] = 𝑆.
 Its Fourier transform is a train of impulses (at 𝑓 = 𝑘𝑆)
whose strengths equal 𝐼[𝑘].
 
I f   I k   f  kS   S   f  kS 
k   k  

 The ideally sampled signal 𝑥𝐼 (𝑡) is the product of


𝑥(𝑡) and 𝑖(𝑡).

All right reserved. Copyright © 2019. FKEE 13


 Its spectrum 𝑋𝐼(𝑓) is described by the convolution
 
X I  f   X  f   I  f   X  f   S    f  kS   S  X  f  kS 
k   k  
 The spectrum of an ideally sampled signal is periodic
with period S.
 The spectrum 𝑋𝐼 (𝑓) consists of 𝑋(𝑓) & its shifted
replicas or images.

 It is periodic in frequency, with a period that equals the


sampling rate 𝑆.

All right reserved. Copyright © 2019. FKEE 14


Type of Sampling
• Since the spectral image at the origin extends over (-B, B),
and the next image (centered at S) extends over (S - B,
S + B), the images will not overlap if
S-B>B or S > 2B

i) Oversampling (S >2B)
-Sampled signal shows non-overlapping replicas of x(f).

15
All right reserved. Copyright © 2019. FKEE 15
ii) Critical sampling (S = 2B)
-the transition between oversampling & under-sampling

iii) Under sampling (S < 2B)


- The replicas overlap & one period of the periodic spectrum no
longer matches x(f)

16
All right reserved. Copyright © 2019. FKEE 16
 𝑋(𝑓) can be extracted as the principal period of 𝑋𝐼(𝑓) between
− 0.5𝑆 and 0.5𝑆 by passing the ideally sampled signal through an
ideal lowpass filter with:
– a cutoff frequency of 0.5𝑆
– a gain of 1/𝑆
– the frequency range −0.5𝑆 ≤ 𝑓 ≤ 0.5𝑆.
 Sampling theorem:
– an analog signal band-limited to a frequency B can be sampled
without loss of information if the sampling rate S exceeds 2B,
𝑆 > 2𝐵
 Nyquist rate or Nyquist frequency:
– the critical sampling rate, 𝑆𝑁 = 2𝐵
 Nyquist interval:
– the critical sampling interval, 𝑡𝑁 = 1/𝑆𝑁 = 1/2𝐵

All right reserved. Copyright © 2019. FKEE 17


 If the 𝑆 < 2𝐵 , the spectral images overlap & the
principal period (−0.5𝑆, 0.5𝑆) of 𝑋𝐼 (𝑓) is no longer an
exact replica of 𝑋(𝑓).
 In this case, 𝑥(𝑡) cannot be recovered exactly & there is
loss of information due to undersampling.
 Components of 𝑋(𝑓) outside the principal range
(−0.5𝑆, 0.5𝑆) fold back into this range (due to the
spectral overlap from adjacent images).
 Frequencies higher than 0.5𝑆 appear as lower
frequencies in the principal period. This is aliasing.
 The frequency 0.5𝑆 is called the folding frequency.

All right reserved. Copyright © 2019. FKEE 18


Example 3.2
Given the signal 𝑥1(𝑡) be band-limited to 2 kHz and 𝑥2(𝑡)
be band-limited to 3 kHz. Find the Nyquist rate for the
following signals by using properties of the Fourier
transform:

a) 𝑥1(2𝑡)
b) 𝑥2(𝑡 − 3)
c) 𝑥1(𝑡) + 𝑥2(𝑡)
d) 𝑥1(𝑡)𝑥2(𝑡)
e) 𝑥1(𝑡) ∗ 𝑥2(𝑡)
f) 𝑥1(𝑡)cos(1000𝜋𝑡)

All right reserved. Copyright © 2019. FKEE 19


Solution
a) The spectrum of 𝑥1(2𝑡) (time compression) stretches to
4 𝑘𝐻𝑧.
𝑆𝑁 = 8𝑘𝐻𝑧.

b) The spectrum of 𝑥2(𝑡 − 3) extends to 3 𝑘𝐻𝑧 (a time


shift changes only the phase).
𝑆𝑁 = 6 𝑘𝐻𝑧.

c) The spectrum of 𝑥1(𝑡) + 𝑥2(𝑡) (sum of the spectra)


extends to 3 𝑘𝐻𝑧.
𝑆𝑁 = 6 𝑘𝐻𝑧.

All right reserved. Copyright © 2019. FKEE 20


d) The spectrum of 𝑥1(𝑡)𝑥2(𝑡) (convolution in the
frequency domain) extends to 5 𝑘𝐻𝑧.
𝑆𝑁 = 10 𝑘𝐻𝑧.

e) The spectrum of 𝑥1(𝑡) ∗ 𝑥2(𝑡) (product of the spectra)


extends only to 2 𝑘𝐻𝑧.
𝑆𝑁 = 4 𝑘𝐻𝑧.

f) The spectrum of 𝑥1(𝑡)cos(1000𝜋𝑡) (modulation) is


stretched by 500 𝐻𝑧 to 2.5 𝑘𝐻𝑧.
𝑆𝑁 = 5 𝑘𝐻𝑧.

All right reserved. Copyright © 2019. FKEE 21


Exercise 3.2
5
a) Consider the signal x  t    A cos 130  20v   t 
v 1
Calculate the Nyquist sampling rate of 𝑥(𝑡).

b) Calculate the critical sampling rate for the following signals:


i. 𝑦 𝑡 = cos 10𝜋𝑡 + 20° + sin 100𝜋𝑡
ii. 𝑓 𝑡 = cos 5𝜋𝑡 sin 10𝜋𝑡

c) To avoide aliasing the sinusoid signal with fundamental


frequency of 100 𝐻𝑧 is sampled at twice of the Nyquist rate.
Calculate the samples obtained in 2 𝑠.

All right reserved. Copyright © 2019. FKEE 22


Exercise 3.2
d) A 10-kHz sinusoidal with amplitude levels of  1V and signal
power of 𝑃𝑆 = 0.5, is to be sampled and quantized by
rounding. Calculate the required bits to ensure a
quantization SNR of 10 dB is achieved.

All right reserved. Copyright © 2019. FKEE 23


Sampling of Sinusoids
and Periodic Signals
 For the sinusoid signal 𝑥(𝑡) = cos(2𝜋𝑓𝑜𝑡 + );
– Nyquist frequency 𝑆𝑁 = 2 𝑓𝑜
– Nyquist interval 𝑡𝑁 = 1/2𝑓𝑜 = 𝑇/2

– taking more than two samples per period


• If acquire just two samples per period, starting at a zero
crossing, all sample values will be zero, and will yield no
information

All right reserved. Copyright © 2019. FKEE 24


 If 𝑥 𝑡 = cos(2𝜋𝑓𝑜𝑡 + 𝜃) is sampled at S;
– sampled signal 𝑥[𝑛] = cos(2𝜋𝑛𝑓𝑜/𝑆 + 𝜃)
– spectrum periodic, with principle period
(0.5𝑆, 0.5𝑆).
– 𝑓𝑜  0.5𝑆 no aliasing, the principle period is a
pair of impulses at  𝑓𝑜
– 𝑓𝑜  0.5𝑆 aliasing occur, the components at
𝑓𝑜 are aliased to a lower frequency
𝑓𝑎 in the principle range.

All right reserved. Copyright © 2019. FKEE 25


Relation between the actual
and aliased frequency

 The signal 𝑥(𝑡) = cos(2𝜋𝑓0𝑡 + 𝜃) is recovered as


𝑥𝑎(𝑡) = cos(2𝜋𝑓𝑎𝑡 + 𝜃) if 𝑆 < 2𝑓0.
 Aliased frequencies, 𝑓𝑎 = 𝑓𝑜– 𝑁𝑆, where N is an integer
that places fa in the principal period (– 0.5𝑆, 0.5𝑆)

All right reserved. Copyright © 2019. FKEE 26


Example 3.3
Given the sinusoid 𝑥(𝑡) = 𝐴𝑐𝑜𝑠(2𝑓𝑜𝑡 + 𝜃) with
𝑓𝑜 = 100 𝐻𝑧. Determine whether aliasing occur or not
for a given sampling frequency S below and write down
the corresponding signal. Write down the aliased
frequency if it occurs.
a) 𝑆 = 300 𝐻𝑧.
b) 𝑆 = 80 𝐻𝑧.
c) 𝑆 = 60 𝐻𝑧.

All right reserved. Copyright © 2019. FKEE 27


Solution
a) If 𝑥(𝑡) is sampled at 𝑆 = 300 𝐻𝑧 , no aliasing occurs, since
𝑆 > 2𝑓𝑜. Hence, the sinusoid corresponds to:
𝑥(𝑡) = 𝐴𝑐𝑜𝑠(2𝜋(100)𝑡 + 𝜃) = 𝐴𝑐𝑜𝑠(200𝜋𝑡 + 𝜃)

b) If 𝑥(𝑡) is sampled at 𝑆 = 80 𝐻𝑧, we obtain 𝑓𝑎 = 𝑓𝑜 − 𝑆 = 20 Hz.


The sampled signal describes a sampled version of the aliased
signal:
𝑥(𝑡) = 𝐴𝑐𝑜𝑠(2𝜋(20)𝑡 + 𝜃) = 𝐴𝑐𝑜𝑠(40𝜋𝑡 + 𝜃)

c) If 𝑥(𝑡) is sampled at 𝑆 = 60 𝐻𝑧, we obtain


𝑓𝑎 = 𝑓𝑜 − 2𝑆 = −20 𝐻𝑧
The aliased sinusoid corresponds to:
𝑥(𝑡) = 𝐴𝑐𝑜𝑠(2𝜋(−20)𝑡 + 𝜃) = 𝐴𝑐𝑜𝑠(40𝜋𝑡 − 𝜃)
Note the phase reversal.

All right reserved. Copyright © 2019. FKEE 28


Exercise 3.3
5
a) Given xt    A cos130  20v  t 
v 1

Express the reconstructed signal if 𝑥(𝑡) is sampled


at 80 𝐻𝑧.

All right reserved. Copyright © 2019. FKEE 29


Exercise 3.3
b) Let x p (t )  8 cos(2t )  6 cos(8t )  4 cos(22t )  6 sin(32t )  cos(58t )  sin( 66t )
If 𝑥𝑝(𝑡) is sampled at 𝑆 = 10𝐻𝑧, discuss about the
reconstructed signal of 𝑥𝑝(𝑡)
c) Consider the analog signal
xa t   3 cos2000 t  5 sin 6000 t  10 cos12,000 t
i. What is the Nyquist rate for this signal
ii. Assume now that we sample this signal using a sampling rate
𝑆 = 5000 𝐻𝑧.
iii. Find the reconstructed signal.
iv. What is the discrete-time signal obtained after sampling?

All right reserved. Copyright © 2019. FKEE 30


Interpolation and Signal Recovery
 For a sampled sequence obtained from an analog
signal 𝑥(𝑡), an important aspect is the recovery of
the original signal from its samples.
 This requires "filling in" the missing details, or
interpolating between the sampled values.
 Only ideal (or impulse) sampling leads to a discrete
signal 𝑥[𝑛] whose samples equal the strengths of
the impulses 𝑥(𝑛𝑡𝑠)𝛿(𝑡 − 𝑛𝑡𝑠) at the sampling
instants 𝑛𝑡𝑠

All right reserved. Copyright © 2019. FKEE 31


Signal Recovery
Four types of signal recovery
 Sinc interpolating function
 Step interpolation
 Linear interpolation
 Raised Cosine Interpolating function

All right reserved. Copyright © 2019. FKEE 32


Ideal Recovery and
the Sinc Interpolating Function
 The ideally sampled signal 𝑥𝐼 (𝑡) is shown in
the equation:
  
xI t   xt i t   xt    t  nt s  
n  
 xnt  t  nt    xn t  nt 
n  
s s
n  
s

 We can recover 𝑥(𝑡) by passing 𝑥𝐼(𝑡) through


an ideal lowpass filter with a gain of 𝑡𝑠 and a
cutoff frequency of 0.5𝑆

All right reserved. Copyright © 2019. FKEE 33


Recovery of an analog signal
from its sampled version

Sinc Interpolating
Function

All right reserved. Copyright © 2019. FKEE 34


 The impulse response of the ideal lowpass filter is a sinc
function given by ℎ(𝑡) = 𝑠𝑖𝑛𝑐(𝑡/𝑡𝑠).
 The recovered signal 𝑥(𝑡) can be described as the
convolution:
   
xt   xI t   ht     xnts  t  nts   ht    xnht  nts 
n   n  

 This describes the superposition of shifted versions of


ℎ(𝑡) weighted by the sample values 𝑥[𝑛].

All right reserved. Copyright © 2019. FKEE 35


 Substituting for ℎ(𝑡), 𝑥(𝑡) can be recovered exactly from
its samples x[n] as a sum of scaled shifted versions of
sinc functions:

 t  nts 
xt    xnsinc  
n    ts 

 At each sampling instant, the sample value 𝑥[𝑛] is


replaced by a sinc function whose peak value equals
𝑥[𝑛] and whose zero crossings occur at all the other
sampling instants.

All right reserved. Copyright © 2019. FKEE 36


Ideal recovery of an analog signal
by sinc interpolation

All right reserved. Copyright © 2019. FKEE 37


Ideal recovery of an analog signal
by sinc interpolation

All right reserved. Copyright © 2019. FKEE 38


 If a lowpass filter is used whose impulse response is
ℎ𝑓(𝑡) = 2𝑡𝑠𝐵𝑠𝑖𝑛𝑐(2𝐵𝑡) (the cutoff frequency is B
instead of 0.5𝑆), the recovered signal 𝑥(𝑡) can be
described by the convolution:

xt   xI t   h f t    2t Bxnsinc2Bt  nt 
n  
s s

 This general result is valid for any oversampled signal


with 𝑡𝑠 ≤ 0.5/𝐵 & reduces to the previously obtained
result if the sampling rate S equals the Nyquist rate
(i.e., 𝑆 = 2𝐵).

All right reserved. Copyright © 2019. FKEE 39


 Sinc interpolation is unrealistic from a practical
viewpoint.
 Sinc interpolation is also referred to as band-limited
interpolation by which all other schemes are
measured in their ability to reconstruct band-limited
signals

All right reserved. Copyright © 2019. FKEE 40


Interpolating Functions
 To obtain a good approximation, the
interpolated approximation 𝑥(𝑡) should
match 𝑥(𝑡) at the sampling instants 𝑛𝑡𝑠.
 This suggests that ℎ𝑖(𝑡) should equal to zero
at all sampling instants, except the origin
where it must equal to unity, such that:
1, t  0
hi  t   
0, t  nts ,  n  1,  2,  3,...

All right reserved. Copyright © 2019. FKEE 41


 The interpolated signal 𝑥෤ 𝑡 is the convolution of ℎ𝑖(𝑡)
with the ideally sampled signal 𝑥𝐼 (𝑡), or a summation of
shifted versions of the interpolating function

x t   hi t   xI t  
~
 xnh t  nt 
n  
i s

 At a sampling instant 𝑡 = 𝑘𝑡𝑠, the interpolating function


ℎ𝑖 (𝑘𝑡𝑠 − 𝑛𝑡𝑠) equals zero, unless 𝑛 = 𝑘 when it equals
unity.
 As a result, 𝑥෤ 𝑡 exactly equals 𝑥(𝑡) at each sampling
instant.

All right reserved. Copyright © 2019. FKEE 42


Interpolation in Practice
 There is no "best" interpolating signal.
 Some are better in terms of their accuracy, cost
effectiveness, or numerical implementation

All right reserved. Copyright © 2019. FKEE 43


Step Interpolation
 Step interpolation uses a rectangular interpolating
function of width given by
ℎ(𝑡) = 𝑟𝑒𝑐𝑡[(𝑡 − 0.5𝑡𝑠)/𝑡𝑠]
to produce a staircase approximation to x(t).
 At any time between two sampling instants, the
reconstructed signal equals the previously sampled
value & does not depend on any future values.
 This is useful for real-time processing where the output,
is produced at the same rate as the incoming data.

All right reserved. Copyright © 2019. FKEE 44


 A system that performs step interpolation is just a
zero-order-hold system.
 A practical digital-to-analog converter (DAC) for
sampled signals uses a zero-order-hold for a
staircase approximation (step interpolation)
followed by a lowpass (anti-imaging) filter (for
smoothing the steps)

All right reserved. Copyright © 2019. FKEE 45


Linear Interpolation
 Linear interpolation uses the interpolating
function ℎ(𝑡) = 𝑡𝑟𝑖(𝑡/𝑡𝑠) to produce a linear
approximation to x(t) between the sample
values

All right reserved. Copyright © 2019. FKEE 46


 At any instant t between adjacent sampling instants 𝑛𝑡𝑠
& (𝑛 + 1)𝑡𝑠, the reconstructed signal equals x[n] plus
an increment that depends on the slope of the line
joining 𝑥[𝑛] & 𝑥[𝑛 + 1].
xn  1  xn n ts  t  n  1ts
x t   xn  t  nts 
~ ,
ts
 This operation, requires one future value of the input &
cannot actually be implemented real-time.
 Systems performing linear interpolation are also called
first-order-hold systems

All right reserved. Copyright © 2019. FKEE 47


Raised Cosine
Interpolating Function
 The sinc interpolating function forms the basis for several
others described by the generic relation
t 
h  t   g  t  sinc   , where g  0   1
 ts 
 One of the more commonly used of these is the raised
cosine interpolating function described by
 Rt 
cos 
 ts  t
hrc t   2
sinc   0  R 1
 2R t   ts 
1   
 ts 

All right reserved. Copyright © 2019. FKEE 48


 𝑅 is called the roll-off factor.
 ℎ𝑟𝑐 (𝑡) equals 1 at 𝑡 = 0 & 0 at the other sampling
instants.
 It exhibits faster decaying oscillations on either side of
the origin for 𝑅 > 0 as compared to the sinc function.
 It allows fewer past & future values to be used in the
reconstruction as compared with the sinc interpolating
function
 The terminology raised cosine is actually based on the
shape of its spectrum.
 For 𝑅 = 0 , the raised cosine interpolating function
reduces to the sinc interpolating function.

All right reserved. Copyright © 2019. FKEE 49


Example 3.4

Given 𝑥[𝑛] = { 1 , 2, 3, 2}, 𝑡𝒔 = 1. What is the
value of the reconstructed signal 𝑥(𝑡) at 2.5𝑠
that results from:
i. step interpolation?
ii. linear interpolation?
iii. sinc interporlation?
iv. raised cosine interpolation, with 𝑅 = 0.5?

All right reserved. Copyright © 2019. FKEE 50


Solution
i. The signal value at 𝑡 = 2.5𝑠 is the value at
𝑡 − 0.5𝑡𝑠
ℎ(𝑡) = 𝑟𝑒𝑐𝑡
𝑡𝑠
2.5 − 0.5 1
= 𝑟𝑒𝑐𝑡
1
= 𝑟𝑒𝑐𝑡(2)
Thus, 𝑡 = 2𝑠 for 𝑥[𝑛].
Hence, ~x t   ~
x 2.5  3

All right reserved. Copyright © 2019. FKEE 51


ii. .n ts  t  n  1ts
n(1)  2.5  n  1(1)
n  2.5  n  1
2  2.5  3
The signal value at t = 2.5s is the average of
the values at t = 2 and t = 3.
Hence, ~x t   ~
x 2.5  0.53  2  2.5

All right reserved. Copyright © 2019. FKEE 52


iii. Sinc interpolation

3
 t  nts 
x t 
~   xnsinc  
n 0  ts 
 sinc t   2sinc t  1  3sinc t  2  2sinc t  3

x 2.5  0.1273  0.4244  1.9099  1.2732  2.6314


~

All right reserved. Copyright © 2019. FKEE 53


iv. Raised cosine interpolation
 R t  n  

 t  n  cos t s 
x t 
~   xnsinc  
 2 R t  n  
2
n    s   ts 
t 1  
 
3
cos0.5 t  n 
  xnsinc t  n 
1  t  n 
2
n 0

cos0.5t  cos0.5 t  1


 sinc t   2sinc t  1
1 t 2 1  t  1
2

cos0.5 t  2 cos0.5 t  3


 3sinc t  2  2 sinc t  3
1  t  2 1  t  3
2 2

x 2.5  0.0171  0.2401  1.8006  1.2004  2.7438


~

All right reserved. Copyright © 2019. FKEE 54


Quantization
 The importance of digital signals stems from the
proliferation of high-speed digital computers for signal
processing.
 Due to the finite memory limitations of machines, finite
data sequences can be processed only.
 An analog signal must not only be sampled in time but
also quantize (round or truncate) the signal amplitudes
to a finite set of values.
 Since quantization affects only the signal amplitude,
both analog & discrete-time signals can be quantized.

All right reserved. Copyright © 2019. FKEE 55


 Quantized discrete-time signals are called digital signals.
 Each quantized sample is represented as a group of
zeros and ones (bits).
 The finer the quantization, the longer the word.
 Like sampling, improper quantization leads to loss of
information.
 Quantization always introduces some noise, whose
effects can be described only in statistical terms

All right reserved. Copyright © 2019. FKEE 56


Uniform Quantizers
 Quantizers are devices that operate on a signal to
produce a finite number of amplitude levels or
quantization levels.
 It is common practice to use uniform quantizers with
equal quantization levels.
 The number of levels L in most quantizers used in ADC is
invariably a power of 2.
 If 𝐿 = 2𝐵, each of the L levels is coded to a binary
number & each signal value is represented in binary
form as a B-bit word corresponding to its quantized
value

All right reserved. Copyright © 2019. FKEE 57


 A 4-bit quantizer is thus capable of 24 (or 16)
levels and a 12-bit quantizer yields 212 (or
4096) levels. A signal may be quantized by:
– truncation to a level smaller than the next higher
one,
– rounding to the nearest quantization level, or
– sign-magnitude truncation, which is rather like
truncating smaller absolute values and the using
the appropriate sign

All right reserved. Copyright © 2019. FKEE 58


Various ways of quantizing a signal

All right reserved. Copyright © 2019. FKEE 59


Example 3.5
Let consider the following discrete-time signal

0.9 , n  0
n

xn  
 0 , n0

All right reserved. Copyright © 2019. FKEE 60


Solution
 Obtained by sampling the analog exponential
signal x t   0.9 , t  0 with a sampling
t

frequency, f = 1Hz.

All right reserved. Copyright © 2019. FKEE 61


All right reserved. Copyright © 2019. FKEE 62
Numerical Illustration of Quantization with One Significant
Digit Using Truncation or Rounding
x[n] xq[n] xq[n]
n
Discrete-time signal (Truncation) (Rounding)
0 1 1.0 1.0
1 0.9 0.9 0.9
2 0.81 0.8 0.8
3 0.792 0.7 0.8
4 0.6561 0.6 0.7
5 0.59049 0.5 0.6
6 0.531441 0.5 0.5
7 0.4782969 0.4 0.5
8 0.43046721 0.4 0.4
9 0.387420489 0.3 0.4

All right reserved. Copyright © 2019. FKEE 63


 The observed value may be set to the full-
scale value (saturation) or zero (zeroing),
leading to the overflow characteristics
Observed Value Observed Value

V V

-V V -V V

Actual Value Actual Value

-V -V

Saturation Zeroing

All right reserved. Copyright © 2019. FKEE 64


Various Number Representations
for B = 3 bits
Decimal Sign and One’s Two’s Offset
value Magnitude complement complement Binary
+4 111
+3 011 011 011 110
+2 010 010 010 101
+1 001 001 001 100
+0 000 000 000
-0 100 111 011
-1 101 110 111 010
-2 110 101 110 001
-3 111 100 101 000
-4 100

All right reserved. Copyright © 2019. FKEE 65


Various Number Representations for, B = 4 bits
Integer Sign- magnitude One's complement Two's complement Offset binary

+7 0111 0111 0111 1111


+6 0110 0110 0110 1110
+5 0101 0101 0101 1101
+4 0100 0100 0100 1100
+3 0011 0011 0011 1011
+2 0010 0010 0010 1010
+1 0001 0001 0001 1001
0 0000 0000 0000 1000
-1 1001 1110 1111 0111
-2 1010 1101 1110 0110
-3 1011 1100 1101 0101
-4 1100 1011 1100 0100
-5 1101 1010 1011 0011
-6 1110 1001 1010 0010
-7 1111 1000 1001 0001
-8 - - 1000 0000
-0 1000 1111 - -

All right reserved. Copyright © 2019. FKEE 66


Quantization Error and
Quantization Noise
 The quantization error depends on the
number of levels.
 If the quantized signal corresponding to a
discrete signal 𝑥[𝑛] is denoted by 𝑥𝑄[𝑛], the
quantization error 𝜀[𝑛] equals

𝜀[𝑛] = 𝑥[𝑛] − 𝑥𝑄[𝑛]

All right reserved. Copyright © 2019. FKEE 67


 The quantization signal-to-noise ratio (SNRQ)
is defined as the ratio of the power PS in the
signal & the power PN in the error ε[n] (or
noise).
 Measured in dB
1 N 1 2 1 N 1 2
PS   x n PN    n
N n 0 N n 0

SNRQ dB  10 log10


PS
 10 log10
 n
x 2

PN  n
 2

All right reserved. Copyright © 2019. FKEE 68


 The dynamic range or full-scale range of a
signal 𝑥(𝑡) is defined as its maximum
variation
𝐷 = 𝑥𝑚𝑎𝑥 – 𝑥𝑚𝑖𝑛
 If 𝑥(𝑡) is sampled and quantized to 𝐿 levels
using a quantizer with a full-scale range of 𝐷,
the quantization step size or resolution, , is
defined as
Δ = 𝐷/𝐿
All right reserved. Copyright © 2019. FKEE 69
 Step size corresponds to the LSB.
 The dynamic range of a quantizer is expressed in dB.
 For a 16-bit quantizer, the dynamic range is
20 𝑙𝑜𝑔216 = 96 𝑑𝐵
For quantization by rounding, the maximum value of the
quantization error must lie between – Δ/2 and Δ/2.
 If 𝐿 is large, the error is likely to take on any value
between – Δ/2 and Δ/2

All right reserved. Copyright © 2019. FKEE 70


 Probability density function 𝑓(𝜀) of a signal
quantized by rounding

f(ε)
Δ/2

–Δ/2 Δ/2

All right reserved. Copyright © 2019. FKEE 71


 The noise power 𝑃𝑁 equals its variance 𝜎2 & is given
by
2 2 2
PN   2    2 f  d    2 d 
1
 2   2 12
 The rms quantization error is defined as


12
 With Δ = 𝐷/𝐿, some computation can be done:
D2
10 log PN  10 log 2
 20 log D  20 log L  10.8
12 L

All right reserved. Copyright © 2019. FKEE 72


 A statistical estimate of the SNR in dB is given by:
𝑆𝑁𝑅𝑺(𝑑𝐵) = 10𝑙𝑜𝑔𝑃𝑺 − 10𝑙𝑜𝑔𝑃𝑵
= 10𝑙𝑜𝑔𝑃𝑺 + 10.8 + 20𝑙𝑜𝑔𝐿 − 20𝑙𝑜𝑔𝐷

 For a B-bit quantizer with 𝐿 = 2𝐵 levels, the statistical


estimates is given by
𝑆𝑁𝑅𝑺 𝑑𝐵 = 10𝑙𝑜𝑔𝑃𝑺 + 10.8 + 6𝐵 − 20𝑙𝑜𝑔𝐷

All right reserved. Copyright © 2019. FKEE 73


Example 3.6
A sampled signal that varies between −2𝑉 and
2𝑉 is quantized using B bits. What value of 𝐵
will ensure an rms quantization error of less
than 5𝑚𝑉?

All right reserved. Copyright © 2019. FKEE 74


Solution
The full-scale range is 𝐷 = 4 𝑉 . The rms
quantization error is given by
D
 2 B
 
12 12
D 4
2 
B
  230.94
 12 0.005 12

B  log2 230.94  7.85  8 bits

All right reserved. Copyright © 2019. FKEE 75


Exercise 3.6
a) Consider the ramp 𝑥(𝑡) = 2𝑡 over (0, 1) .
For a sampling interval of 0.1 𝑠, and 𝐿 = 4,
obtain
i. the sampled signal
ii. quantized signal using rounding and truncation
iii. digital signal
iv. error signal, and compute the
v. quantization signal to noise ratio
vi. a statistical estimate of the 𝑆𝑁𝑅 in dB
All right reserved. Copyright © 2019. FKEE 76
Solution (a)
x  n  0, 0.2, 0.4, 0.6, 0.8,1.0,1.2,1.4,1.6,1.8, 2.0

D 20
   0.5
L 4


For rounding technique, consider  0.25
2

All right reserved. Copyright © 2019. FKEE 77


Quantization by rounding technique
x[n]

2
11

10
1
01

00
0 n

xround  n   0.25, 0.25, 0.25, 0.75, 0.57,1.25,1.25,1.25,1.75,1.75,1.75

All right reserved. Copyright © 2019. FKEE 78


xecq2nn  dB 15.415.4
SNR S  dB  10log
Q 10 log10  10.817.289dB
20 log 4  20log2  18.282 dB
110.2875

All right reserved. Copyright © 2019. FKEE 79


Quantization by up truncation
x[n]
technique

2 11

10

1 01

00

0 n

xup truncate  n  0.5, 0.5, 0.5,1.0,1.0,1.0,1.5,1.5, 2.0, 2.0, 2.0

All right reserved. Copyright © 2019. FKEE 80


Quantization by down truncation
x[n]
technique

11

1 10

01

0 00 n

xdown truncate  n   0, 0, 0, 0.5, 0.5,1.0,1.0,1.0,1.5,1.5,1.5

All right reserved. Copyright © 2019. FKEE 81


All right reserved. Copyright © 2019. FKEE 82
Exercise 3.6
b) The analog signal
𝜋
𝑥 𝑡 = 2𝑠𝑖𝑛 1000𝜋𝑡 − 𝑠𝑖𝑛 2000𝜋𝑡 +
2
is applied to an analog-to-digital converter (ADC) module for
converting the signal to digital format. The ADC has 3 bits
quantizer with  3Vp range.
i. Produce the first first EIGHT (8) sampled signals when the
sampling frequency is 12.5 kHZ
ii. Calculate the quantized signal and encoded digital signal to
represent the sampled signal obtained in (b) (i) using
quantization by rounding.
iii. Compute the quantization signal to noise ratio 𝑆𝑁𝑅 .

All right reserved. Copyright © 2019. FKEE 83


Exercise 3.6
c) Signal
𝑥 𝑡 = 3𝑐𝑜𝑠 30𝜋𝑡 + sin 3𝜋𝑡 + 𝑐𝑜𝑠 23𝜋𝑡
is sampled at rates of 10 Hz.
i. Produced the reconstructed signal.
ii. Generate the first SIX (6) quantized signal, based on your
answer in (c) (i).
iii. Formulate the digital signal, 𝑥𝑐 𝑡 using the truncation
and rounding quantization with level of 8 and dynamic
range of 8 Vp-p.

All right reserved. Copyright © 2019. FKEE 84


Exercise 3.6
d) The signal 𝑥 𝑡 = 4 cos 3000𝜋𝑡 + 2 sin 4000𝜋𝑡 is
quantized by rounding, using a 3-bit quantizer. Measure the
RMS quantization error and the quantization SNR (dB), for
the first 6 encoded samples.

All right reserved. Copyright © 2019. FKEE 85


Digital Processing of
Analog Signals
 The crux of the sampling theorem is not just the
choice of an appropriate sampling rate.
 More important, the processing of an analog signal
is equivalent to the processing of its Nyquist
sampled version, because it retains the same
information content as the original.
 It forms the link between analog and digital signal
processing & allows us to use digital techniques to
manipulate analog signals

All right reserved. Copyright © 2019. FKEE 86


Block diagram of a system for analog-to-
digital conversion

All right reserved. Copyright © 2019. FKEE 87


 Anti-aliasing filter @ Low pre-filter:
– limits the highest analog signal , choose the stuitable
sampling rate and prevent aliasing
 Sampler:
– operates above the Nyquist sampling rate and is usually a
zero-order-hold device
 Quantizer:
– limit the sampled signal values to a finite number of levels
(16-bit quantizers allow a signal-to-noise ratio close to 100
dB)
 Encoder:
– converts quantized values to binary bits

All right reserved. Copyright © 2019. FKEE 88


Block diagram of a system for
digital-to-analog conversion

All right reserved. Copyright © 2019. FKEE 89


 Decoder:
– process bit stream to discrete signal with quantized signal
values
 Hold circuit:
– reconstruct a staircase approximation of the discrete signal
 Lowpass analog post filter @ anti imaging filter:
– extracts the central period from the periodic spectrum,
removes the unwanted replicas (images) and results in a
smoothed the reconstructed signal

All right reserved. Copyright © 2019. FKEE 90


“If you are going to achieve excellence in big
things, you develop the habit in little matters.
Excellence is not an exception, it is a prevailing
attitude.”

All right reserved. Copyright © 2019. FKEE 91

You might also like