comm.ViterbiDecoder System object

Package: comm

Decode convolutionally encoded data using Viterbi algorithm

Description

The ViterbiDecoder object decodes input symbols to produce binary output symbols. This object can process several symbols at a time for faster performance. This object processes variable-size signals; however, variable-size signals cannot be applied for erasure inputs.

To decode input symbols and produce binary output symbols:

  1. Define and set up your Viterbi decoder object. See Construction.

  2. Call step to decode input symbols according to the properties of comm.ViterbiDecoder. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.ViterbiDecoder creates a Viterbi decoder System object™, H. This object uses the Viterbi algorithm to decode convolutionally encoded input data.

H = comm.ViterbiDecoder(Name,Value) creates a Viterbi 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.ViterbiDecoder(TRELLIS,Name,Value) creates a Viterbi decoder object, H. This object has the TrellisStructure property set to TRELLIS and the other specified properties set to the specified values.

Properties

TrellisStructure

Trellis structure of convolutional code

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

InputFormat

Input format

Specify the format of the input to the decoder as Unquantized | Hard | Soft. The default is Unquantized.

When you set this property to Unquantized, the input must be a real vector of double- or single-precision soft values that are unquantized. The object considers negative numbers to be 1s and positive numbers to be 0s.

When you set this property to Hard, the input must be a vector of hard decision values, which are 0s or 1s. The data type of the inputs can be double-precision, single-precision, logical, 8-, 16-, and 32-bit signed integers. You can also use 8-, 16-, and 32-bit unsigned integers.

When you set this property to Soft, the input requires a vector of quantized soft values represented as integers between 0 and . The data type of the inputs can be double-precision, single-precision, logical, 8-, 16-, and 32-bit signed integers. You can also use 8-, 16-, and 32-bit unsigned integers. Alternately, you can specify the data type as an unsigned and unscaled fixed point object (fi) with a word length equal to the word length that you specify in the SoftInputWordLength property. The object considers negative numbers to be 0s and positive numbers to be 1s.

SoftInputWordLength

Soft input word length

Specify the number of bits to represent each quantized soft input value as a positive, integer scalar value. The default is 4 bits. This property applies when you set the InputFormat property to Soft.

InvalidQuantizedInputAction

Action when input values are out of range

Specify the action the object takes when input values are out of range as Ignore | Error. The default is Ignore. Set this property to Error so that the object generates an error when the quantized input values are out of range. This property applies when you set the InputFormat property to Hard or Soft.

TracebackDepth

Traceback depth

Specify the number of trellis branches to construct each traceback path as a numeric, integer scalar value. The default is 34. The traceback depth influences the decoding accuracy and delay. The number of zero symbols that precede the first decoded symbol in the output represent a decoding delay.

When you set the TerminationMethod property to Continuous, the decoding delay consists of TracebackDepth zero symbols or TracebackDepth×K zero bits for a rate K/N convolutional code.

When you set the TerminationMethod property to Truncated or Terminated, there is no output delay. In this case, TracebackDepth must be less than or equal to the number of symbols in each input. If the code rate is 12, a typical traceback depth value is about five times the constraint length of the code.

TerminationMethod

Termination method of encoded frame

Specify the termination method as Continuous | Truncated | Terminated. The default is Continuous.

In Continuous mode, the object saves the internal state metric at the end of each frame for use with the next frame. The object treats each traceback path independently.

In Truncated mode, the object treats each frame independently. The traceback path starts at the state with the best metric and always ends in the all-zeros state. In Terminated mode, the object treats each frame independently, and the traceback path always starts and ends in the all-zeros state.

ResetInputPort

Enable decoder reset input

Set this property to true to enable an additional step method input. The default is false. When the reset input is a nonzero value, the object resets the internal states of the decoder to initial conditions. This property applies when you set the TerminationMethod property to Continuous.

DelayedResetAction

Reset on nonzero input via port

Set this property to true to delay resetting the object output. The default is false. When you set this property to true, the reset of the internal states of the decoder occurs after the object computes the decoded data. When you set this property to false, the reset of the internal states of the decoder occurs before the object computes the decoded data. This property applies when you set the ResetInputPort property to true.

PuncturePatternSource

Source of puncture pattern

Specify the source of the puncture pattern as None | Property. The default is None.

When you set this property to None, the object assumes no puncturing. Set this property to Property to decode punctured codewords based on a puncture pattern vector specified via the PuncturePattern property.

PuncturePattern

Puncture pattern vector

Specify puncture pattern to puncture the encoded data. The default is [1; 1; 0; 1; 0; 1]. The puncture pattern is a column vector of 1s and 0s. The 0s indicate the position to insert dummy bits. The puncture pattern must match the puncture pattern used by the encoder. This property applies when you set the PuncturePatternSource property to Property.

ErasuresInputPort

Enable erasures input

Set this property to true to specify a vector of erasures as a step method input. The default is false. The erasures input must be a double-precision or logical, binary, column vector. This vector indicates which symbols of the input codewords to erase. Values of 1 indicate erased bits. The decoder does not update the branch metric for the erasures in the incoming data stream.

The lengths of the step method erasure input and the step method data input must be the same. When you set this property to false, the object assumes no erasures.

OutputDataType

Data type of output

Specify the data type of the output as Full precision | Smallest unsigned integer | double | single | int8 | uint8 | int16 | uint16 | int32 | uint32 | logical. The default is Full precision.

When the input signal is an integer data type, you must have a Fixed-Point Designer™ user license to use this property in Smallest unsigned integer or Full precision mode.

 Fixed-Point Properties

Methods

cloneCreate Viterbi decoder object 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 the Viterbi decoder object
stepDecode convolutionally encoded data using Viterbi algorithm

Examples

Transmit a convolutionally encoded 8-DPSK-modulated bit stream through an AWGN channel. Then, demodulate, decode using a Viterbi decoder, and count errors.

 hConEnc = comm.ConvolutionalEncoder;
 hMod = comm.DPSKModulator('BitInput',true);
 hChan = comm.AWGNChannel('NoiseMethod', ...
                    'Signal to noise ratio (SNR)', 'SNR',10);
 hDemod = comm.DPSKDemodulator('BitOutput',true);                                  
 hDec = comm.ViterbiDecoder('InputFormat','Hard');
 % Delay in bits is TracebackDepth times the number of bits per symbol
   delay = hDec.TracebackDepth*...
                    log2(hDec.TrellisStructure.numInputSymbols);
   hError = comm.ErrorRate('ComputationDelay',3,'ReceiveDelay',delay);
   for counter = 1:20
      data = randi([0 1],30,1);
      encodedData = step(hConEnc, data);
      modSignal = step(hMod, encodedData);
      receivedSignal = step(hChan, modSignal);
      demodSignal = step(hDemod, receivedSignal);
      receivedBits = step(hDec, demodSignal);
      errorStats = step(hError, data, receivedBits);
    end
    fprintf('Error rate = %f\nNumber of errors = %d\n', ...
      errorStats(1), errorStats(2))

Algorithms

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

  • The Decision type parameter corresponds to the InputFormat property.

  • The Operation mode parameter corresponds to the TerminationMethod property.

Was this topic helpful?