You are on page 1of 18

ELE3340 Analog and Digital Communications 4.

Sampling and Pulse Code Modulation

ELE3340

ANALOG AND DIGITAL


COMMUNICATIONS

4. SAMPLING AND PULSE CODE MODULATION

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 1

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Outline
• Consider digital communications. If the information to be sent is data, then that is
fine. But for analog continuous-time message signals such as voice and images, the
signals have to be converted to digital numbers.
• Such an analog-to-digital conversion is done through two processes, namely
sampling and quantization.
• These two ideas will further lead to pulse code modulation, a method of
converting an analog signal into a binary digital number for digital storage or
digital transmission.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 2
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

SAMPLING
Sampling is a process of converting an analog continuous-time signal to a discrete-time
signal.

Ts

x (t ) xs ( t )

Let x(t) be the signal to be sampled. The sampled signal xs (t), with sampling interval
Ts , is given by
X∞
xs (t) = x(nTs )δ(t − nTs )
n=−∞

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 3

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Sampling theorem
Intuitively one sounds reasonable that if the sampling rate 1/Ts is fast compared to the
time change of the signal x(t), then there should be little lost of information.
The sampling theorem by Shannon provides us the condition under which no
information is lost from the the sampling process.
Sampling theorem: Let x(t) be a signal with Fourier transform X(ω) such that
X(ω) = 0 for |ω| ≥ π/Ts . Then
∞  
X π
x(t) = x(nTs )sinc (t − nTs )
n=−∞
Ts

where sinc(t) the sinc function; i.e., sinc(t) = sin(t)/t. The quantity π/Ts (in
rad/sec.) is called the Nyquist frequency.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 4
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Mathematical basis of sampling theorem


We consider the proof of the sampling theorem. The idea lies in rewritting the sampled
signal
X∞
xs (t) = x(nTs )δ(t − nTs )
n=−∞
as
xs (t) = x(t)δs (t)
where

X
δs (t) = δ(t − nTs )
n=−∞

is an impulse train function.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 5

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

The function δs (t) is periodic with period Ts , and therefore it admits a Fourier series
representation
X∞
δs (t) = ck ej2πkt/Ts
k=−∞

for some coefficients ck . Since


Ts /2
1
Z
ck = δs (t)e−j2πkt/Ts dt
Ts −Ts /2
Ts /2
1
Z
= δ(t)e−j2πkt/Ts
Ts −Ts /2
1
= ,
Ts
the function δs (t) can be reduced to

1 X j2πkt/Ts
δs (t) = e .
Ts
k=−∞

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 6
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Substituting the Fourier series expansion of δs (t) into xs (t), we obtain



1 X
xs (t) = x(t)ej2πkt/Ts
Ts
k=−∞

Hence, the Fourier transform of xs (t) is


∞  
1 X 2πk
Xs (ω) = X ω−
Ts Ts
k=−∞

Now, suppose that X(ω) is bandlimited with bandwidth 2πB (which means X(ω) = 0
for |ω| > 2πB). There are two cases to consider.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 7

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Case A: 2πB > π/Ts (message bandwidth higher than the Nyquist freq.)

X(ω)

−2πB 2πB ω

Xs(ω)

..... .....

− Tπs π
Ts
ω

In Xs (ω), there are spectral overlaps with the replicas of X(ω). This effect is known as
aliasing, which prevents us from recovering x(t) from the samples x(nTs ).

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 8
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Case B: 2πB ≤ π/Ts (message bandwidth no greater than the Nyquist freq.)

X(ω)

−2πB 2πB ω

Xs(ω)

..... .....

− Tπs π ω
Ts

For |ω| ≤ 2πB, the spectrum of Xs (ω) has the same shape as that of X(ω).

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 9

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Let us assume Case B.


Let h(t) be the impulse response of a lowpass filter with transfer function

 1, |ω| ≤ π/T
