Decode convolutional code using the a posteriori probability method


The APPDecoder object performs a posteriori probability (APP) decoding of a convolutional code.

To perform a posteriori probability (APP) decoding of a convolutional code:

  1. Define and set up your a posteriori probability decoder object. See Construction.

  2. Call step to perform APP decoding according to the properties of comm.APPDecoder. The behavior of step is specific to each object in the toolbox.


Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


H = comm.APPDecoder creates an a posteriori probability (APP) decoder System object, H, that decodes a convolutional code using the APP method.

H = comm.APPDecoder(Name,Value) creates an APP decoder object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).

H = comm.APPDecoder(TRELLIS,Name,Value) creates an APP decoder object, H, with the TrellisStructure property set to TRELLIS, and the other specified properties set to the specified values.



Trellis structure of convolutional code

Specify trellis as a MATLAB® structure that contains the trellis description of the convolutional code. The default is the result of poly2trellis(7, [171 133], 171). Use the istrellis function to check if a structure is a valid trellis structure.


Termination method of encoded frame

Specify how the encoded frame is terminated as one of Truncated | Terminated. The default is Truncated. When you set this property to Truncated, the object assumes that the encoder stops after encoding the last symbol in the input frame. When you set this property to Terminated the object assumes that the encoder forces the trellis to end each frame in the all-zeros state by encoding additional symbols. If you use the comm.ConvolutionalEncoder System object to generate the encoded frame, the TerminationMethod values of both encoder and decoder objects must match.


Decoding algorithm

Specify the decoding algorithm that the object uses as one of True APP | Max* | Max. The default is Max*. When you set this property to True APP, the object implements true a posteriori probability decoding. When you set the property to any other value, the object uses approximations to increase the speed of the computations.


Number of scaling bits

Specify the number of bits the decoder uses to scale the input data to avoid losing precision during the computations. The default is 3. The decoder multiplies the input by 2NumScalingBits and divides the pre-output by the same factor. This property must be a scalar integer between 0 and 8. This property applies when you set the Algorithm property to Max*.


Enable coded-bit LLR output

Set this property to false to disable the second output of the decoding step method. The default is true.


resetReset states of APP decoder object
stepDecode convolutional code using the a posteriori probability method
Common to All System Objects

Allow System object property value changes


expand all

This example shows how to use the APP decoder on a convolutionally encoded 8-PSK-modulated bit stream transmitted through an AWGN channel.

Create convolutional encoder, PSK modulator, and AWGN channel System objects.

noiseVar = 2e-1;
frameLength = 300;
hConEnc = comm.ConvolutionalEncoder('TerminationMethod','Truncated');
hMod = comm.PSKModulator('BitInput',true,'PhaseOffset',0);
hChan = comm.AWGNChannel('NoiseMethod','Variance', ...

Create convolutional decoder, PSK demodulator, and error rate System objects.

hAPPDec = comm.APPDecoder(...
    'TrellisStructure',poly2trellis(7,[171 133]), ...
    'Algorithm','True APP','CodedBitLLROutputPort',false);
hDemod = comm.PSKDemodulator('BitOutput',true,'PhaseOffset',0, ...
    'DecisionMethod','Approximate log-likelihood ratio', ...
hError = comm.ErrorRate;

Transmit a convolutionally encoded 8-PSK-modulated bit stream through an AWGN channel. Demodulate the received signal using soft-decision. Decode the demodulated signal using the APP decoder.

for counter = 1:5
     data = randi([0 1],frameLength,1);
     encodedData = step(hConEnc,data);
     modSignal = step(hMod,encodedData);
     receivedSignal = step(hChan,modSignal);
     demodSignal = step(hDemod,receivedSignal);
     % The APP decoder assumes a polarization of the soft inputs that is
     % inverse to that of the demodulator soft outputs. Change the sign of
     % demodulated signal.
     receivedSoftBits = step(hAPPDec,zeros(frameLength,1),-demodSignal);
     % Convert from soft-decision to hard-decision.
     receivedBits = double(receivedSoftBits > 0);
     % Count errors
     errorStats = step(hError,data,receivedBits);

Display the error rate information.

fprintf('Error rate = %f\nNumber of errors = %d\n', ...
     errorStats(1), errorStats(2))
Error rate = 0.000000
Number of errors = 0


This object implements the algorithm, inputs, and outputs described on the APP Decoder block reference page. The object properties correspond to the block parameters.

Extended Capabilities

Introduced in R2012a