Communications Blockset    

Implementing Differential Pulse Code Modulation

The quantization in the section Quantizing a Signal requires no a priori knowledge about the transmitted signal. In practice, you can often make educated guesses about the present signal based on past signal transmissions. Using such educated guesses to help quantize a signal is known as predictive quantization. The most common predictive quantization method is differential pulse code modulation (DPCM). The DPCM Encoder and DPCM Decoder blocks can help you implement a DPCM predictive quantizer.

DPCM Terminology

To determine an encoder for such a quantizer, you must supply not only a partition and codebook as described in Representing Quantization Parameters, but also a predictor. The predictor is a function that the DPCM encoder uses to produce the educated guess at each step. Instead of quantizing x itself, the encoder quantizes the predictive error, which is the difference between the educated guess and the actual value. The special case when the numerator is linear and the denominator is 1 is called delta modulation.

For more information about how DPCM works, see [1] in Selected Bibliography for Source Coding, or look underneath the masks of the DPCM Encoder and DPCM Decoder blocks.

Representing Predictors

This blockset implements predictors using an IIR filter. Just as you can specify a filter using a rational function of z-1, you specify the predictor by giving its numerator and denominator. In block masks, the numerator and denominator are vectors that list the coefficients in order of ascending powers of z-1.

The numerator's constant term must be zero. This makes sense conceptually because the filter's output is meant to predict the present signal without actually knowing its value.

In most applications, the denominator is the constant function 1.

Coded and Decoded Signals

If you encode a given signal using DPCM, then two resulting signals are the quantization index and the quantization-encoded signal. These correspond exactly to the two outputs of an ordinary quantization encoder. In both instances, the quantization index tells which partition interval a signal lies in, and the quantization-encoded signal tells which codebook values correspond to those partition intervals.

To use the DPCM Decoder block to recover a message that has been through the DPCM Encoder block, connect the quantization index signal, not the quantization-encoded signal, to the input port of the DPCM Decoder block.

The DPCM Decoder block outputs two signals. The first output is the attempted recovery of the message that first entered the DPCM encoder (assuming the encoder and decoder have matching parameters). The second output comes directly from the underlying quantization decoder. It represents the quantized predictive error, not the recovered message itself.

Example: Using DPCM Encoding and Decoding

A simple special case of DPCM quantizes the difference between the signal's current value and its value at the previous step. Thus the predicted value equals the actual value at the previous step. The model below implements this scheme. It encodes a sine wave, decodes it, and plots both the original and decoded signals.

To open the completed model, click here in the MATLAB Help browser. To build the model, gather and configure these blocks:

Connect the blocks as shown in the figure. Also, from the model window's Simulation menu, choose Simulation parameters; then in the Simulation Parameters dialog box, set Stop time to 1.

Running the model produces scope images similar to those below. (To make the axis ranges and titles exactly match those below, right-click each plot area in the scope and select Axes properties.)


  Quantizing a Signal Companding a Signal