SAMPLING, QUANTIZATION AND CODING
1. Sampling
• Definition: Sampling is defined as ―The process of measuring the instantaneous
values of continuous-time signal in a discrete form.‖
• Sample is a piece of data taken from the whole data which is continuous in the time domain.
When a source generates an analog signal and if that has to be digitized, having 1s and 0s i.e., High
or Low, the signal has to be discretized in time. This discretization of analog signal is called as
Sampling.
The following figure indicates a continuous-time signal x (t) and a sampled signal xs (t). When x (t)
is multiplied by a periodic impulse train, the sampled signal xs (t) is obtained.
Sampling Rate
To discretize the signals, the gap between the samples should be fixed. That gap can be
termed as a sampling period Ts.
Sampling Frequency fs=1/Ts
Where,
Ts is the sampling time
fs is the sampling frequency or the sampling rate
Sampling frequency -is the reciprocal of the sampling period. This sampling frequency, can be
simply called as Sampling rate. The sampling rate denotes the number of samples taken per
second, or for a finite set of values.
15
For an analog signal to be reconstructed from the digitized signal, the sampling rate should be
highly considered. The rate of sampling should be such that the data in the message signal should
neither be lost nor it should get over-lapped. Hence, a rate was fixed for this, called as Nyquist
rate
Nyquist Rate
Suppose that a signal is band-limited with no frequency components higher than W Hertz.
That means, W is the highest frequency. For such a signal, for effective reproduction of the
original signal, sampling rate should be twice the highest frequency.
This means,
fs=2W
Where,
fs is the sampling rate
W is the highest frequency
This rate of sampling is called as Nyquist rate.
A theorem called, Sampling Theorem, was stated on the theory of this Nyquist rate.
Sampling Theorem
The sampling theorem, which is also called as Nyquist theorem, delivers the theory of sufficient
sample rate in terms of bandwidth for the class of functions that are band limited.
The sampling theorem states that, ― a signal can be exactly reproduced if it is sampled at the rate
fs which is greater than twice the maximum frequency W.
To understand this sampling theorem, let us consider a band-limited signal, i.e., a signal
whose value is non-zero between some –W and W Hertz.
Such a signal is represented as x(f)=0for|f|>W
For the continuous-time signal x (t), the band-limited signal in frequency domain, can be
represented as shown in the following figure.
16
.
We need a sampling frequency, a frequency at which there should be no loss of information,
even after sampling. For this, we have the Nyquist rate that the sampling frequency should be
two times the maximum frequency. It is the critical rate of sampling.
If the signal x(t) is sampled above the Nyquist rate, the original signal can be recovered, and if it
is sampled below the Nyquist rate, the signal cannot be recovered.
The following figure explains a signal, if sampled at a higher rate than 2w in the frequency domain.
The above figure shows the Fourier transform of a signal xs(t). Here, the information is
reproduced without any loss. There is no mixing up and hence recovery is possible.
The Fourier Transform of the signal
xs(t) is Xs (w)=1Ts∑n=−∞∞X(w−nw0)
Where Ts = Sampling Period and w0=2πTs
Let us see what happens if the sampling rate is equal to twice the highest
frequency (2W) That means,
Fs =2W
17
Where,
Fs is the sampling frequency
W is the highest frequency
The result will be as shown in the above figure. The information is replaced without any loss.
Hence, this is also a good sampling rate.
Now, let us look at the condition,
Fs <2W
The resultant pattern will look like the following figure
We can observe from the above pattern that the over-lapping of information is done, which
leads to mixing up and loss of information. This unwanted phenomenon of over-lapping is
called as Aliasing
18
Aliasing
Aliasing can be referred to as ―the phenomenon of a high-frequency component in the
spectrum of a signal, taking on the identity of a low-frequency component in the spectrum of
its sampled version.‖
The corrective measures taken to reduce the effect of Aliasing are −
• In the transmitter section of PCM, a low pass anti-aliasing filter is employed, before the
sampler, to eliminate the high frequency components, which are unwanted.
• The signal which is sampled after filtering, is sampled at a rate slightly higher than the
Nyquist rate.
This choice of having the sampling rate higher than Nyquist rate, also helps in the easier
design of the reconstruction filter at the receiver.
Scope of Fourier Transform
It is generally observed that, we seek the help of Fourier series and Fourier transforms in
analyzing the signals and also in proving theorems. It is because −
• The Fourier Transform is the extension of Fourier series for non-periodic signals.
• Fourier transform is a powerful mathematical tool which helps to view the signals in
different domains and helps to analyze the signals easily.
• Any signal can be decomposed in terms of sum of sines and cosines using this Fourier
transform. The digitization of analog signals involves the rounding off of the values which are
approximately equal to the analog values. The method of sampling chooses a few points on the
analog signal and then these points are joined to round off the value to a near stabilized
value. Such a process is called as Quantization.
19
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
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.
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.
20
The following figure shows the resultant quantized signal which is the digital form for the given
analog signal.
This is also called as Stair-case waveform, in accordance with its shape.
Types of Quantization
There are two types of Quantization - Uniform Quantization and Non-uniform Quantization.
1. The type of quantization in which the quantization levels are uniformly spaced is termed as a
Uniform Quantization.
2. 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.
There are two types of uniform quantization.
1. Mid-Rise type
2. Mid-Tread type.
21
The following figures represent the two types of uniform quantization
Figure 1 shows the mid-rise type and figure 2 shows the mid-tread type of uniform quantization.
1. 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.
2. 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.
Both the mid-rise and mid-tread type of uniform quantizer are symmetric about the origin.
Δ= (𝑚𝑎𝑥−𝑚𝑖𝑛)𝐿
𝑛𝑏=𝑙𝑜𝑔2𝐿
Quantization Error
For any system, during its functioning, there is always a difference in the values of its input and output.
The processing of the system results in an error, which is the difference of those [Link] difference
between an input value and its quantized value is called a Quantization Error.
A Quantizer is a logarithmic function that performs Quantization (rounding off the value). An
analog-to- digital converter (ADC) works as a quantizer.
22
The following figure illustrates an example for a quantization error, indicating the difference
between the original signal and the quantized signal.
Quantization Noise
It is a type of quantization error, which usually occurs in analog audio signal, while quantizing it
to digital. For example, in music, the signals keep changing continuously, where a regularity is
not found in errors. Such errors create a wideband noise called as Quantization Noise.
23