s
H(ω) =
 0, otherwise

By inverse Fourier transform,


1 ∞
Z
h(t) = H(ω)ejωt dω
2π −∞
π/Ts
1
Z
= ejωt dω
2π −π/Ts
 
1 πt
= Ts
sinc Ts

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 10
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Xs(ω)
replacements
H(ω)

..... .....

− Tπs π ω
Ts

Applying this low-pass filter to xs (t) will yield


1
H(ω)Xs (ω) = X(ω)
Ts
Taking inverse Fourier transform to the above equation, we obtain
P∞
x(t) = Ts h(t) ∗ xs (t) = Ts h(t) ∗ ( n=−∞ x(nTs )δ(t − nTs ))
P∞
= Ts n=−∞ x(nTs )h(t − nTs )
 
P∞ π(t−nTs )
= n=−∞ x(nTs )sinc Ts

and the proof of sampling theorem is complete.


Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 11

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Implication
Sampling theorem tells us that we can perfectly recover a bandlimited signal x(t) from
its samples x(nTs ), provided that the sampling rate is at least twice of the signal
bandwidth (i.e., 1/Ts ≥ 2B).
1

0.5
x(t)

−0.5

−1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
t

0.5

−0.5

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

Red— x(t), blue stems— xs (t), green—


 reconstructed
 signal through the interpolation
π
P∞
formula x(t) = n=−∞ x(nTs )sinc Ts (t − nTs ) .

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 12
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Time Division Multiplexing & Pulse Amplitude Modulation: An Application of


Sampling Theorem
• From a signal transmission viewpoint, the sampling theorem implies that we can
replace a continuous-time signal by a discrete-time sequence.
• One way of transmitting the discrete-time sequence is pulse amplitude modulation
(PAM), where we transmit pulses with amplitudes varying according to the
discrete-time signal sequence.
• One advantage of using such a pulse transmission is that it permits simultaneous
transmission of multiple message signals on a time-sharing basis; i.e., time division
multiplexing (TDM).

x1 (t )

x2 (t )
t

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 13

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Ex 4.1 A PAM signal may be expressed as



X
yPAM (t) = x(nTs )p(t − nTs )
n=∞

Here, x(t) is the message signal with bandwidth 2πB ≤ π/Ts , and p(t) is the
transmitted pulse shape given by

 1, − Tp ≤ t ≤ Tp
2 2
p(t) =
 0, otherwise

where Tp is the pulse width. For a meaningful PAM system, we have Tp ≪ Ts .


Derive and sketch the frequency spectrum (or Fourier transform) of yPAM (t).

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 14
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Ex 4.2 (Direct sampling of carrier modulated signals) Consider a DSB-SC


modulated signal:
x(t) = m(t) cos(ωc t)
where the message signal m(t) has bandwidth 2πB. Now, suppose that the carrier
frequency ωc satisfies
ωc = 4πmB
for a positive integer m. (In other words, the carrier frequency is divisible by 4πB,
twice of the message bandwidth).
Our objective is to recover m(t) from x(t). Now, consider directly sampling x(t) with a
sampling rate of 2π/Ts = 4πB (without any carrier demodulation process). Show,
using both derivations and illustrations, how we can recover m(t) from the
discrete-time samples x(nTs ) in principle.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 15

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

QUANTIZATION
Quantization is the process in which a continuous-valued signal is converted to a
discrete-valued signal.

x(t)
x (t)
q

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 16
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Uniform quantization
Uniform quantization is one of the most commonly used quantization methods.

xq (t)

3∆

2∆

3∆
− 9∆
2
− 7∆
2
− 5∆
2
− 3∆
2
− ∆2 ∆
2 2
5∆
2
7∆
2 x(t)
−∆

−2∆

−3∆

−4∆

