comm.APPDecoder System object

Package: comm

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.


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.


cloneCreate APP decoder object with same property values with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset states of APP decoder object
stepDecode convolutional code using the a posteriori probability method


collapse all

Transmit a convolutionally encoded 8-PSK-modulated bit stream through an AWGN channel, then demodulate, decode using an APP decoder, and count errors.

  1. Create the 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', ...
  2. Demodulate using soft-decision decoding.

        hDemod = comm.PSKDemodulator('BitOutput',true, 'PhaseOffset',0, ...
                   'DecisionMethod', 'Approximate log-likelihood ratio', ...
                   'Variance', noiseVar);
        hAPPDec = comm.APPDecoder(...
                   'TrellisStructure', poly2trellis(7, [171 133]), ...
                   'Algorithm', 'True APP', 'CodedBitLLROutputPort', false);
        hError = comm.ErrorRate;
  3. Decode the convolutionally encoded data. Then, convert from soft-decision to hard-decision.

    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);
    receivedSoftBits = step(hAPPDec, zeros(frameLength,1), -demodSignal)
    receivedBits = double(receivedSoftBits > 0);
         errorStats = step(hError, data, receivedBits);

    The APP decoder assumes a polarization of the soft inputs that is inverse to that of the demodulator soft outputs. Therefore, you must change the sign of demodulated signal, demodSignal.

  4. Display the error rate information.

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


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

Was this topic helpful?