Accelerating the pace of engineering and science

# comm.ConvolutionalEncoder System object

Package: comm

Convolutionally encode binary data

## Description

The ConvolutionalEncoder object encodes a sequence of binary input vectors to produce a sequence of binary output vectors.

To convolutionally encode a binary signal:

1. Define and set up your convolutional encoder object. See Construction.

2. Call step to encode a sequence of binary input vectors to produce a sequence of binary output vectors according to the properties of comm.ConvolutionalEncoder. The behavior of step is specific to each object in the toolbox.

## Construction

H = comm.ConvolutionalEncoder creates a System object™, H, that convolutionally encodes binary data.

H = comm.ConvolutionalEncoder(Name,Value) creates a convolutional encoder 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.ConvolutionalEncoder(TRELLIS,Name,Value) creates a convolutional encoder 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. Use the istrellis function to check if a structure is a valid trellis structure. The default is the result of poly2trellis(7, [171 133]). TerminationMethod Termination method of encoded frame Specify how the encoded frame is terminated as one of Continuous | Truncated | Terminated. The default is Continuous. When you set this property to Continuous, the object retains the encoder states at the end of each input vector for use with the next input vector. When you set this property to Truncated, the object treats each input vector independently. The encoder states are reset at the start of each input vector. If you set the InitialStateInputPort property to false, the object resets its states to the all-zeros state. If you set the InitialStateInputPort property to true, the object resets the states to the values you specify in the initial states step method input. When you set this property to Terminated, the object treats each input vector independently. For each input vector, the object uses extra bits to set the encoder states to all-zeros states at the end of the vector. For a rate K/N code, the step method outputs a vector with length $N×\left(L+S\right)}{K}$, where S = constraintLength–1 (or, in the case of multiple constraint lengths, S = sum(constraintLength(i)–1)). L is the length of the input to the step method. ResetInputPort Enable encoder 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 their initial conditions. This property applies when you set the TerminationMethod property to Continuous. DelayedResetAction Delay output reset 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 encoder occurs after the object computes the encoded data. When you set this property to false, the reset of the internal states of the encoder occurs before the object computes the encoded data. This property applies when you set the ResetInputPort property to true. InitialStateInputPort Enable initial state input Set this property to true to enable a step method input that allows the specification of the initial state of the encoder for each input vector. The default is false. This property applies when you set the TerminationMethod property to Truncated. FinalStateOutputPort Enable final state output Set this property to true to obtain the final state of the encoder via a step method output. The default is false. This property applies when you set the TerminationMethod property to Continuous or Truncated. PuncturePatternSource Source of puncture pattern Specify the source of the puncture pattern as one of None | Property. The default is None. When you set this property to None the object does not apply puncturing. When you set this property to Property, the object punctures the code. This puncturing is based on the puncture pattern vector that you specify in the PuncturePattern property. This property applies when you set the TerminationMethod property to Continuous or Truncated. PuncturePattern Puncture pattern vector Specify the puncture pattern used to puncture the encoded data as a column vector. The default is [1; 1; 0; 1; 0; 1]. The vector contains 1s and 0s, where the 0 indicates the punctured, or excluded, bits. This property applies when you set the TerminationMethod property to Continuous or Truncated and the PuncturePatternSource property to Property.

## Methods

 clone Create convolutional encoder 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 convolutional encoder object step Convolutionally encode binary data

## Examples

Transmit a convolutionally encoded 8-DPSK-modulated bit stream.

```    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');
hError = comm.ErrorRate('ComputationDelay',3,'ReceiveDelay', 34);

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);
errors = step(hError, data, receivedBits);
end
disp(errors)
```

## Algorithms

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

 The operation mode Reset on nonzero input via port block parameter corresponds to the ResetInputPort property.

## See Also

Was this topic helpful?