Communications Toolbox    

Examples of Convolutional Coding

This section contains more examples of convolutional coding:

Example: A Rate-2/3 Feedforward Encoder

The example below uses the rate 2/3 feedforward encoder depicted in the schematic below. The accompanying description explains how to determine the trellis structure parameter from a schematic of the encoder and then how to perform coding using this encoder.

Determining Coding Parameters.   The convenc and vitdec functions can implement this code if their parameters have the appropriate values.

The encoder's constraint length is a vector of length 2 because the encoder has two inputs. The elements of this vector indicate the number of bits stored in each shift register, including the current input bits. Counting memory spaces in each shift register in the diagram and adding one for the current inputs leads to a constraint length of [5 4].

To determine the code generator parameter as a 2-by-3 matrix of octal numbers, use the element in the ith row and jth column to indicate how the ith input contributes to the jth output. For example, to compute the element in the second row and third column, notice that the leftmost and two rightmost elements in the second shift register of the diagram feed into the sum that forms the third output. Capture this information as the binary number 1011, which is equivalent to the octal number 13. The full value of the code generator matrix is [23 35 0; 0 5 13].

To use the constraint length and code generator parameters in the convenc and vitdec functions, use the poly2trellis function to convert those parameters into a trellis structure. The command to do this is below.

Using the Encoder.   Below is a script that uses this encoder.

Notice that convenc accepts a vector containing 2-bit symbols and produces a vector containing 3-bit symbols, while vitdec does the opposite. Also notice that biterr ignores the first 68 elements of decoded. That is, the decoding delay is 68, which is the number of bits per symbol (2) of the recovered message times the traceback depth value (34) in the vitdec function. The first 68 elements of decoded are 0s, while subsequent elements represent the decoded messages.

Example: A Punctured Convolutional Code

This example processes a punctured convolutional code. It begins by generating 3000 random bits and encoding them using a rate-1/2 convolutional encoder. The resulting vector contains 6000 bits, which are mapped to values of -1 and 1 for transmission. The puncturing process removes every third value and results in a vector of length 4000. The punctured code, punctcode, passes through an additive white Gaussian noise channel. Afterwards, the example inserts values to reverse the puncturing process. While the puncturing process removed both -1s and 1s from code, the insertion process inserts zeros. Then vitdec decodes the vector of -1s, 1s, and 0s using the 'unquant' decision type. This unquantized decision type is appropriate here for these reasons:

Finally, the example computes the bit error rate and the number of bit errors.


  Creating and Decoding Convolutional Codes Selected Bibliography for Convolutional Coding