Main Content


Demodulate convolutionally encoded data mapped to rectangular QAM signal constellation


The RectangularQAMTCMDemodulator object uses the Viterbi algorithm to decode a trellis-coded modulation (TCM) signal that was previously modulated using a rectangular QAM signal constellation.

To demodulate convolutionally encoded data mapped to a rectangular QAM signal constellation:

  1. Define and set up your rectangular QAM TCM demodulator object. See Construction.

  2. Call step to demodulate the signal according to the properties of comm.RectangularQAMTCMDemodulator. 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.RectangularQAMTCMDemodulator creates a trellis-coded, rectangular, quadrature amplitude (QAM TCM) demodulator System object, H. This object demodulates convolutionally encoded data that has been mapped to a rectangular QAM constellation.

H = comm.RectangularQAMTCMDemodulator(Name,Value) creates a rectangular, QAM TCM, demodulator 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.RectangularQAMTCMDemodulator(TRELLIS,Name,Value) creates a rectangular QAM TCM demodulator object, H. This object has 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. Use the istrellis function to check whether a structure is a valid trellis. The default is the result of poly2trellis([3 1 1], [ 5 2 0 0; 0 0 1 0; 0 0 0 1]).


Termination method of encoded frame

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

When you set this property to Continuous, the object saves the internal state metric at the end of each frame. The next frame uses the same state metric. The object treats each traceback path independently. If the input signal contains only one symbol, you should use Continuous mode.

When you set this property to Truncated, the object treats each input vector independently. The traceback path starts at the state with the best metric and always ends in the all-zeros state.

When you set this property to Terminated, the object treats each input vector independently, and the traceback path always starts and ends in the all-zeros state.


Traceback depth for Viterbi decoder

Specify the scalar, integer number of trellis branches to construct each traceback path. The default is 21. The Traceback depth parameter influences the decoding accuracy and delay. The decoding delay is the number of zero symbols that precede the first decoded symbol in the output.

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, no output delay occurs and the traceback depth must be less than or equal to the number of symbols in each input vector.


Enable demodulator reset input

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


Number of points in signal constellation

Specify the number of points in the signal constellation used to map the convolutionally encoded data as a positive, integer scalar value. The number of points must be 4, 8, 16, 32, or 64. The default is 16. The ModulationOrder property value must equal the number of possible input symbols to the convolutional decoder of the rectangular QAM TCM demodulator object. The ModulationOrder must equal 2N for a rate K/N convolutional code.


Data type of output

Specify output data type as logical | double. The default is double.


stepDemodulate convolutionally encoded data mapped to rectangular QAM constellation
Common to All System Objects

Allow System object property value changes


Reset internal states of System object


collapse all

Modulate and demodulate data using 16-QAM TCM in an AWGN channel. Estimate the BER.

Create QAM TCM modulator and demodulator System objects.

rqamtcmod = comm.RectangularQAMTCMModulator;
rqamtcdemod = comm.RectangularQAMTCMDemodulator(TracebackDepth=16);

Create an AWGN channel object.

awgnchan = comm.AWGNChannel(EbNo=5);

Determine the delay through the QAM TCM demodulator. The demodulator uses the Viterbi algorithm to decode the TCM signal that was modulated using rectangular QAM. The error rate calculation must align the received samples with the transmitted sample to accurately calculate the bit error rate. Calculate the delay in the system with the number of bits per symbol and the decoder traceback depth in the TCM demodulator.

bitsPerSymbol = log2(rqamtcdemod.TrellisStructure.numInputSymbols);
delay = rqamtcdemod.TracebackDepth*bitsPerSymbol;

Create an error rate calculator object with the ReceiveDelay property set to delay.

errRate = comm.ErrorRate(ReceiveDelay=delay);

Generate binary data and modulate with 16-QAM TCM. Pass the signal through an AWGN channel and demodulate. Calculate the error statistics. The loop runs until either 100 bit errors are encountered or 1e7 total bits are transmitted.

% Initialize the error results vector.
errStats = [0 0 0];

while errStats(2) < 100 && errStats(3) < 1e7
    % Transmit frames of 200 3-bit symbols
    txData = randi([0 1],600,1);
    % Modulate
    txSig = rqamtcmod(txData);
    % Pass through AWGN channel
    rxSig = awgnchan(txSig);
    % Demodulate
    rxData = rqamtcdemod(rxSig);
    % Collect error statistics
    errStats = errRate(txData,rxData);

Display the error data.

fprintf('Error rate = %4.2e\nNumber of errors = %d\n', ...
Error rate = 1.94e-03
Number of errors = 100


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

Extended Capabilities

Version History

Introduced in R2012a