You are on page 1of 59

Lecture # 3

(a) Formatting
(b) Sources of Corruption
(c) PCM
(d) Uniform and Non-Uniform
Quantization
Sheraz Alam Khan
Asst. Professor, Department of Engineering
Sheraz.alam@gmail.com
National University of Modern Language

1
Outline

Formatting of Digital Data


Formatting of Analog Information
Sampling
Sources of Corruption in quantized Signal
PCM

2
Formatting and Source encoding
The goal of the first essential signal step FORMATTING is to ensure
that the message (or source signal) is compatible with digital
processing.
Textual information is transformed in to binary digits by use of a
coder
Analog info in formatted using three separate processes: sampling,
Quantization and coding
Transmit formatting is a transformation from source information to
digital symbols. When data compression in addition to formatting
is employed, the process is termed as source coding.
In all cases the result of formatting is a sequence of binary digits

Data already in a digital format would bypass the formatting


function 3
Formatting..
Transmit and Receive Formatting
Transition from information source digital symbols information
sink

4
2.2 Formatting Textual Data
A textual information is a sequence of alphanumeric characters. It is
transformed into binary digits by use of a coder.
Alphanumeric and symbolic information are encoded into digital bits
using one of several standard formats, e.g, ASCII, EBCDIC
When digitally transmitted, the characters are first encoded into, a
sequence of bits, called a bit stream or baseband signal
Group of k bits is called symbol M = 2k
A system using a symbol set size of M is referred to as M-ary system
For example: K=1 means binary, K=2 means quaternary
The value of k or M represents an important initial choice in the
design of any DCS

5
Example of Messages, characters, and symbols

Figure 2.5 (a): Messages, characters, and symbols


8-ary example

6
Example of Messages, characters, and symbols

Figure 2.5 (b): Messages, characters, and symbols


32-ary example

7
2.4 Formatting Analog Information
Structure of Digital Communication Transmitter

Analog to Digital Conversion

8
Sampling
Sampling is the processes of converting continuous-time analog signal,
xa(t), into a discrete-time signal by taking the samples at discrete-time
intervals
Sampling analog signals makes them discrete in time but still
continuous valued
If done properly (Nyquist theorem is satisfied), sampling does not
introduce distortion
Sampled values:
The value of the function at the sampling points
Sampling interval:
The time that separates sampling points (interval b/w samples), Ts
If the signal is slowly varying, then fewer samples per second will
be required than if the waveform is rapidly varying
So, the optimum sampling rate depends on the maximum
frequency component present in the signal 9
Sampling..
Sampling Rate (or sampling frequency fs):
The rate at which the signal is sampled, expressed as the number
of samples per second (reciprocal of the sampling interval),1/Ts =
fs
Nyquist Sampling Theorem (or Nyquist Criterion):
If the sampling is performed at a proper rate, no info is lost about
the original signal and it can be properly reconstructed later on
Statement:
If a signal is sampled at a rate at least, but not exactly
equal to twice the max frequency component of the
waveform, then the waveform can be exactly reconstructed
from the samples without any distortion

f s 2 f max 10
Sampling
If fs < 2B, aliasing (overlapping of the spectra) results
Ifsignal is not strictly bandlimited, then it must be passed
through Low Pass Filter (LPF) before sampling
Fundamental Rule of Sampling (Nyquist Criterion)
The value of the sampling frequency fs must be greater
than twice the highest signal frequency fmax of the signal
Types of sampling
Ideal (Impulse) Sampling
Natural Sampling
Flat-Top Sampling

11
1. Ideal Sampling ( or Impulse Sampling)
Consider the case of ideal sampling with a sequence of unit
impulse function.

12
Ideal Sampling..
It is accomplished by the multiplication of the analog signal x(t) by
the uniform train of impulses (comb function)
Consider the instantaneous sampling of the analog signal xs(t), which
is the product of x(t) with a periodic train of unit impulse function
x(t)

Train of impulse functions select sample values at regular intervals



