C1 - Sampling and Quantization - 2
C1 - Sampling and Quantization - 2
QUANTIZATION
LATHI AND PM CHAPTER 6
P r e p a r e d b y : D r. N i k N u r Wa h i d a h N i k H a s h i m
Department of Mechatronics Engineering
International Islamic University Malaysia (IIUM)
INTRODUCTION
Analog to Digital Conversion
ADC (Analog to Digital Converter) converts analog signal x(t) into the digital signal sequence
x(n).
Analog-to-digital conversion (or digitization) consists of the sampling and quantization
processes.
The sampling process depicts a continuously varying analog signal as a sequence of values.
The quantization process approximates a waveform by assigning an actual number for each
sample.
A/D converter
1. The band-limited signal x(t) is sampled at uniformly spaced instants of time, nT, where n is a
positive integer, and T is the sampling period in seconds. The result is a discrete-time signal,
x(nT), with continuous amplitude value.
2. The amplitude of each discrete-time sample is quantized into one of the 2B levels, where B is
the number of bits of the ADC. The discrete amplitude levels are represented (or encoded)
into distinct binary words x(n) with a fixed wordlength B. This binary sequence, x(n), is the
digital signal for DSP hardware.
SAMPLING
Sampling
An ideal sampler can be considered as a switch which is periodically open and
closed every T seconds
1
T
fs
where fs is the sampling frequency (or sampling rate) in Hertz (Hz, or cycles
per second).
Continuous-time signal can take any frequency in the range –∞ to +∞
However, when we sample a CT by Fs,
3) Consider the analog signal 𝑥𝑎 𝑡 = 3 cos 2000𝜋𝑡 + 5 sin 6000𝜋𝑡 + 10 cos 12000𝜋𝑡
a) What is the Nyquist rate for this signal?
b) Assume now that we sample this signal using a sampling rate of 5000 sample/s. What is
the discrete time signal, 𝑥𝑛 (𝑛) obtained after sampling?
c) What is the analog signal, 𝑥 𝑛 (𝑡) we can reconstruct from the samples ?
Impulse Sampling of Continuous Time
Signal
The signal x(nT) is an impulse train with values equal to the
amplitude of x(t) at time nT where n = 0, 1, …,
The signal is zero except at sampling intervals t = nT.
Sampling of Continuous Signal
Sampling of Continuous Signal
Aliasing Distortion
Aliasing occurs when the sampled frequency is too small.
𝐹𝑠 < 2𝐹𝑚𝑎𝑥
When aliasing occurs we can no longer examine the spectrum
of the sampled signal in order to obtain the original CT signal.
Aliasing can be avoided by following the Shannon’s sampling
theory.
Sampling of Sinusoids
Sampling of Sinusoids
Sampling of Sinusoids
Sampling of Sinusoids
QUANTIZATION
(Uniform)
Quantizing and Encoding
The quantizing and encoding process is a method of representing the sampled
discrete-time signal x(nT) as a binary number that can be processed with DSP
hardware.
The signal must be quantized to a digital signal x(n) with a finite number of
bits.
If the wordlength of an ADC is b bits, there are 2b different values (levels) that
can be used to represent a sample.
Quantization is therefore a process that represents an analog-valued sample
x(nT) with its nearest level that corresponds to the digital signal x(n).
Quantizing and Encoding
During the quantization process, errors that cannot be removed are introduced.
The difference between the quantized number and the original value is defined as
quantization error.
The figure below uses two bits to define four equally spaced levels (00, 01, 10, 11) to
classify the signal into four subranges.
Quantization level
Quantization errors
11
x(t)
10
01
00 Time, t
0 T 2T 3T
Quantization Error
Quantization error is a sequence 𝑒𝑞 (𝑛) defined as the difference between the
quantized value and the actual sample value,
𝒆𝒒 𝒏 = 𝒙𝒒 𝒏 − 𝒙(𝒏)
The rounding quantizer assigns each sample x(n) to the nearest quantization level.
The quantization error 𝒆𝒒 𝒏 in rounding is limited to the range of
∆ ∆
− ≤ 𝒆𝒒 𝒏 ≤
2 2
If xmin and xmax represent the minimum and maximum value of x(n) and L = 2𝑏
is the number of quantization levels, then the quantization steps is
𝑥𝑚𝑎𝑥 − 𝑥𝑚𝑖𝑛
∆=
L
Example of Quantization Error
Consider a discrete time signal x(n) below
obtained by sampling the analog exponential
𝑥 𝑎 𝑡 = 0.9𝑡 , 𝑡 ≥ 0 and with a sampling
frequency of 1Hz.
Analysis of Quantization Error
The effects of quantization on the performance of an ADC can be measured using
Signal-to-Quantization-Noise Ratio (SQNR) where,
𝑆𝑄𝑁𝑅 = 1.76 + 6.02𝑏
SQNR increases ~6dB for every bit added to the wordlength.
We assume the quantization error is random in nature and model it as noise that is
added to the original signal.
The mean square error power, 𝑃𝑞 is
Example
Quantization
𝜋
1) Supposed 𝑥 𝑛 = 6.35 cos 𝑛. How many bits required in the ADC if the quantization step
10
is given as,
a) ∆= 0.1
b) ∆= 0.02
2) A digital communication link carries binary coded words representing samples of an input
signal 𝑥 𝑛 = 5 cos 2000𝜋𝑡 + 2 cos 6000𝜋𝑡 + 4 sin 10000𝜋𝑡 which is sampled at a rate of
8kHz. Each input sample is quantized to achieve a minimum SQNR of 40dB.
a) Obtain an expression for the resulting discrete time signal x(n).
b) Determine the resulting analog signal after the sampled signal is reconstructed.
c) Determine the level of quantization, L and bit rate, b at which the link operates.