Sunteți pe pagina 1din 70

Chapter 6

Sampling & PCM


Analog to Digital Conversion (A/D)
 In converting an analog signal to an equivalent
sequence of “0’s” and “1’s”, we go through three
processes:
 Sampling:
o converting continuous–time analog signals to discrete–time
analog signals.
 Quantization
o converting discrete–time analog signals to discrete–time
digital signals (finite set of amplitude levels).
 Coding
o Map each amplitude level to a binary sequence.
[1] Sampling: Mathematical Representation
 One sample of g(t) can be obtained from
g s (t )  g (t )   (t  t 0 )  g (t 0 )   (t  t 0 )
 If we want to sample g(t) periodically every Ts sec then we
can repeat this process periodically

g (t )  g (t )   (t  nT s )
n 

  g (t )   (t  nT
n 
s )

  g (nT
n 
s )   (t  nT s ).
Sampling: Time-Domain Plot
Sampling: Frequency-Domain Analysis (1/2)
 2
g (t )  g (t ) Ts (t ) T (t )    (t  nT ) ws 
s s Ts
n 

 a0  a1 cos(ws t )  a2 cos(2ws t )  a3 cos(3ws t )  


Ts Ts  b1 sin(ws t )  b 2 sin(2ws t )  b3 sin(3ws t )  
2 2
1 1 1
a0   T (t )dt    (t )dt 
Ts T
s
Ts T Ts
 s  s
2 2
Ts Ts Ts
2 2 2
an0  2 T (t )  cos(ws t )dt 
2
 (t ) cos(ws t )dt 
2
 (t ) cos(0)dt 
2
Ts 
T
s
Ts 
T Ts 
T Ts
 s  s  s
2 2 2
Ts Ts Ts
2 2 2
bn0  2 T (t )  sin(ws t )dt 
2
 (t ) sin(ws t )dt 
2
Ts 
T
s
Ts T
 Ts   (t ) sin(0)dt  0
T
 s  s  s
2 2 2
Sampling: Frequency-Domain Analysis (2/2)

g (t )  g (t )   (t  nT s )
n 

1 2 2 2
 g (t )  g (t ) cos(ws t )  g (t ) cos(2ws t )  g (t ) cos(3ws t )  .
Ts Ts Ts Ts

1 1 1
G (w )  G (w )  G (w  ws )  G (w  ws )   G (w  2ws )  G (w  2ws ) 
Ts Ts Ts
1
 G (w  3ws )  G (w  3ws )  .
Ts

1

Ts
 G (w  nw )
n 
s
Spectrum of Sampled Function
Recovering the Continuous-Time Signal
Sampling Theorem
 A baseband signal whose spectrum is band-
limited to B Hz can be reconstructed exactly
(without any error) from its samples taken
uniformly at a rate fs ≥ 2B.
 fs ≥ 2B is called Nyquist Criterion of sampling.
 fs = 2B is called the Nyquist rate of sampling.
 Does Sampling Theorem Make Sense?
Reconstructing the Signal: Time-Domain Prespective

ω  ws  g (t )  G (w ) g (t )  G (w )
Ts rect   sinc t  LPF
 ws   2  H(w) = Ts rect(f/fs)
ω
G (w )  G (w )  Ts rect 
 ws 

 ws    w 
g (t )  g (t )  sinc t    g (t )   (t  nTs )  sinc s t 
 2   n     2 
    t 
g (t )    g (nTs ) (t  nTs )  sinc  
 n     Ts 

 t  nTs 
g (t )   g (nTs ) sinc  
n    Ts 
Graphical Illustration
Aliasing

 Sampling a signal at a rate less that the Nyquist rate results in


Aliasing.
 In aliasing, the higher frequency components take the identity of
lower frequencies.
 Real life Example: Sampling a rotating wheel.
Fold-over Distortion (Aliasing)
Example
 • Assume fs, the sampling frequency, is 100 Hz and
that the input signal contains the following
frequencies: 25 Hz, 70 Hz, 160 Hz, and 510 Hz. These
frequencies are shown in the following figure. Find
aliases
Answer

 • Frequencies below the Nyquist frequency (fs/2 = 50 Hz)


are sampled correctly.
 • Frequencies above the Nyquist frequency appear as aliases.
 Alias F2 = |100 – 70| = 30 Hz
 Alias F3 = | (2)100 – 160| = 40 Hz
 Alias F4 = | (5)100 – 510| = 10 Hz