Range 2mp

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 17

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation
Let x(t) be the signal to be quantized, xq (t) be the quantized signal, and Q be the
quantization function or the quantizer. We have
xq (t) = Q[x(t)]
The quantizer output xq (t) depends only on the present-time input x(t). Thus
sometimes we may simply write xq = Q[x], for convenience.
The quantizer output assumes a finite number of values
{x1 , x2 , . . . , xL }
These levels are uniformly spaced, satisfying
|xk+1 − xk | = ∆
for a given step size ∆. Given the number of levels L, ∆ can be determined by
2mp
∆=
L
where mp is the peak amplitude of x(t).
The quantization function is such that
Q[x] = xk , for xk − ∆/2 < x ≤ xk + ∆/2
Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 18
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Nonuniform quantization
In some signals such as speech, it is found that there is a higher probability for smaller
amplitudes and lower probability for larger amplitudes.
Hence, it makes sense to design a quantizer with more quantization levels (& thus finer
quantization) at lower amplitudes and fewer quantization levels (& thus coarser
quantization) at larger amplitudes
The usual method of nonuniform quantization is companding
(compressing-expanding).

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 19

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Compressor Uniform Expander


g ( x) quantizer g −1 ( x )

The procedure of companding:


• The signal first passes through a nonlinear function, g(x), that compresses large
amplitudes.
• Uniform quantization is then performed.
• At the receiving end, the inverse of the expander g(x) is applied to obtain the
signal.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 20
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

PULSE CODE MODULATION


Pulse code modulation (PCM) is a (possibly the oldest and yet the simplest) method of
converting an analog signal into a digital binary number, for the purpose of digital
storage or digital transmission.

m(t) m[k] mq [k]

Encoder
Ts
Analog 01011...
input
signal Sampler Quantizer

The PCM encoding consists of three stages:


1. Sample the input analog signal m(t) to obtain the samples m[k] = m(kTs ).
2. Apply quantization to obtain quantized samples mq [k] = Q{m[k]}.
3. Encode mq [k] to a binary codeword.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 21

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation
In PCM we assume that the number of quantization levels, L, is a power of 2; i.e.,

L = 2ν

for some integer ν. In that case, each level can be represented by a length-ν binary
codeword.

Level xℓ Binary codeword


3 011
2 010
1 001
0 000
-1 111
-2 110
-3 101
-4 100

An example for 3-bit encoding of 8-level signals.


Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 22
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

DIFFERENTIAL MODULATION METHODS


• In analog messages such as voice, we can make a good guess about a sample value
from its past sample values.
• In other words, the sample values are not independent, and generally there is some
redundancy in the samples.
• Proper exploitation of this redundancy can lead to encoding with less number of
bits.
• For example, instead of sending m[k], we could think of transmitting the difference
d[k] = m[k] − m[k − 1].

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 23

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Delta modulation
The idea of delta modulation (DM) is to send the signal difference.


m[k] d [k] d q [k] To channel
Quantizer
-


mq [k-1] + +
Accumulator

Delay T s
mq [k]

(a) Delta modulator


d q [k ] mq [k ]

mq [k − 1]
Delay T s

(b) Delta demodulator

The advantage of DM is that it is very simple to implement.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 24
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation
DM is a 1-bit system. The quantizer is such that

 ∆, d[k] ≥ 0
dq [k] =
 −∆, d[k] < 0

The demodulator, as well as the accumulator at the modulator, performs an integration


operation
mq [k] = mq [k − 1] + dq [k]
= mq [k − 2] + dq [k − 1] + dq [k]
..
.
k
X
= dq [i]
i=0

The signal mq [k] serves as a prediction of the true sample m[k].


The error (or difference) signal
d[k] = m[k] − mq [k − 1]
is applied to the 1-bit quantizer and transmitted.
Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 25

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

slope overload

Startup

mq(t)

m(t)

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 26
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

The step size ∆ is an important parameter.