xs (t ) x(t ) (t nTs )
n

Where Ts is the sampling period and (t) is the unit impulse or Dirac
delta function.
13
Ideal Sampling..

1
2
The Fourier series
n
( t nT s )
Ts

n
e jn s t , s
Ts
1 jnst
xs (t ) x(t ) e
Therefore Ts n
Take Fourier Transform (frequency convolution) which is zero outside the
interval (-fm < f < fm).
jn s t 1
1
Xs( f ) X ( f )* e X ( f )* e s
jn t

Ts n Ts n

1
s
X s ( f ) X ( f ) * ( f nf s ), f s
Ts n 2

1 1 n
Xs( f )
Ts

n
X ( f nf s )
Ts

n
X(f
Ts
)

14
Ideal Sampling..
This shows that the Fourier Transform of the sampled signal
is the Fourier Transform of the original signal at rate of 1/Ts

15
Ideal Sampling..
This means that the output is simply the replication of the
original signal at discrete intervals, e.g.

16
Ideal Sampling..

As long as fs> 2fm,no overlap of repeated replicas X(f - n/Ts)


will occur in Xs(f)
fs fm fm fs 2 fm
Minimum Sampling Condition:

Sampling Theorem: A finite energy function x(t) can be


completely reconstructed from its sampled value x(nTs) with
2 f (t nTs )
sin

x(t ) Ts x(nTs )
2Ts

n (t nT s )



T
n
s x(nTs ) sin c(2 f s (t nTs ))
1 1
provided that => Ts 17
fs 2 fm
2. Natural or Practical Sampling
In practice we cannot perform ideal sampling
It is not practically possible to create a train of impulses
Thus a non-ideal approach to sampling must be used
We can approximate a train of impulses using a train of very
thin rectangular pulses:

t nTs
x p (t )
n

Note:
Fourier Transform of impulse train is another impulse train
Convolution with an impulse train is a shifting operation
18
Practical Sampling..
If we multiply x(t) by a
train of rectangular pulses
xp(t), we obtain a gated
waveform that
approximates the ideal
sampled waveform, known
as natural sampling or
gating (see Figure 2.8)
x s (t ) x (t ) x p (t )

x (t )
n
c n e j 2 nf s t

X s ( f ) [ x ( t ) x p ( t )]


n
c n [ x ( t ) e j 2 n f s t ]


n
c n X [ f n19f s ]
Practical Sampling..
The sampling here is termed as natural sampling, since the top of each
pulse in the xs(t) sequence retains the shape of its corresponding analog
segment during the pulse interval.
Each pulse in xp(t) has width Ts and amplitude 1/Ts
Xs (f) is the replication of X(f) periodically every fs Hz
Xs (f) is weighted by Cn (Fourier Series Coefficients) of the pulse train,
compared with a constant value in the impulse sampled case.
The problem with a natural sampled waveform is that the tops of the
sample pulses are not flat
It is not compatible with a digital system since the amplitude of each
sample has infinite number of possible values
Another technique known as flat top sampling is used to alleviate this
problem

20
3. Flat-Top Sampling (Sample-and-Hold)
Simplest and most popular method
Here, the pulse is held to a constant height for the whole
sample period
Flat top sampling is obtained by the convolution of the signal
obtained after ideal sampling with a unity amplitude
rectangular pulse, p(t)
This technique is used to realize Sample-and-Hold (S/H)
operation
In S/H, input signal is continuously sampled and then the
value is held for as long as it takes to for the A/D to acquire
its value

21
Flat-Top Sampling.

Flat top sampling (Time Domain)

x '(t ) x(t ) (t )
xs (t ) x '(t )* p(t )


p(t )* x(t ) (t ) p(t )* x(t ) (t nTs )
n 22
Flat-Top Sampling.
Taking the Fourier Transform will result to

X s ( f ) [ x s ( t )]


P ( f ) x ( t ) ( t nTs )
n
1

P( f ) X ( f ) * ( f nf s )
Ts n

