Lab2_Sampling, Quantization Process (3)
Lab2_Sampling, Quantization Process (3)
EE093IU
DIGITAL SIGNAL PROCESSING LABORATORY
LAB 2
Class: ………………………………..
Date: ………………………………..
Page 1 of 4
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING (EE)
FUNDAMENTAL DISCUSSION
The conversion of an analog signal into a digital signal consists of three steps: sampling,
quantization, and coding. These are the three operations an ADC does. To illustrate them,
consider a sinusoid: 𝑥(𝑡) = 4𝑐𝑜𝑠(2𝜋𝑡). Its sampling period, according to the Nyquist sampling
rate condition, is:
𝜋
𝑇𝑠 ≤ Ω = 0.5 (sec/sample),
𝑚𝑎𝑥
as the maximum frequency of 𝑥(𝑡) is Ω𝑚𝑎𝑥 = 2𝜋. We let 𝑇𝑠 = 0.01 (sec/sample) to obtain a
sampled signal 𝑥𝑠 (𝑛𝑇𝑠 ) = 4𝑐𝑜𝑠(2𝜋𝑛𝑇𝑠 ) = 4𝑐𝑜𝑠(2𝜋 𝑛⁄100), a discrete sinusoid of period
100. The following scipt is used to get the sampled 𝑥[𝑛] and the quantized 𝑥𝑞 [𝑛] signals and
the quantization error 𝜀[𝑛]
Page 2 of 4
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING (EE)
The binary signal corresponding to the quantized signal is computed using the
binary codes ‘10’, ‘11’, ‘00’, and ‘01’ to the four possible levels of the quantizer. The
result is a sequence of 0s and 1s, each pair of digits sequentially corresponding to each
of the samples of the quantized signal.
LAB PROCEDURE
Problem 1:
Given the original signal to be 𝑥(𝑡) = 8𝑐𝑜𝑠(4𝜋𝑡). We sample the signal using the
sampling rate 𝑇𝑠 = 0.01 (𝑠𝑒𝑐/𝑠𝑎𝑚𝑝𝑙𝑒) to obtain a sampled signal 𝑥𝑠 (𝑛𝑇𝑠 ) = 8𝑐𝑜𝑠(2𝜋𝑛𝑇𝑠 ) =
𝑛
8𝑐𝑜𝑠 (4𝜋 ). Find the quantization signals 𝑥𝑞 [𝑛], given that the number of quantization
100
Problem 2:
Using the same signals 𝑥(𝑡) as in Problem 1, obtain and plot the quantization error
𝜀[𝑛], in which:
𝜀[𝑛] = 𝑥[𝑛] − 𝑥𝑞 [𝑛]
Also, obtain and display the code sequence represent the 8 levels of quantization in
Problem 1, follow by the rules:
Problem 3:
Page 3 of 4
INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING (EE)
Quantization is done by replacing each value of an analog signal 𝑥(𝑡) by the value of
the nearest quantization level. To exemplify this operation, let’s simulate a unipolar ADC
(Analog to Digital Converter) having the technical specifications: R Volts (full-scale range)
and B (number of bits), in which R and B are the to be input using input function.
(c) On the same graph, use the plot and stem functions to display the input signal and quantized
signal, respectively;
Page 4 of 4