Bohrium
robot
新建

空间站广场

论文
Notebooks
比赛
课程
Apps
我的主页
我的Notebooks
我的论文库
我的足迹

我的工作空间

任务
节点
文件
数据集
镜像
项目
数据库
公开
Digital-Signal-Processing_06_Quantization of Signals_Introduction
English
notebook
Signal Processing
EnglishnotebookSignal Processing
喇叭花
发布于 2023-08-02
推荐镜像 :digital-signal-processing:Digital-Signal-Processing-Lecture
推荐机型 :c2_m4_cpu
Quantization of Signals
Introduction
Model of the Quantization Process
Example - Quantization of a sine signal
Properties
Applications

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.

analog_discrete_digital.png

代码
文本

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

  1. 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.

  2. 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

model_quantization.png

代码
文本

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.

代码
文本
[1]
import numpy as np
import matplotlib.pyplot as plt

N = 1024 # length of signal

# generate signal
x = np.sin(2*np.pi/N * np.arange(N))
# quantize signal
xi = np.round(3 * x)
xQ = 1/3 * xi
e = xQ - x

# plot (quantized) signals
fig, ax1 = plt.subplots(figsize=(10, 4))
ax2 = ax1.twinx()

ax1.plot(x, 'r', label=r'signal $x[k]$')
ax1.plot(xQ, 'b', label=r'quantized signal $x_Q[k]$')
ax1.plot(e, 'g', label=r'quantization error $e[k]$')
ax1.set_xlabel('k')
ax1.set_ylabel(r'$x[k]$, $x_Q[k]$, $e[k]$')
ax1.axis([0, N, -1.2, 1.2])
ax1.legend()

ax2.set_ylim([-3.6, 3.6])
ax2.set_ylabel('quantization index')
ax2.grid()
代码
文本

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() and np.ceil() instead of np.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

代码
文本

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.

代码
文本
English
notebook
Signal Processing
EnglishnotebookSignal Processing
点个赞吧
推荐阅读
公开
Digital-Signal-Processing_06_Quantization of Signals_Oversampling
EnglishnotebookSignal Processing
EnglishnotebookSignal Processing
喇叭花
发布于 2023-08-02
公开
Digital-Signal-Processing_06_Quantization of Signals_Oversampling
EnglishnotebookSignal Processing
EnglishnotebookSignal Processing
喇叭花
发布于 2023-08-02