Main Content


Decode input signal using turbo decoding with GPU

To use this object, you must install Parallel Computing Toolbox™ and have access to an appropriate GPU. For more about GPUs, see GPU Computing (Parallel Computing Toolbox).


The comm.gpu.TurboDecoder System object™ decodes the input signal by using a parallel concatenated decoding scheme with a graphics processing unit (GPU). This decoding scheme uses the a-posteriori probability (APP) decoder as the constituent decoder. The constituent decoders use the same trellis structure and algorithm.

A GPU-based System object accepts typical MATLAB® arrays or objects created using the gpuArray class. A GPU-based System object supports input signals with double- or single-precision data types. The output signal inherits its data type from the input signal.

  • If the input signal is a MATLAB array, the System object handles data transfer between the CPU and the GPU. The output signal is a MATLAB array.

  • If the input signal is a gpuArray, the data remains on the GPU. The output signal is a gpuArray. When the object is given a gpuArray, calculations take place entirely on the GPU, and no data transfer occurs. Passing gpuArray arguments provides increased performance by reducing simulation time. For more information, see Establish Arrays on a GPU (Parallel Computing Toolbox).

To decode an input signal using a turbo decoding scheme with GPU:

  1. Create the comm.gpu.TurboDecoder object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?



gpuTurboDec = comm.gpu.TurboDecoder creates a GPU-based turbo decoder System object. This object uses an APP constituent decoder to iteratively decode the parallel-concatenated convolutionally encoded input data.


gpuTurboDec = comm.gpu.TurboDecoder(trellis,interlvrIndices,numIter) sets the TrellisStructure property to trellis, the InterleaverIndices property to interlvrIndices, and the NumIterations property to numIter.

gpuTurboDec = comm.gpu.TurboDecoder(___,Name,Value) sets Properties using one or more name-value arguments in addition to any of the input argument combinations in previous syntaxes. For example, 'NumIterations',10 specifies the number of decoding iterations used for each call to the System object.


expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Trellis description of the constituent convolutional code, specified as a structure that contains the trellis description for a rate KN code. K is the number of input bit streams, and N is the number of output bit streams.


K must be 1 for the turbo coder. For more information, see Coding Rate.

You can either use the poly2trellis function to create the trellis structure or create it manually. For more about this structure, see Trellis Description of a Convolutional Code and the istrellis function.

The trellis structure contains these fields.

Number of symbols input to the encoder, specified as an integer equal to 2K, where K is the number of input bit streams.

Data Types: double

Number of symbols output from the encoder, specified as an integer equal to 2N, where N is the number of output bit streams.

Data Types: double

Number of states in the encoder, specified as a power of 2.

Data Types: double

Next states for all combinations of current states and current inputs, specified as a matrix of integers. The matrix size must be numStates-by-2K.

Data Types: double

Outputs for all combinations of current states and current inputs, specified as a matrix of octal numbers. The matrix size must be numStates-by-2K.

Data Types: double

Data Types: struct

Source of interleaver indices, specified as 'Property'. The only valid setting for this property is Property, which uses the interleaver indices that you specify in the InterleaverIndices property.

Data Types: char | string

Interleaver indices that define the mapping used to permute the codeword bits input to the decoder, specified as a column vector of integers. The vector must be of length L. Each element of the vector must be an integer in the range [1, L] and must be unique. L is the length of the decoded output message, dec.

Data Types: double

Decoding algorithm, specified as 'True APP'. The only valid setting is 'True APP', which implements true APP decoding.

Data Types: char | string

Number of decoding iterations, specified as a positive integer. This property sets the number of decoding iterations used for each call to the object.

Data Types: double

Number of independent frames present in the input and output data vectors, specified as a positive integer.

The object segments the input vector into NumFrames segments and decodes them independently. The output contains NumFrames decoded segments.

Data Types: double



dec = gpuTurboDec(codeword) decodes the input data by using the parallel concatenated convolutional coding scheme. If the host computer has a GPU configured, the processing utilizes the GPU. Otherwise, the processing uses the CPU. The output is the decoded data.

Input Arguments

expand all

Parallel concatenated codeword, specified as a column vector.

Data Types: double | single

Output Arguments

expand all

Decoded message, returned as a binary-valued column vector. The output signal is the same data type as the input. The object iterates and provides updates to the log-likelihood ratios (LLR) of the uncoded output bits. The output of the object is the hard-decision output of the final LLR update.

When the constituent convolutional code represents a rate 1/N code, the object sets the length dec to (M-2✕NTails)/(2✕N-1). M is the input vector length, and NTails is given by log2(TrellisStructure.numStates)✕N. The length of dec equals the length of the interleaver indices.

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:


expand all

stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object


collapse all

Transmit turbo-encoded data over a binary phase-shift keying (BPSK) modulated additive white Guassian noise (AWGN) channel. Then, decode using an iterative turbo decoder and display errors.

Define a noise variable, establish a frame length of 256, and use the random stream so that the results are repeatable.

noiseVar = 4;
frmLen = 256;
s = RandStream('mt19937ar','Seed',11);
intrlvrIndices = randperm(s,frmLen);

Create a turbo encoder System object™ with these properties.

tEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4,[13 15 17],13), ...

Create a PSK Modulator System object.

modBPSK = comm.BPSKModulator;

Create an AWGN Channel System object.

channel = comm.AWGNChannel('NoiseMethod','Variance', ...

Create a GPU-based Turbo Decoder System object. The trellis structure for the constituent convolutional code is poly2trellis(4, [13 15 17], 13).

tDec = comm.gpu.TurboDecoder('TrellisStructure',poly2trellis(4,[13 15 17],13), ...
                             'InterleaverIndices',intrlvrIndices, ...

Create an error rate System object.

errorRate = comm.ErrorRate;

Run the simulation. Convert the received signal to log-likelihood ratios for decoding. Compare original the data to the received data and then calculate the error rate results.

for frmIdx = 1:10
    data = randi(s,[0 1],frmLen,1);
    encodedData = tEnc(data);
    modSignal = modBPSK(encodedData);
    receivedSignal = channel(modSignal);
    receivedBits  = tDec(-2/(noiseVar/2)*real(receivedSignal));
    errorStats = errorRate(data,receivedBits);

Display the number of errors.

fprintf('Error rate = %f\nNumber of errors = %d\nTotal bits = %d\n', ...
        errorStats(1), errorStats(2), errorStats(3));
Error rate = 0.000000
Number of errors = 0
Total bits = 2560

Extended Capabilities

Version History

Introduced in R2012a