1
P( f )
Ts

n
X ( f nf s )

where P(f) is a sinc function


Flat-Top Sampling.
Flat top sampling becomes identical to ideal sampling as the
width of the pulses become shorter(see figure 2.8f)
The most obvious effect of the hold operation is the
significant attenuation of the higher-frequency spectral
replicates (compare figure 2.8f to 2.6f), which is a desired
effect
Additional analog post-filtering is usually required to finish
the filtering process by further attenuating the residual
spectral components located at multiples of the sample rate.

24
Aliasing
One way of recovering the original signal from sampled signal Xs(f)
is to pass it through a Low Pass Filter (LPF) as shown below

If fs > 2B then we recover x(t) exactly


Else we run into some problems and
signal is not fully recovered
25
Aliasing
Undersampling and Aliasing
If the waveform is undersampled (i.e. fs < 2B) then there will be
spectral overlap in the sampled signal

The signal at the output of the filter will be


different from the original signal spectrum
This is the outcome of aliasing!
This implies that whenever the sampling condition is not met, an
irreversible overlap of the spectral replicas is produced 26
Solution 1: Anti-Aliasing Analog Filter

Allphysically realizable signals are not completely


bandlimited
Ifthere is a significant amount of energy in frequencies
above half the sampling frequency (fs/2), aliasing will
occur
Aliasingcan be prevented by first passing the analog signal
through an anti-aliasing filter (also called a pre-filter)
before sampling is performed
The anti-aliasing filter is simply a LPF with cutoff
frequency equal to half the sample rate
28
29
Pre-filtering:
Aliasing is
prevented by
forcing the
bandwidth of the
sampled signal to
satisfy the
requirement of
the Sampling
Theorem

Small transition B.W means sharp cut-offs, but trade-off is filter complexity
and cost. Practically transition B.W is 10 to 20% of signal B.W:
30
Engineering version of Nyquist rate:
Aliasing filters results in a loss of some of the signal information
For this reason, the sample rate, cut-off B.W, and the filer type
selected for a particular signal B.W are all interrelated
Solution 2: Over Sampling and Filtering in the Digital
Domain
The signal is passed through a low performance (less
costly) analog low-pass filter to limit the bandwidth.
Sample the resulting signal at a high sampling
frequency.
The digital samples are then processed by a high
performance digital filter and down sample the
resulting signal.
Why Oversample?
Most economic solution for the task of ADC or DAC
High performance analog equipment is much more costly than DSP
equipment to perform same task
Due to transition period of analog filter, the B.W of O/P signal is
increased by some amount ft
Consequently the sampling rate must be increased to (2fm+ ft )
E.g. for a CD signal having a two sided B.W of 40 kHz, sampled at 44.1
kHz
our intuition is to use analog filters with small transition B.W(sharp
cut-off)but this induces distortion and high cost because of higher
order filters (required for sharp cut-off)
The solution is to use Oversampling
E.g. rather than sampling at 44 kHz (transition B.W 4.1 kHz) implemented
with 10th order elliptic filter.we might choose 176.4 kHz with a
transition B.W of 136.4 kHz implemented with 4rth order elliptic filter
33
Why Oversample?

34
Summary Of Sampling

Ideal Sampling
xs (t ) x (t ) x (t ) x (t ) (t nTs )
(or Impulse Sampling) n


n
x ( nTs ) (t nTs )
Natural Sampling
(or Gating)
xs (t ) x (t ) x p (t ) x (t ) cn e j 2 nf s t
n

Flat-Top Sampling


xs (t ) x '(t ) * p (t ) x(t ) (t nTs ) * p (t )
For all sampling techniques n
If fs > 2B then we can recover x(t) exactly
If fs < 2B spectral overlapping known as aliasing will occur
Example 1:
Consider the analog signal x(t) given by

x(t ) 3cos(50 t ) 100sin(300 t ) cos(100 t )


What is the Nyquist rate for this signal?
Example 2:
Consider the analog signal xa(t) given by

