Accelerating the pace of engineering and science

# comm.RectangularQAMTCMDemodulator System object

Package: comm

Demodulate convolutionally encoded data mapped to rectangular QAM signal constellation

## Description

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.

## Construction

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.

## Properties

 TrellisStructure 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]). TerminationMethod 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. TracebackDepth 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. ResetInputPort 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. ModulationOrder 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. OutputDataType Data type of output Specify output data type as logical | double. The default is double.

## Methods

 clone Create rectangular QAM TCM demodulator object with same property values getNumInputs Number of expected inputs to step method getNumOutputs Number of outputs from step method isLocked Locked status for input attributes and nontunable properties release Allow property value and input characteristics changes reset Reset states of the rectangular QAM TCM demodulator object step Demodulate convolutionally encoded data mapped to rectangular QAM constellation

## Examples

expand all

### Modulate and Demodulate Using Rectangular 16-QAM TCM

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

Create QAM TCM modulator and demodulator System objects™.

```hMod = comm.RectangularQAMTCMModulator;
hDemod = comm.RectangularQAMTCMDemodulator('TracebackDepth',16);
```

Create an AWGN channel object.

```hAWGN = 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. To accurately calculate the bit error rate, the delay through the decoder must be known.

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

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

```hErrorCalc = 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 = step(hMod,txData);
% Pass through AWGN channel
rxSig = step(hAWGN,txSig);
% Demodulate
rxData = step(hDemod,rxSig);
% Collect error statistics
errStats = step(hErrorCalc,txData,rxData);
end
```

Display the error data.

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

## Algorithms

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.