Main Content


Decode input signal using turbo decoding with GPU

To use this object, you must install Parallel Computing Toolbox™ and have access to a supported GPU. If the host computer has a GPU configured, processing uses the GPU. Otherwise, processing uses the CPU. For more information 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 on 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.

To decode an input signal using a turbo decoding scheme:

  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.

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

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

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.

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: 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.

To decrease data transfer latency, format the input signal as a gpuArray (Parallel Computing Toolbox) object. For more information, see Array Processing with GPU-based System Objects.

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 blocks of BPSK-modulated data over a AWGN channel. Decode individual data frames by using a GPU-based turbo decoder System object and accumulate error statistics. Display the errors statistics after processing all of the data frames.

Specify the frame length. To produce repeatable results, use the random stream property with the seed set.

framelen = 256;
s = RandStream('mt19937ar',Seed=11);

Create a turbo encoder System object and GPU-based turbo decoder System object. Define the trellis structure for the constituent convolutional code by using the poly2trellis function. Generate the interleaver indices as a random column vector of unique integers that define the mapping used to permute the input bits at the encoder and decoder by using the randperm function.

intrlvrIndices = randperm(s,framelen);
trellis = poly2trellis(4,[13 15 17],13);
turboEnc = comm.TurboEncoder( ...
    TrellisStructure=trellis, ...
turboDec = comm.gpu.TurboDecoder( ...
    TrellisStructure=trellis, ...
    InterleaverIndices=intrlvrIndices, ...

Define the modulation order for BPSK modulation. Define the SNR level for the AWGN channel. Create an error rate System object to calculate error statistics. Run the simulation and calculate error results by comparing the original data to the received data.

M = 2;                      % BPSK modulation
snr = 2;                    % dB
numframes = 100;
errorRate = comm.ErrorRate;

for ii = 1:numframes
 data = randi(s,[0 1],framelen,1);
 encodedData = turboEnc(data);
 modSignal = pskmod(encodedData,M);
 rxsig = awgn(modSignal,2);
 demodsig = pskdemod(rxsig,M);
 rxbits = turboDec(demodsig);
 errorStats = errorRate(data,rxbits);
fprintf('BER = %f\nNumber of errors = %d\nTotal bits = %d\n', ...
BER = 0.001680
Number of errors = 43
Total bits = 25600

More About

expand all

Extended Capabilities

Version History

Introduced in R2012a