Documentation

comm.gpu.ConvolutionalEncoder class

Package: comm.gpu

Convolutionally encode binary data with GPU

Description

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

    Note:   To use this object, you must install a Parallel Computing Toolbox™ license and have access to an appropriate GPU. For more about GPUs, see GPU Computing in the Parallel Computing Toolbox documentation.

A GPU-based System object™ accepts typical MATLAB® arrays or objects that you create using the gpuArray class as an input to the step method. GPU-based System objects support input signals with double- or single-precision data types. The output signal inherits its datatype from the input signal.

  • If the input signal is a MATLAB array, then the output signal is also a MATLAB array. In this case, the System object handles data transfer between the CPU and GPU.

  • If the input signal is a gpuArray, then the output signal is also a gpuArray. In this case, the data remains on the GPU. Therefore, when the object is given a gpuArray, calculations take place entirely on the GPU and no data transfer occurs. Invoking the step method with gpuArray arguments provides increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU in the Parallel Computing Toolbox documentation.

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.gpu.ConvolutionalEncoder. The behavior of step is specific to each object in the toolbox.

Construction

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

H = comm.gpu.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.gpu.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. The default is the result of poly2trellis(7, [171 133]). Use the istrellis function to check if a structure is a valid trellis structure.

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 and resets its states to the all-zeros state.

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 the all-zeros state at the end of the vector. For a rate K/N code, the step method outputs a vector with length N×(L+S)K, where S = constraintLength–1. 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

You cannot reset this encoder object using an input port. The only valid property setting is false.

DelayedResetAction

Delay output reset

You cannot reset this encoder object using an input port. The only valid property setting is false.

InitialStateInputPort

You cannot set the initial state of this encoder object. The only valid property setting is false.

FinalStateOutputPort

You cannot output the final state of this encoder object. The only valid property setting is false.

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 that the object uses 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 0 indicates a punctured, or excluded, bit. This property applies when you set the TerminationMethod property to Continuous or Truncated and the PuncturePatternSource property to Property.

NumFrames

Number of independent frames present in the input and output data vectors.

Specify the number of independent frames contained in a single data input/output vector. The default value of this property is 1. The objects segments the input vector into NumFrames segments and encodes them independently. The output contains NumFrames encoded segments. This property is applicable when you set the TerminationMethod to Terminated or Truncated.

Methods

cloneCreate convolutional encoder 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 convolutional encoder object
stepConvolutionally encode binary data

Examples

expand all

8-PSK-Modulation With Convolutional Encoding

Transmit a Convolutionally Encoded, 8-PSK-Modulated Bit Stream Through an AWGN Channel.

Create a GPU-based Convolutional Encoder System object.

hConEnc = comm.gpu.ConvolutionalEncoder;

Create a GPU-based PSK Modulator System object that accepts a bit input signal.

hMod = comm.gpu.PSKModulator('BitInput',true);

Create a GPU-based AWGN Channel System object with a signal-to-noise ratio of seven.

hChan = comm.gpu.AWGNChannel('NoiseMethod', ...
         'Signal to noise ratio (SNR)',...
         'SNR',7);

Create a GPU-based PSK Demodulator System object that outputs a column vector of bit values.

hDemod = comm.gpu.PSKDemodulator('BitOutput',true);

Create a GPU-based Viterbi Decoder System object that accepts an input vector of hard decision values, which are zeros or ones.

hDec = comm.gpu.ViterbiDecoder('InputFormat','Hard');

Create an Error Rate System object that ignores 3 data samples before makings comparisons. The received data lags behind the transmitted data by 34 samples.

hError = comm.ErrorRate('ComputationDelay',3,'ReceiveDelay', 34);

Run the simulation by using the step method to process data.

for counter = 1:20
  data = randi([0 1],30,1);
  encodedData = step(hConEnc, gpuArray(data));
  modSignal = step(hMod, encodedData);
  receivedSignal = step(hChan, modSignal);
  demodSignal = step(hDemod, receivedSignal);
  receivedBits = step(hDec, demodSignal);
  errors = step(hError, data, gather(receivedBits));
end

Display the errors.

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.

Was this topic helpful?