Time Division Multiplexing
(TDM)
 Multiplexing: The process of
sending two or more signals
together
 FDM: Sending them together at the
same time over different bands
using carrier modulation (AM &
FM broadcasting)
 TDM: Sending them together over
the same band by sampling the
signals and sending the samples at
different time instants
(interleaved).
How to Transmit the Samples?
 Analog Pulse Modulation:
Use the samples to modulate a carrier of pulses
 Pulse Amplitude Modulation (PAM)
 Pulse Width Modulation (PWM)
 Pulse Position Modulation (PPM)
 Pulse Code Modulation (PCM)
 Quantization of samples
 Coding
Pulse Amplitude Modulation (PAM)

gPAM(t)

Ts
Pulse Width Modulation (PWM)
gPWM(t)

Ts
Pulse Position Modulation (PPM)
[2] Quantization
 Analog samples with an amplitude that may take value
in a specific range are converted to a digital samples
with an amplitude that takes one of a specific pre–
defined set of values.
 The range of possible values of the analog samples is
divide into L levels. L is usually taken to be a power of
2 (L = 2n).
 The center value of each level is assigned to any
sample that falls in that quantization interval.
 For almost all samples, the quantized samples will
differ from the original samples by a small amount,
called the quantization error.
Quantization: Illustration

2m p
Dv 
L

Quantizer Input Samples x


Quantizer Output Samples x q
Input-Output Characteristics of Quantizer

xq
Quantization Error

q  x xq
[3] Coding

Quantizer Input Samples x


Quantizer Output Samples x q
 We want to scan and send a black-and-white image of
height 11 inches and width 8.5 inches (Letter size paper).
The resolution of the scanner is 600×600 dots per inch
square. The picture will be quantized using 256 levels.
Find the size of the scanned image and the time it takes
to transmit the image using a modem of speed 56 kbps.
 Size of image =
11(in)×8.5(in)×600×600(samples/in2)×8bits/sample
= 269280000 bits = 269 Mbits
 Time to transmit = 269280000 / 56,000 = 4808 sec = 80 min
How would 0’s and 1’s be transmitted?
 The simplest form is to send a +ve pulse for a
“1” and a –ve pulse for a “0”.
 Transmitting the message g(t) would translate
into sending a a long sequence of +ve and –ve
pulses.
Advantages of Digital Communications
 Rugged: Can withstand channel noise and
distortion much better.
 Use of repeaters (travels as far as needed).
 Use of TDM
 Can be encrypted (Security and Privacy)
 Can be encoded for error correction (reliability).
 Easy to process, store and search.
Nyquist Theorem for Transmission
 Note that the larger the transmission rate
(pulses/sec) the narrower the pulse, the wider its
spectrum, the higher the channel bandwidth
required for transmission.
 The minimum theoretical bandwidth required
to transmit R pulses/sec is R/2 Hz. (To be demonstrated
later)
 A signal m(t) band-limited to 3 kHz is sampled
at a rate 33.33% higher than the Nyquist rate,
quantized and coded. The maximum acceptable
quantization error is 0.5% of mp.
Find the minimum bandwidth required for
transmission? How is that compared to SSB?
 Ans: 32 kHz.
TDM Revisited
 Time axis is divided into frames. Frame rate is
determined by sampling rate.
 Each frame is divided into slots.
 Each user is assigned a slot (periodically in each frame).
 A user uses the full bandwidth during his slot.
 The transmission rate of the multiplexed channel is the
sum of the rates of individual channels plus the control
bits.
 Can be used with digital signals only.
TDM in Telephony (T1 & E1 Systems)
 T1:
 Introduced in 1960s
 North America and Japan
1 1

2 MUX MUX 2
...

...
22 23 24 b 1 2 . . . 24 b
24 frame 24

 E1 system (Europe): 30 voice channels + 2 syn channels


T1 System
 Multiplexes 24 voice channels
 Voice bandwidth is approximately 3.4 kHz
 Nyquist rate of sampling = 6800 samples/sec
 Actual sampling rate = 8000 samples/sec
 8 bits/sample (256 levels)
 Frame duration = 1/8000 = 125 sec
 Number of bits/frame = 24×8+1=193
 Bit duration = 0.647 sec
 Transmission rate:
(248+1) bits/frame  8000 frames/sec = 1.544 Mbps
Quantization Noise
 Assuming that the input signal is restricted between –mp to
