You are on page 1of 9

BME-303 Bio-Signal Processing

EXPERIMENT 03

OBJECTIVE

To study and perform Quantization using MATLAB and Simulink.

EQUIPMENTS

 Personal Computer (PC)


 MATLAB Software.

THEORY

Quantization is the process of mapping input values from a large set (often a continuous set)
to output values in a (countable) smaller set, often with a finite number of elements. To
convert a discrete time continuous value (DTCV) signal into a discrete time discrete value
(DTDV) signal quantization is used. The following figure shows how an analog signal gets
quantized. The blue line represents analog signal while the brown one represents the
quantized signal.

QUANTIZATION PROCESS

The simplest way to quantize a signal is to choose the digital amplitude value closest to the
original analog amplitude. This example shows the original analog signal (green), the
quantized signal (black dots), the signal reconstructed from the quantized signal (yellow) and
the difference between the original signal and the reconstructed signal (red). The difference
between the original signal and the reconstructed signal is the quantization error and, in this
simple quantization scheme, is a deterministic function of the input signal.

Figure 3.1: Showing original analog signal (green), the quantized signal (black dots),
and the signal reconstructed from the quantized signal (yellow).

Quantizing an Analog Signal

The analog-to-digital converters perform this type of function to create a series of digital
values out of the given analog signal. The following figure represents an analog signal. This
signal to get converted into digital, has to undergo sampling and quantizing.

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

Figure 3.2: Analog Signal

The quantizing of an analog signal is done by discretizing the signal with a number of
quantization levels. Quantization is representing the sampled values of the amplitude by a
finite set of levels, which means converting a continuous-amplitude sample into a discrete-
time signal. The following figure shows how an analog signal gets quantized. The blue line
represents analog signal while the brown one represents the quantized signal.

Figure 3.3: Analog & Quantized Signal

Both sampling and quantization result in the loss of information. The quality of a Quantizer
output depends upon the number of quantization levels used. The discrete amplitudes of the
quantized output are called as representation levels or reconstruction levels. The spacing
between the two adjacent representation levels is called a quantum or step-size. The
following figure shows the resultant quantized signal which is the digital form for the given
analog signal.

Figure 3.4: Quantized signal

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

This is also called as Stair-case waveform, in accordance with its shape.

Types of Quantization

There are two types of Quantization

 Uniform Quantization.

 Non-uniform Quantization.

Uniform Quantization

The type of quantization in which the quantization levels are uniformly spaced is termed as a
Uniform Quantization.

Figure 3.5: Uniform Quantization

Types of Uniform Quantization

There are two types of uniform quantization.

 Mid-Rise type.
 Mid-Tread type.

MID-RISE TYPE

The Mid-Rise type is so called because the origin lies in the middle of a raising part of the
stair-case like graph. The quantization levels in this type are even in number.

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

Figure 3.6: Mid-Rise type Uniform Quantization

MID-TREAD TYPE

The Mid-tread type is so called because the origin lies in the middle of a tread of the stair-
case like graph. The quantization levels in this type are odd in number.

Figure 3.7: Mid-Tread Type Uniform Quantization

Non-Uniform Quantization

The type of quantization in which the quantization levels are unequal and mostly the relation
between them is logarithmic, is termed as a Non-uniform Quantization.

Figure 3.8: Non-Uniform Quantization

Quantization Error

Quantization error is the difference between the analog signal and the closest available digital
value at each sampling instant from the A/D converter. Quantization error also introduces
noise, called quantization noise, to the sample signal. The higher the resolution of the A/D
converter, the lower the quantization error and the smaller the quantization noise.

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

Figure 3.9: Quantization Error

LAB TASK 01

Plot sine wave using Simulink. Convert the analog signal to digital signal using quantizer.
Observe the signal at different quantization interval.

BLOCK DIAGRAM

Figure 3.10: Block diagram of ADC converter.

PROCEDURE
1. On the command window of MATLAB type “Simulink”.
2. From the Simulink tab select the blank model option.
3. Place the sine wave bock from Simulink/sources.
4. Place the Time Scopes.
5. Go to the Simulink tab and select the quantizer from the discontinuities option.
6. Set the sine wave function at Amplitude of 1 and frequency at 2.
7. Set the time option for the sine wave function to “Use Simulation time”.
8. Observe the waveforms at Quantizer value of 0.1, 0.5, 1.0 and 1.5.

OBSERVATIONS:

Fig Fig no. 04: Quantization level 1.5


Figno.
no.03:
01:Quantization
Quantizationlevel
level01
0.1 Fig no. 02: Quantization level 0.5

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

RESULT:

The original sine wave signal will be quantized at various quantization intervals when the
Simulink model is run as instructed. The signal's level of discretization is determined by these
intervals, which include 0.1, 0.5, 1.0, and 1.5. While higher intervals introduce more
quantization error and cause the waveform to exhibit a "staircase" effect, smaller intervals
will produce a quantized signal that nearly matches the original sine wave. These quantized
waveforms will be visibly displayed for observation and study in the Time Scopes offered by
the model.

LAB TASK 02
Perform quantization on a given signal using MATLAB.

x(t) = A*sin(2*pi*F*t)
Here,
Amplitude (A) = 1m
Frequency(F)=2 Hz.
Note: Attached the results including code and interpret it.

CODE:
t = 0:0.001:1;

A = 1;

F = 2;

% Generate the original sinusoidal signal

x = A * sin(2 * pi * F * t);

subplot(3, 1, 1)
Department of Biomedical Engineering, SHU.
plot(t, x)

title('Original Signal')
BME-303 Bio-Signal Processing

CONCLUSION

CODE INTERPRETATION:

This MATLAB code creates a sinusoidal signal with a frequency of 2 Hz and an


amplitude of 1 throughout a time range of 0 to 1 second. It then demonstrates
quantization with different bit depths, visualized in three subplots.

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

OUTPUT:

Original Signal
1

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
3-Bit Quantization
1

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
5-Bit Quantization
1

-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

Fig no. 05: Quantized outputs.

CONCLUSION:

Using MATLAB and Simulink, we study and perform quantization in this lab. Quantization
is the process of converting values from a large, frequently continuous collection of inputs
into values from a smaller, usually countable set with a finite number of elements.

Post Lab Tasks

Question 1

Explain the difference between quantization and sampling?

Department of Biomedical Engineering, SHU.


BME-303 Bio-Signal Processing

The fundamental ideas of quantization and sampling each have a specific use in the field of
signal processing. By choosing a finite number of data points at predetermined time intervals,
sampling is the process of turning a continuous-time signal into a discrete-time signal. As it
enables us to work with signals in a computer or digital system, this action is essential for
digital signal processing. Quantization is the process of transforming a sampled signal's
amplitude or value from a continuous range to a finite set of discrete values. It discretizes the
amplitude values of the signal, thus presenting in a different way. The precision and dynamic
range of the digital signal are impacted by quantization, which also dictates the number of
bits utilized to represent each sample during analog-to-digital conversion.

Question 2

Write some applications of Quantization?

Some of the applications of quantization are as following:

 Machine Learning
 Digital Signal Processing (DSP)
 Analog-to-Digital Conversion (ADC)
 Quantum Mechanics
 Image Compression
 Speech Coding
 Audio Compression
 Financial Modeling
 Video Coding

Department of Biomedical Engineering, SHU.

You might also like