xa (t ) 3cos 2000 t 5sin 6000 t cos12000 t


What is the Nyquist rate for this signal?
What is the discrete time signal obtained after sampling, if
fs=5000 samples/s.
What is the analog signal x(t) that can be reconstructed from
the sampled values?
Practical Sampling Rates

Speech
- Telephone quality speech has a bandwidth of 4 kHz
(actually 300 to 3300Hz)
- Most digital telephone systems are sampled at 8000
samples/sec
Audio:
- The highest frequency the human ear can hear is
approximately 15kHz
- CD quality audio are sampled at rate of 44,000
samples/sec
Video
- The human eye requires samples at a rate of at
least 20 frames/sec to achieve smooth motion
Signal interface for Digital System
Not compatible
with digital system

38
2.5 Sources of Corruption in the sampled,
quantized and transmitted pulses
Sampling and Quantization Effects
Quantization (Granularity) Noise: Results when
quantization levels are not finely spaced apart
enough to accurately approximate input signal
resulting in truncation or rounding error.
Quantizer Saturation or Overload Noise: Results
when input signal is larger in magnitude than highest
quantization level resulting in clipping of the signal.
Timing Jitter: Error caused by a shift in the sampler
position. Can be isolated with stable clock
reference.
Sources of Corruption
Channel Effects
Channel Noise:
Thermal noise, interference from users and circuit switching
transients etc. may induce errors that degrade
reconstructed signal quality
The rapid degradation of the o/p signal quality with channel
induced errors is called threshold effect
A large difference in behavior can occur for a very small
changes in a channel noise level
Intersymbol Interference (ISI):
Channel is always bandlimited thus spreading or dispersing the
signal waveforms passing through it
When the channel B.W is close to the signal B.W, the spreading
will exceed a symbol duration and cause signal pulses to
overlap.this overlapping is termed as ISI
ISI causes system degradationerrors in detection
40
Signal to Quantization Noise Ratio
The level of quantization noise is dependent on how close any
particular sample is to one of the L levels in the converter

For a speech input, this quantization error resembles a noise-


like disturbance at the output of a DAC converter
Uniform Quantization
A quantizer with equal quantization level is a Uniform Quantizer
Each sample is approximated within a quantile interval
Uniform quantizers are optimal when the input distribution is uniform

i.e. when all values within the range are equally


likely

q q
e
2 2
Most ADCs are implemented using uniform quantizers
Error of a uniform quantizer is bounded by
Signal to Quantization Noise Ratio
The mean-squared value (noise variance) of the quantization error
is given by: q/2 q/2
1 1 q/2
2 e 2 p(e)de e 2 de e 2 de
q / 2 q / 2 q q q / 2
Corresponds to the avg. q/2 2
quantization to noise 1q e q
3

power 3 q / 2 12

The peak power of the analog signal (normalized to 1 Ohms )can be expressed
as: V p2 V pp L2 q 2
2
P
1 2 4

Therefore the Signal to Quantization Noise Ratio is given by:
Ratio of peak signal 2 2
power to avg. S N R q L 2q / 4 3 L 2
quantization noise power q /12

Where p(e)= 1/q = uniform pdf of quantization error


L= number of quantization levels
SNRq improves as a function of the number of quantization levels squared
Signal to Quantization Noise Ratio
If q is the step size, then the maximum quantization error that
can occur in the sampled output of an A/D converter is q

V
q pp
L

where L = 2n is the number of quantization levels for the


converter. (n is the number of bits).

Since L = 2n , SNR = 22n or in decibels

S


10 log (2 2 n ) 6 n dB
N dB 10
2.6 Pulse Code Modulation (PCM)
Pulse Code Modulation refers to a digital baseband signal
that is generated directly from the quantizer output
Sometimes the term PCM is used interchangeably with
quantization

The Choice of voltage levels is guided by two constraints:


First, the quantile intervals between the levels must be equal
It is convenient to choose levels that have zero mean
(symmetrical around zero)
45
PCM.