• If the variations of m(t) are much smaller than ∆, then there is a significant
quantization noise (also known as granular noise).
• If the variations of m(t) are much greater than ∆, then mq [k] may not follow m[k]
and overloading occurs. This effect is known as slope overload.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 27

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation
Differential PCM
Before describing differential PCM (DPCM), let us briefly consider the approach to
signal prediction.
By Taylor series, we can express m(t + Ts ) as
Ts2 Ts3 ...
m(t + Ts ) = m(t) + Ts ṁ(t) + 2!
m̈(t) + 3!
m(t) · · ·

For sufficiently small Ts , we may approximate m(t + Ts ) by


m(t + Ts ) ≈ m(t) + Ts ṁ(t)
In addition, for small Ts the derivative ṁ(t) may be approximated by
m(t) − m(t − Ts )
ṁ(t) ≈
Ts
Hence, we have a crude prediction formula for m(t + Ts )
m̂(t + Ts ) = 2m(t) − m(t − Ts )
where m̂(t + Ts ) stands for a prediction (or approximation) of m(t + Ts ). Its
discrete-time counterpart is
m̂[k + 1] = 2m[k] − m[k − 1]
Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 28
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

More generally, we can incorporate more higher order derivatives to obtain a better
prediction and the prediction formula can be expressed as

m̂[k] = a1 m[k − 1] + a2 m[k − 2] + · · · + aN m[k − N ]

for some coefficients ai .

Input m[k] Delay Delay Delay Delay


... Delay
Ts Ts Ts Ts Ts

a1 a2 ….. a N −1 aN


Output m[ k ]

Predictor structure.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 29

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

The idea of DPCM is to transmit the prediction error.


m[k] d [k ] d q [k ] To channel
Quantizer
-


+ +

mq [k ]

Predictor
mq [k ]

(a) DPCM transmitter


Input d q [k ] Output mq [k ]


mq [k ]
Predictor

(b) DPCM receiver

Note that in DPCM, the quantizer can be of multiple level (instead of 2 level as in DM).
If the quantizer is 1-bit and the predictor is a unit delay, then the corresponding DPCM
becomes DM.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 30
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation
A glimpse of PCM applications: T1 carrier system
• T1 carrier is a TDM system. It multiplexes 24 PCM telephone signals and transmit
them through a pair of wires that was originally used to transmit one audio signal
with bandwidth 4kHz.

• T1 carrier occupies a total bandwidth of 1.544MHz, much greater than 4kHz. But
pulse transmissions are more resistent to signal distortion due to poor
high-frequency-performance wired lines, as well as noise.
• It also enables effective regeneration for repeaters (say, 6000 feet apart).
Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 31

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

• For each channel, a signal sample is converted to a binary codeword of 8 bits. The
binary codeword is then sequentially transmitted by eight consecutive binary pulses.

• The TDM is done in a codeword-by-codeword fashion.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 32
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

• At the demultiplexer or the receiver side, timing synchronization is required.

• In particular, it is necessary to perform frame synchronization (one frame stands for


one segment containing one codeword [or one signal sample] from all channels).
• To do so, a framing bit would be inserted in the beginning of each frame.
Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 33

ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

Some specification with T1 carrier:


• signal sampling rate, fs = 8kHz
• number of bits for each sample, ν = 8
• number of channels= 24
• time width of the transmitted pulses, Tp = 2µs.

Ex 4.3 According to the specification above, what is the T1 carrier transmission rate,
in terms of number of pulses transmitted per second?

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 34
ELE3340 Analog and Digital Communications 4. Sampling and Pulse Code Modulation

REMARKS
• Quantization is a lossy conversion process (or the signal gets distorted in the
process). We however would expect that the loss is insignificant if we use sufficient
number of quantization levels.
• The effects of quantization errors can be quantified and analyzed. This however
would require knowledge of probability and random processes which will be covered
in the later part of the course.

Wing-Kin Ma, Dept. Electronic Eng., The Chinese University of Hong Kong 35

You might also like