mp, the resulting quantization error q (or we can call it
quantization noise) will be a random process that is uniformly
distributed between –Dv/2 and Dv/2 with a constant height of
1/Dv.
 That is, all values of quantization error in the range –Dv/2
and Dv/2 are equally probable to happen.
 The power of such a random process can be easily found by
finding the average of the square of all noise values
multiplied by probability of each of these values of the noise
occurring.
Quantization Noise
 The quantization error is assumed to be uniformly
distributed over the range (-Dn/2,Dn/2).
Dv / 2 3 Dv / 2
1 2 1 q 
Pq   q dq   
Dv / 2
D v Dv  3 q Dv / 2
3 3 3 3

1  D v / 2   Dv / 2   1     
 D v D v
      
Dv  3 3  Dv  24 24 
 
2 2


 Dv 
Pq 
 2m p /L

m p2
12 12 3L 2
Signal-to-Quantization-Noise Ratio
Signal Power Ps
SNR  
Noise Power Pq
3L2
 2 Ps .
mp

 3L2   3 
SNR dB
 mp   mp   
 10  log10  2 Ps   10  log10  2 Ps   10  log10 22 n
   
 3 
 10  log10  2 Ps   20n  log10  2 
 m p    
 
  6n

   6n dB.
SNR-Bandwidth Exchange
 More bits/sample for the same message results in more
quantization levels, less quantization step, less
quantization noise, higher SNR.
 On the other hand, more bits/sample results in
bandwidth expansion
Ps
SNR  3 (2) 2 n ; ( SNR ) dB    6n
mp
 One added bit results in multiplying SNR by a factor of
4 (6 dB), but multiplying the transmission bandwidth
by a factor of (n+1)/n
 A signal of bandwidth 4 kHz is samples at Nyquist rate
and transmitted using PCM with uniform quantization.
If the number of quantization levels L is increased
from 64 to 256, find the change in SNR and
transmission bandwidth.
 Number of bits/sample has been increased from 6 to 8.
 SNR improved by 12 dB (16 times)
 BT expanded by a factor of 1.33 (33% increase).
From 24 kHz to 32 kHz.
Non-Uniform Quantization
 There is a huge variation in voice signal level
from user to user, and for the same use from
call to call as well as within the call (sometimes
of the order of 1000:1)
 Uniform quantization provides same degree of
resolution for low and high values.
 Designing the step size for the low values
results in too many levels, and designing them
for the high values destroys the low values.
Non-Uniform Quantizers
Compressors and Expanders
 It is practically more feasible to compress the signal
logarithmically then apply it to a uniform quantizer.
 A reciprocal process takes place at the receiver by an
expander.
 The compressor/expander system is called compander.
 There are two standard laws for companders, the -law
(North America and Japan) and the A-law (Europe and
rest of the world).
-Law and A-Law Characteristics
μ - law
 Compression Characteristics
V m ax ln(1   V in / V m ax )
V out 
ln(1   )
 Vmax = max. uncompressed analog input amplitude
 Vin = amplitude of input signal at a particular instant
 μ = parameter used to define the amount of
compression
 Vout= compressed output amplitude
 Typically μ = 255
Discrete

 With digital companding the analog sample is


first sampled, coded and then digitally
compressed.

 For example: 12-bit – to – 8-bit compression


Encoded PCM
Segment 12-bit linear code 8-bit compressed code
0 s0000000ABCD s000ABCD
1 s0000001ABCD s001ABCD
2 s000001ABCDX s010ABCD
3 s00001ABCDXX s011ABCD
4 s0001ABCDXXX s100ABCD
5 s001ABCDXXXX s101ABCD
6 s01ABCDXXXXX s110ABCD
7 s1ABCDXXXXXX s111ABCD
Sign bit 3-Bit 4-bit quantization
Compressed Code 1=+ segment Interval
format 0=- identifier AB CD
000 to 111 0000 to 1111
Encoded PCM

 After the input data is encoded through the logic


defined in the table, an inversion pattern is
applied to the 8-bit code to increase the density
of transitions on the transmission line, a benefit
to hardware performance.
 The inversion pattern is applied by XOR’ing the
8-bit code with 0xFF.
Decoded PCM
 Decoding the µ -law encoded data is essentially
a matter of reversing the steps in the encoding.
Table illustrates the µ-law decoding table,
applied after reversing the inversion pattern.
 The least significant bits discarded in the
