PULSE Code MODULATIon
ES442 – Spring 2017
         Lecture 9
                  Analog signal
                  Pulse Amplitude Modulation
                  Pulse Width Modulation
                  Pulse Position
                  Modulation
                  Pulse Code Modulation
                                               1
(3-bit coding)
                 2
     Advantages of Digital Over Analog For Communications
1. Digital is more robust than analog to noise and interference†
2. Digital is more viable to using regenerative repeaters
3. Digital hardware more flexible by using microprocessors and VLSI
4. Can be coded to yield extremely low error rates with error
   correction
5. Easier to multiplex several digital signals than analog signals
6. Digital is more efficient in trading off SNR for bandwidth
7. Digital signals are easily encrypted for security purposes
8. Digital signal storage is easier, cheaper and more efficient
9. Reproduction of digital data is more reliable without deterioration
10.Cost is coming down in digital systems faster than in analog
   systems and DSP algorithms are growing in power and
   flexibility
†
    Analog signals vary continuously and their value is affected by all levels of noise.
           Reading: Lathi & Ding; Section 6.2.1 on pages 321 and 322.
    Next Topic – Pulse Code Modulation
Pulse-code modulation (PCM) is used to digitally represent
sampled analog signals. It is the standard form of digital
audio in computers, CDs, digital telephony and other
digital audio applications. The amplitude of the analog
signal is sampled at uniform intervals and each sample is
quantized to its nearest value within a predetermined
range of digital levels.
                                       Four-bit coding
                                     (16 discrete levels)
                                        Analog to Digital Conversion Process (ADC)
                                                                           Three Step Process
            amplitude
                                                                                                               amplitude
                                             amplitude
                                                                               
                                                                                       
                                                                                                                                  0100101101011001
                                 time                                                              time                    time        1110101010101000
                                                                                                                                     0100011000100011
                                                                                               
                                                                                                                                     0101001111010101
                                                                                                
                                                                                                                                      1110110111010001
                                                                                   
                                                                                                                            
                                    Sample                                                     Quantize                    Encode
                        Analog                                                                                                              Digital
                        Signal                             Captured              Quantized                                                  Signal
                                                         Sampled Data            Sampled
                                   Sampling                 Values    Quantizing   Data                                     Encoding
                                    selects the                      chooses the                      assigns binary
                                    data points                        amplitude                       numbers to
                                  Discrete time values: few amplitudes
                                                                   Nowfrom
                                                                        haveanalog
                                                                             discrete Values in both time those
                                                                                                           & amplitude
                                     we use to                        values used
Analog signal is continuous in time & amplitude
                                  signal                                                                amplitude
                                    create the                         to encode
                                                                                                          values     Now have the digital
                                      digital
                                                                                                                 data which is the final result
                                       data
                             Note: “Discrete time” corresponds to the timing of the sampling.
      Second Step – Quantization I
The process of assigning quantization levels
                                    Lathi & Ding
                                     Figure 1.4
                                        p. 4
      = 
                                16 levels – 4 bits
                Natural Binary Pulse Code (Example)
To communicate sampled
values, we send a sequence of
bits that represents the
quantized value.
For 16 quantization levels, 4 bits
are required.
PCM can use a binary
representation of value.
The PSTN uses PCM
    Figure 1.5 (page 8) of
         Lathi & Ding
                    Second Step – Quantization
                    II
We start with a sampled signal {call it m(t)} and now we want to quantize it.
The quantized amplitude is limited to a range, say from –mp to
+mp. (Note: the range of m(t) may extend beyond (-mp, mp) in some
cases.)
Divide the range (-mp, mp) into L uniformly spaced intervals. The number
intervals is L and the separation between quantized levels is
                                   2mp
                             
                                   L
     th
The k sample point of m(t) is designated as m(kTS) and is assigned a value
equal to the midpoint between two adjacent levels. Define:
          m(kTS) = kth sample’s value, and
          m(kTS) = kth quantized sample’s value.
Then the quantization error q(kTS) is equal to m(kTS) - m(kTS)
Read Section 6.2.2 of Lathi & Ding: Quantizing evaluation of parameter q(t).
                                                                               7
           Second Step – Quantization