46
47
PCM..
Binary codes are assigned to each sample according to gray
codes ( Single bit change per adjacent symbol)
Increasing the no. of levels reduces the quantization noise
but at what cost?
Delay is avoided for real-time communication thus the
transmission time of each symbol must be same regardless of
how many bits are used to represent the symbol
Hence for more bits per sample, the bits have to move
faster; in other words they must be replaced by skinnier bits
That is; The increased data rate is at the cost of more B.W
since

48
PCM..
Advantages of PCM:
Relatively inexpensive
Easily multiplexed: PCM waveforms from different
sources can be transmitted over a common digital
channel (TDM)
Easily regenerated: useful for long-distance
communication, e.g. telephone
Better noise performance than analog system
Signals may be stored and time-scaled efficiently (e.g.,
satellite communication)
Efficient codes are readily available
Disadvantage:
Requires wider bandwidth than analog signals
49
Non-uniform Quantization
Non-uniform quantizers have unequally spaced levels
The spacing can be chosen to optimize the Signal-to-Noise
Ratio for a particular type of signal
It is characterized by:
Variable step size
Quantizer size depend on signal size
Many signals such as speech have a non-uniform
distribution, See Figure on next page (Fig. 2.17)

50
Non-uniform Quantization.
Basic principle is to use more levels at regions with large probability
density function (pdf)
Concentrate quantization levels in areas of largest pdf
Or use fine quantization (small step size) for weak signals and
coarse quantization (large step size) for strong signals

51
Non-uniform quantization using companding
Companding is a method of reducing the number of bits required in
ADC while achieving an equivalent dynamic range or SQNR
In order to improve the resolution of weak signals within a converter,
and hence enhance the SQNR, the weak signals need to be enlarged,
or the quantization step size decreased, but only for the weak
signals
But strong signals can potentially be reduced without significantly
degrading the SQNR or alternatively increasing quantization step size
The compression process at the transmitter must be matched with
an equivalent expansion process at the receiver

52
Non-uniform quantization using companding

The signal below shows the effect of compression, where the


amplitude of one of the signals is compressed
After compression, input to the quantizer will have a more
uniform distribution after sampling

At the receiver, the signal is


expanded by an inverse
operation
The process of COMpressing
and exPANDING the signal is
called companding
Companding is a technique
used to reduce the number of bits
required in ADC or DAC while
achieving comparable SQNR

53
Non-uniform quantization using companding

Basically, companding introduces a nonlinearity into the signal


This maps a nonuniform distribution into something that more
closely resembles a uniform distribution
A standard ADC with uniform spacing between levels can be used
after the compandor (or compander)
The companding operation is inverted at the receiver

There are in fact two standard logarithm based companding


techniques
US standard called -law companding
European standard called A-law companding

54
Input/output Relationship of Compander

Logarithmic expression Y = log X is the most commonly


used compander
This reduces the dynamic range of Y

55
Types of Companding
-Law Companding Standard (North & South America,
and Japan)

log e 1 (| x | / xmax
y ymax sgn( x )
log e (1 )
where
x and y represent the input and output voltages
is a constant number determined by experiment
In the U.S., telephone lines uses companding with = 255
Samples 4 kHz speech waveform at 8,000 sample/sec
Encodes each sample with 8 bits, L = 256 quantizer levels
Hence data rate R = 64 kbit/sec
= 0 corresponds to uniform quantization
56
A-Law Companding Standard (Europe, China,
Russia, Asia, Africa)
| x|
A
xmax | x| 1
ymax sgn( x), 0
(1 A) xmax A
y ( x)
| x|
1 log eA
xmax 1 | x|
ymax sgn( x), 1
(1 log e A) A xmax

where
x and y represent the input and output voltages
A = 87.6
A is a constant number determined by experiment
57
Questions?

Questions are guaranteed in


Life.Answers are not!

NUML Engineering & IT 58


Thank You!

NUML Engineering & IT 59