![](https://bohrium.oss-cn-zhangjiakou.aliyuncs.com/article/16948/ee7047342b754ffbba491afa925cdc6b/d0797800-9e09-4fba-98df-61602d0f387b.png?x-oss-process=image/resize,w_100,m_lfit)
![](https://cdn1.deepmd.net/bohrium/web/static/images/level-v2-3.png?x-oss-process=image/resize,w_50,m_lfit)
Quantization of Signals
🏃🏻 Getting Started Guide
This document can be executed directly on the Bohrium Notebook. To begin, click the Connect button located at the top of the interface, then select the digital-signal-processing:Digital-Signal-Processing-Lecture Image and choose your desired machine configuration to proceed.
📖 Source
This Notebook is from a famous Signal Processing Lecture. The notebooks constitute the lecture notes to the masters course Digital Signal Processing read by Sascha Spors, Institute of Communications Engineering, Universität Rostock.
This jupyter notebook is part of a collection of notebooks on various topics of Digital Signal Processing. Please direct questions and suggestions to Sascha.Spors@uni-rostock.de.
Introduction
Digital signal processors and general purpose processors can only perform arithmetic operations within a limited number range. So far we considered discrete signals with continuous amplitude values. These cannot be handled by processors in a straightforward manner. Quantization is the process of mapping a continuous amplitude to a countable set of amplitude values. This refers also to the requantization of a signal from a large set of countable amplitude values to a smaller set. Scalar quantization is an instantaneous and memoryless operation. It can be applied to the continuous amplitude signal, also referred to as analog signal or to the (time-)discrete signal. The quantized discrete signal is termed as digital signal. The connections between the different domains are illustrated in the following.
Model of the Quantization Process
In order to discuss the effects of quantizing a continuous amplitude signal, a mathematical model of the quantization process is required. We restrict our considerations to a discrete real-valued signal . The following mapping is used in order to quantize the continuous amplitude signal
where and denote real-valued mapping functions, and a rounding operation. The quantization process can be split into two stages
Forward quantization The mapping maps the signal such that it is suitable for the rounding operation. This may be a scaling of the signal or a non-linear mapping. The result of the rounding operation is an integer number , which is termed as quantization index.
Inverse quantization The mapping , maps the quantization index to the quantized value such that it constitutes an approximation of . This may be a simple scaling or non-linear operation.
The quantization error (quantization noise) is defined as
Rearranging yields that the quantization process can be modeled by adding the quantization error to the discrete signal
Example - Quantization of a sine signal
In order to illustrate the introduced model, the quantization of one period of a sine signal is considered
using
where denotes the nearest integer function and the quantization index. The quantized signal is then given as
The discrete signals are not shown by stem plots for ease of illustration.
![](https://bohrium.oss-cn-zhangjiakou.aliyuncs.com/article/16948/ef3ad1b07f6948fb912940ace6e63d68/7839979d34de4dafb1ed191ce731ba1b.png)
Exercise
- Investigate the quantization error . Is its amplitude bounded?
- If you would represent the quantization index (shown on the right side) by a binary number, how much bits would you need?
- Try out other rounding operations like
np.floor()
andnp.ceil()
instead ofnp.round()
. What changes?
Solution: It can be concluded from the illustration that the quantization error is bounded as . There are in total 7 quantization indexes needing 3 bits in a binary representation. The properties of the quantization error are different for different rounding operations.
Properties
Without knowledge of the quantization error , the signal cannot be reconstructed exactly from its quantization index or quantized representation . The quantization error itself depends on the signal . Therefore, quantization is in general an irreversible process. The mapping from to is furthermore non-linear, since the superposition principle does not hold in general. Summarizing, quantization is an inherently irreversible and non-linear process. It potentially removes information from the signal.
Applications
Quantization has widespread applications in Digital Signal Processing. For instance
- Analog-to-Digital conversion
- Lossy compression of signals (speech, music, video, ...)
- Storage and transmission (Pulse-Code Modulation, ...)
Copyright
This notebook is provided as Open Educational Resource. Feel free to use the notebook for your own purposes. The text is licensed under Creative Commons Attribution 4.0, the code of the IPython examples under the MIT license. Please attribute the work as follows: Sascha Spors, Digital Signal Processing - Lecture notes featuring computational examples.
![](https://bohrium.oss-cn-zhangjiakou.aliyuncs.com/article/16948/ee7047342b754ffbba491afa925cdc6b/d0797800-9e09-4fba-98df-61602d0f387b.png?x-oss-process=image/resize,w_100,m_lfit)
![](https://cdn1.deepmd.net/bohrium/web/static/images/level-v2-3.png?x-oss-process=image/resize,w_50,m_lfit)
![](https://bohrium.oss-cn-zhangjiakou.aliyuncs.com/article/16948/ee7047342b754ffbba491afa925cdc6b/d0797800-9e09-4fba-98df-61602d0f387b.png?x-oss-process=image/resize,w_100,m_lfit)
![](https://cdn1.deepmd.net/bohrium/web/static/images/level-v2-3.png?x-oss-process=image/resize,w_50,m_lfit)