pp. 322-324II
                                        8
     Error Generated by Quantization
      Quantization fluctuation or “noise”
                                            8
                      Second Step – Quantization
                      III
                                              2mp
The quantized levels are separated      
by                                             L
The maximum error for any sample point’s quantized value is at most ½.
It is shown in Lathi and Ding that the “time average” mean square
error from quantization is
                             q 
                              2
                                 mp2      
                                 3L
                                 2   
                                           2
                                           12
Let Nq equal q2. Nq is proportional to the fluctuation of the error signal.
This is sometimes quantization noise.
This means that m(t) = m(t) + q(t)
The signal (message) power S0 is proportional to the square of m(t), thus
                                 S0  m2(t)
                                                                              9
                   Second Step – Quantization
                   IV
We want a measure of the quality of received signal (that is, the
ratio of the strength of the received signal S0 relative to the
strength of the error Nq due to quantization).
                               S       m 2 (t)          2 
                                                      2 m (t)
                                 0               3L
    This is given by the ratio        m2p              m2 
                                                        p 
                 q                   
               N                      3L2 
Conclusion:
To keep the quantization error small relative to the message signal level,
use smaller quantization steps .
                                                                             10
   The Dilemma of Strong Signals versus Weak Signals
    Strong Signal     Weak Signal
(a) Linear encoding                 (b) With non-linear encoding
                                            Companding
      Note different encoding levels on each side.
                                                                   11
       Use Compression and Expansion → Companding
       Compression                             Restoration
         (m)                                  m(t)
m(t)                                                         m(t)
          http://www.slideshare.net/91pratham/unit-ipcmvsh          12
                                           Companding Laws
                A-Law Companding (Europe)             -Law Companding (North America)
    Output (y/ymax)
                                                          Output (y/ymax)
                         Input (m/mp)                                             Input (m/mp)
   A  m           for 0  m  m   1                                        
y1                                  A             y         1       loge 1  m                       m
        loge A  mp                                       log (1   )         m               fo   0m 1
                                    p                                                             r
         A      
                           Am         1   m                              e            p              p
y                1  loge m   for          1
    1   log   A           p         A   m
            e                                p
                                
                                                                                Lathi & Ding
                                                                                Section 6.2.3
                                                                                pp. 325-328
                                                                                                              13
              Flattening of the S/N Ratio Using the -Law
          For optimal S/N ratio in North America  = 255 is used.
         An approximately constant S/N ratio is the most desirable.
 S 
 N0                                                    Lathi & Ding
 q                                                      Figure 6.18
                                                             p. 328
                                              (8
                                              bits)
                          Relative signal power m2(t) , (dB)
                                                                        14
                     Transmission Bandwidth
In binary PCM, we have a group of n bits corresponding to L levels with n
bits. Thus,
                      L = 2n or n = log2(L)
Signal m(t) is band-limited to B Hz which requires 2B samples per
second.
For 2nB elements of information, we must transfer 2nB bits/second.
Thus, the minimum bandwidth BT needed to transmit 2nB bits/second
is
                            BT = nB Hz
Practically speaking, usually we choose the transmission bandwidth to be
a little higher than the minimum bandwidth required.
                                                                       15
                  Example 6.2 (Lathi & Ding, page 329)
Problem: A band-limited signal m(t) of 3 kHz bandwidth is sampled at
rate of 33⅓ % higher than the Nyquist rate. The maximum allowable
error in the sample amplitude (i.e., the maximum quantization error) is
0.5% of the peak amplitude mp. Assume binary encoding. Find the
minimum bandwidth of the
channel to transmit the encoded binary signal.
Solution:
The Nyquist rate is RN = 2 x 3000 Hz = 6000 Hz (samples/second), but the
actual
rate is 33⅓ % higher, so that is 6000 Hz + (⅓ x 6000) = 8000 Hz.
The quantization step is  and the maximum quantization error is
plus/minus
/2. Hence, we can write
                                               p
                     mp
                            0.5
                    2  L 
                            100m
                                                                           16
                                L       200
For binary coding, L, must be a power of two; therefore, knowing that L =
27 = 128 and 28 = 256, we must choose n = 8 to guarantee better than a
0.5% error.
                                                                            17
               Example 6.2 Continued (Lathi & Ding, page 329)