encoding process are approximated by the
median value of the interval. This is shown in
the output section by the trailing 1..0 pattern
after the D bit.
Decoded PCM
8-bit compressed code 12-bit recovered linear code Segment

s000ABCD s0000000ABCD 0
s001ABCD s0000001ABCD 1
s010ABCD s000001ABCD1 2
s011ABCD s00001ABCD10 3
s100ABCD s0001ABCD100 4
s101ABCD s001ABCD1000 5
s110ABCD s01ABCD10000 6
s111ABCD s1ABCD100000 7
Example

 Find code word corresponding to input sample


+242 and compare it with decoded output?
Solution
Solution

Eight-bit µ-225 PCM code


format
From Table P=0, S=3, Q=1
 0, 3, 1= 1 011 0001
Solution
 The decoding process involves assigning the
designated polarity to an analog output sample at
the midpoint of the nth quantization interval n = 0,
1,… , 127.Using the values of S and Q directly,
we can determine a discrete output sample value
as Yn=( 2Q+ 33)(2S)- 33
 Where n is the integer obtained by concatenating
the binary representation of S and Q.
Solution

The decoder output becomes


 Y49=(2. 1+33X23)-33 =247
 Which is the midpoint of the forty-ninth
quantization interval from 239 to 255.
Digital Compression Error

12 bit encoded voltage - 12 bit decoded voltage


%error= X100
12 bit decoded voltage
Differential Pulse Code Modulation
(DPCM)
 In PCM we quantize the analog samples. Since the signal
varies over a large range of amplitudes, we generally need a
large number of levels (hence bits).
 Note that neighboring samples are “close” to each other in
values.
 If we instead quantize the difference between successive
samples, we will be dealing with much smaller range of
values.
 This will results in either:
 Using less number of bits for the same SNR.
 Obtaining smaller SNR for the same number of bits.
 Quantization noise will be reduced by a factor of (mp/md)2
Block Diagram of DPCM
d [ k ]  x [ k ]  x [ k  1].

xˆ [k ]

xˆ [k  1]
xˆ [k ]  d q [k ]  xˆ [k  1].
Generalized DPCM
 We can get even a smaller range of values if we define the
difference as:
d [k ]  x[k ]  xˆ[k ]
xˆ (k ) can be predicted from previous values of x,
xˆ (k )  a1 x(k  1)  a2 x(k  2)  a3 x(k  3)  
 The more previous samples included, the better the
approximation, the smaller the difference.
 The relation d[k] = x[k]- x[k-1] is a special case where the
previous sample is taken as a prediction of the current value.
Higher order prediction
 DPCM concept can be extended to incorporate
more than one past sample value into the
prediction circuitry.
 The additional redundancy available from all
previous samples can be weighted and summed
to produce a better estimate of the next input
sample.
 With a better estimate, the range of the
prediction error decreases to allow encoding with
fewer bits.
Third Order Prediction

• For systems with constant predictor coefficients,


results have shown that most realizable improvement
occurs when using last three sample values.
Delta Modulation (DM)
 If we increase the sampling rate (oversampling) much above the
Nyquist rate, the adjacent samples become very much correlated,
with a very small prediction error.
 The difference can then be encoded by one bit;
If x[k] > x[k-1]  dq [k] = s
If x[k] < x[k-1]  dq [k] = -s

 k
xq [k ]   d [k ]; (assuming zero initial condition)
i 0
 The analog signal is approximated by a staircase function.
 DM is simple to implement. Moreover, it does not require word
synchronization.
DM Illustration
DM Modulator and Demodulator

xˆq (t )

xˆq (t )
dq[k] LPF xˆ (t )

Accumulator (Integrator)
Noise in DM
Slope Overload
 Slope overload occurs because

d x (t)
 q f s
d t
 To prevent Slope overload
d x (t)
q f s 
d t m ax
SNR for DM
 The quantization error lies in the range (-s, s)
 Granular noise power = s2/3
 The noise is uniformly distributed in the band 0 to fs.
 However, there is still the low pass filter in the DM
receiver -if the cutoff frequency is set to the maximum
frequency B.
 The LPF will only pass (s2/3)(B/fs) of noise power.
 SNR = (3/s2)(fs/B)Ps
Adpative Delta Modulation (ADM)
 DM suffers from granular noise effect and
slope overload effect.
 A remedy is applied by varying the step size s.
 A granular noise is detected by a sequence of
alternating pulses.
 A slope overload is identified by a sequence of
pulses of the same polarity.

S-ar putea să vă placă și