Solution (continued):
Having chosen n = 8 to guarantee 0.5% error, to find the bandwidth
required we note that
         Total number of bits per second C = 8 bits  8000 Hz
                                           = 64,000 bits/second
However, we know we can transmit 2 bits/Hz of bandwidth¶, so it requires a
bandwidth BT of
                      BT = C/2 = 32,000 Hz = 32
                      kHz
If 24 such signals are multiplexed on a single line (known as a T1 Line in the
Telephone system, then
      CT1 = 24 x 64 kb/s = 1.536 Mb/s, and the bandwidth is 768 KHz
  ¶
   A maximum of 2B independent elements of information per second can
  be transmitted, error-free, over a noiseless channel of bandwidth B Hz.
                                                                            17
           Exponential Increase of the Output SNR (S/N ratio)
We start with the SNR (signal-to-noise ratio) equation from slide 10 above:
                          S         m 2 (t)  2
                            0 
                                 3  m2  L
                          Nq            p 
The number of levels L can be expressed as L2 = 22n where n =
log2(L) and is The number of bits to generate L levels. The SNR can
now be expressed as
                         S        m2(t)  2n
                           0
                             3
                                  m2   
                                              2
                         Nq           p 
Using the expression for bandwidth, BT = nB, then we arrive at
                       S        m 2 (t) 
                                              2B /B
                                             2
                             0
                           Nq  3
                                                T
                                   m
                                        2
                                           
 Taking the logarithm gives             p 
                  S                m (t) 
S 
        10
          log             10       3     2        2n log 10  2     6n dB
 0              log0          10             
               10
                                         2 
                                                                                    18
            Exponential Increase of the Output SNR (S/N ratio)
Nq   dB          Nq          mp    
                                                                 19
                                SNR Example
Given a full sinusoidal modulating signal m(t) of amplitude Am
into a load resistance R = 1 ohm, find the signal-to-quantization
noise ratio (sometimes called SNR):
                           2
                         A
                 Pav   m     and    mmax  Am
                 e        2     set
Setting mmax =
Am
           S      m 2 (t)  2n  3P  2n  3  2n
           N0  3 m2 (2)  m2ave  (2)   2 (2)
                               max 
             q    p 
                                        L          n       SNR
10       S  1.76  6n dB         32           5      31.8 dB
log        0
                                      64           6      37.8 dB
      10 N
            
         q                          128          7      43.8 dB
                                      256          8      49.8 dB
                                                                    19
                Bell System’s T1 Carrier System
                (1962)
The T-carrier is a member of the group of carrier systems developed by
AT&T Bell Laboratories for digital transmission of multiplexed telephone
calls using Pulse Code Modulation and Time Division Multiplexing.
The first version, the Transmission System 1 (T1), was introduced in
1962 in the Bell System, and could transmit up to 24 telephone calls
simultaneously over a single transmission line consisting of copper
wire.
                        193 bit frame – 122 sec/frame
                                                     1.544 Mbit/s data rates
                                                                               20
T1 Carrier – Time Division
Multiplexing
                             Lathi & Ding
                              Figure 6.20
                                 p. 333
                                            21
Comparison of T-Carrier (North America) and E-Carrier (Europe)
    Carrier Level    T-Carrier Data Rates   E-Carrier Data Rates
     Zero-level       64 kbits/s (DS-0)         64 kbits/s
     First-level    1.544 Mbits/s (DS-1)     2.048 Mbits/s (E1)
                      T1 – 24 channels        32 user channels
   Second-level     6.312 Mbits/s (DS-2)     8.448 Mbits/s
                      T2 – 96 channels          (E2) 128
                                                channels
     Third-level    44.736 Mbits/s (DS3)    34.368 Mbits/s (E3)
                     T3 – 672 channels         512 channels
    Fourth-level    274.176 Mbits/s (DS4)   139.264 Mbits/s
                     T4 – 4032 channels        (E4) 2048
                                               channels
     Fifth-level    400.352 Mbits/s (DS5)    565.148 Mbits/s
                     T5 – 5760 channels             (E5)
                                              8192 channels
                                                                   22
                          Worked PCM Example
We are given a signal m(t) = 2cos(2250 t) as the signal input.
(a) Find the SNR with 8-bit PCM.
For 8-bit encoding, L = 2n where n = 8, therefore, the number of levels
= 256. The amplitude Am of the sinusoidal waveform means that mp = 2
volts. The total signal swing possible (- mp to + mp) will be 2mp = 4
volts, therefore,                    2        2
the average signal power is Pave = m
                                   [(A ) /2] = [2 /2] = 2 watts. (See slide 19)
The interval  = [2m
                    p /L] = 4 volts/256 levels = 1.625  10 volt. (See
                                                           -2
slide 19) Now we can find the SNR (signal-to-quantized noise ratio)
(See side 18)
                                                              av
Using for the quantization noise   = [()2/12], and taking        = 2 W, the
Nq                                 P
SNR is given by
                     S  P         2  24 
                           ave
                                 122              98, 304
                 N   N             (1.5625 102 )2
                 q 
                                                                                  23
                          Worked PCM Example
q        
                SNRdB  10 log 98, 304  49.93 dB
                              10
                                                      24
                 Worked Example for PCM (continued)
We are given a signal m(t) = 2cos(2250 t) as the signal input.
(b) If the minimum SNR is to be at least 36 dB, how many bits n are needed
to encode the signal (i.e., find n)? Other parameters such as signal power
remain
the same as in part (a) on previous slide.
Note that 36 dB is numerically equivalent to 3,981 [about 
4,000]. Remembering that the interval is  = [2mp /L] and
2mp = 4 volts.
    3, 981 2m                    4
                 4                0.001005   and   0.0317 volt
          p    2 ;   2      3981
           
           2
Therefore, we can determine the number of levels L, and then n.
                             2mp 4
                         L     31.5
                                  0.0317
                                                                         24
                 Worked Example for PCM (continued)
The lowest integer number of bits n that will give at least 31.5 levels is
n = 5 because 25 = 32 levels. So the answer is 5 bits.
                                                                             25
             Differential Pulse Code Modulation (DPCM)
PCM is not really efficient because it generates so many bits taking up a lot
of bandwidth. Can we improve on this? YES.
Suppose we have a slowly varying signal m(t), then we exploit this
by using the difference in two adjacent samples. This will form the
basis of differential pulse code modulation (DPCM).
Let m[k] be the kth sample of signal m(t).
Then we can express the difference between adjacent samples as
                          d[k] = m[k] – m[k-1]
Instead of transmitting m[k], we instead transmit d[k].
                                      Lathi & Ding, Section 6.5, pp. 341-344
                                                                                25
            Differential Pulse Code Modulation (continued)
At the receiver knowing d[k] and the previous value of m[k-1] allows
us to construct the value of m[k].
How do we benefit from doing this?
The difference of successive samples almost always is much smaller than
the full range of the sample values of m(t) (full range covers -mp to +mp).
We use this fact to improve upon the efficiency of PCM by requiring
fewer bits.
In addition, we make use of the estimate of m[k], denoted by
m[k]. We use previous sample values of m(t) to make this
estimate.
Suppose m[k] is the estimate of the kth sample, then the difference d[k]
is given by
                        d[k] = m[k] – m[k]
and it is the difference d[k] that is transmitted.
                                       Lathi & Ding, Section 6.5, pp. 341-344
                                                                                26
Receiver Concept:
At the receiver we determine the estimate m[k] from previous sample
values, and then generate m[k] by adding the received d[k] values to
the estimate m[k]. Thus the reconstruction of the samples is done
iteratively.
                                   Lathi & Ding, Section 6.5, pp. 341-344
                          Digression on Signal Prediction
Starting with a Taylor series (time step is Ts),
                                         dm(t)
                                                   TS 2 d2(m(t) TS 3 d3(m(t)
           m[t  TS ]  m(t)                                              ...
           TS
                                          dt       2!     dt2        3!   dt3
          m[t  T                        dm(t)
                        ]  m(t)                 for small T
                        T
                    S                S                           S
                                          dt
We denote the kth sample of m(t) by m[k], that is, m[kTS] = m[k], and
m[kTS  TS] = m[k  1], and so on. This is a first-order predictor.
In handling the derivatives, we                     d
write                                                    m(kTS )  m(kTS )  m(kTS  TS )
                                                    dt                          TS
Thus,
                        T  1]  m[k]   m[k]  m[k  1] 
                        m[k
                                         S             
                                                TS     
                            m[k  1]  2m[k]  m[k  1]
                                                                                              28
                   Digression on Signal Prediction
So we get an approximation of the (k+1)th sample, m[k+1], from the two
prior samples.
                                                                         29
                      Signal Prediction (continued)
But we can do better than this. In general,
       m[k]  a1m[k  1] a2m[k        . .  aNm[k  N]    m[k]
       2]                              .     
The set of {ai} are the prediction coefficients.
This is the predicted value of m[k]. It is an Nth order predictor.
Note that the input consists of the weighted previous samples m[k-1],
m[k-2],etc. We say that input m[k] gives output m[k].
For first-order prediction, m[k] = m[k-1].
The next slide shows how to implement this prediction of m[k].
                                                                        29
             Linear Predictor Implemented With Transversal Filter
                 m[k]  a1m[k  1]  a2m[k       . .  aNm[k  N]
                 2]                              .
Input
 m[k]    Delay         Delay         Delay         Delay                  Delay
          TS            TS            TS            TS          ...        TS
                                                           Lathi & Ding           aN
                 a1            a2            a3
                                                            Figure 6.27
                                                               p. 343
                                                  Output m[k]
        Transversal filter is a tapped delay line (with required weights {ai} )
                                                                                       30
                              DPCM Transmitter
          Input                                              Outpu
           m[k]               d[k]                            t dq[k]
                                    Quantizer
          +
                                                         +
 Lathi & Ding
Figure 6.28(a)    mq[k]
    p. 344                                           +   
                                                               mq[k]
                                         Predictor
         d[k]  m[k]  mq [k] and is quantized to yield,
         dq [k]  d[k]  q[k] where q[k] is the quantization error
The predictor output m[k] is fed back to the input so the predictor input
mq[k] is given by
      mq [k]  mq [k]  dq [k]  m[k]  d[k]  dq[k]  m[k]  q[k]
                                                                            31
                        DPCM Transmitter
This shows that mq[k] is the quantized version of m[k].
                                                          32
                               DPCM Receiver
              Input                               Outpu
               dq[k]                               t
                       +                           mq[k]
                           
    Lathi & Ding
   Figure 6.28(a)          +
       p. 344          mq[k]
                                      Predictor
The receiver’s output (which is the predictor’s input) is also the same,
mq[k] = m[k] + q[k].
Hence, we are able to receive the desired signal m[k] plus the
quantization noise, q[k]. It is important to note that from the difference
signal d[k] is much smaller that the noise associated with m[k].
                                                                             32
                     DPCM SNR Improvement
How much better is DPCM with regard to SNR?
To determine this, define mp and dp as the peak amplitudes of
m(t) and d(t), respectively. Assuming the same number of steps
L for both, then the quantization step  in DPCM is reduced in
magnitude by dp/mp.
                                               2
The quantization noise is proportional to ()   – the quantization noise
power is reduced by a factor (d ) and the SNR is therefore increased by
                                  2
/m
(m / )2.                     p  p
d
  p   p
Maintaining the same SNR, the number of bits can be reduced.
Example:
The AT&T telephone system sometimes operates at 32 kbits/s
(or even 24 kbits/s) when using DPCM. [The telephone system was
initially designed to use a 64 kbits/s data rate.]
                                                                       33
                        Adaptive Differential PCM
Adaptive differential PCM (ADPCM) can further improve upon DPCM
by Incorporating an adaptive quantizer (variable ) at encoding.
The quantized prediction error
dq[k] is a good measure of the
predicted error size – it can be                        Adaptive        dq[k]
used to change                         m[k]             Quantizer
 which minimizes dq[k]. When
d [k] fluctuates around large positive
                                       +                                 To
                                                                        Channel
 q
or negative values, the prediction                nth order Predictor
error is large and  needs to
increase, but when dq[k] fluctuates
around zero (small values), then
needs to decrease.
Example: An 8-bit PCM sequence can be encoded into a 4-bit
ADPCM sequence at the same sampling rate. This reduces the channel
bandwidth by one-half with no loss in quality.
                                                                                  34
Adaptive Differential PCM Output Example
                                           time
                                                  35
Next Topic is Delta Modulation
                                 36