comm.TurboDecoder

Decode input signal using parallel concatenated decoding scheme

Description

The comm.TurboDecoder System object™ uses a parallel concatenated decoding scheme to decode a coded input signal. The input signal is typically the soft-decision output from the baseband demodulation operation. For more information, see Parallel Concatenated Convolutional Decoding Scheme.

To decode an input signal using a parallel concatenated decoding scheme:

  1. Create the comm.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?.

Creation

Description

turbodec = comm.TurboDecoder creates a turbo decoder System object. This object uses the a-posteriori probability (APP) constituent decoder to iteratively decode the parallel-concatenated convolutionally encoded input data.

example

turbodec = comm.TurboDecoder(trellis,interlvrindices,numiter) creates a turbo decoder System object with the TrellisStructure, InterleaverIndices, and numiter, respectively. The trellis input must be specified as described by the TrellisStructure property. The interlvrindices input must be specified as described by the InterleaverIndices property. The numiter input must be specified as described by the NumIterations property.

example

turbodec = comm.TurboDecoder(___,Name,Value) sets properties using one or more name-value pairs in addition to any input argument combination from previous syntaxes. Enclose each property name in quotes. For example, comm.TurboDecoder('InterleaverIndicesSource','Input port') configures a turbo decoder System object with the interleaver indices to be supplied as an input argument to the System object when it is called.

Properties

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 K/N code. K is the number of input bit streams, and N is the number of output bit streams.

Note

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' or 'Input port'.

  • When you set this property to 'Input port', the object executes using the input interleaver indices, interlvrindices, set when you call the object. The vector length and values for the interleaver indices and coded input signal can change with each call to the object.

  • When you set this property to 'Property', the object uses the interleaver indices that you specify for the InterleaverIndices property.

Data Types: char | string

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

Tunable: Yes

Dependencies

To enable this property, set the InterleaverIndicesSource property to 'Property'.

Data Types: double

Decoding algorithm, specified as 'True APP', 'Max*', or 'Max'. When you set this property to 'True APP', the object implements true APP decoding. When you set this property to 'Max*' or 'Max', the object uses approximations to increase the speed of the computations. For more information, see APP Decoder.

Data Types: char | string

Number of scaling bits, specified as an integer in the range [0, 8]. This property sets the number of bits the constituent decoders use to scale the input data to avoid losing precision during computations. The constituent decoders multiply the input by 2 NumScalingBits and divide the pre-output by the same factor. For more information, see APP Decoder.

Dependencies

This enable this property, set the Algorithm property to 'Max*'.

Data Types: double

Number of decoding iterations, specified as a positive integer. This property sets the number of decoding iterations used for each call to the object. 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.

Data Types: double

Usage

Description

example

decmsg = turbodec(codeword) decodes the input codeword using the parallel concatenated convolutional decoding scheme that is specified by the trellis structure and interleaver indices. turbodec returns the binary decoded data. For more information, see Parallel Concatenated Convolutional Decoding Scheme.

example

decmsg = turbodec(codeword,interlvrindices) additionally specifies the interleaver indices. To enable this syntax, set the InterleaverIndicesSource property to 'Input port'. The interleaver indices define the mapping used to permute the input at the decoder.

Input Arguments

expand all

Parallel concatenated codeword, specified as a column vector of length M, where M is the length of the parallel concatenated codeword.

Data Types: double | single

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

Dependencies

To enable this property, set the InterleaverIndicesSource property to 'Input port'.

Data Types: double

Output Arguments

expand all

Decoded message, returned as a binary column vector of length L, where L is the length of the decoded output message. This output signal is the same as data type of the codeword input.

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:

release(obj)

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

Examples

collapse all

Simulate the transmission and reception of BPSK data over an AWGN channel by using turbo encoding and decoding.

Specify simulation parameters, and then compute the effective coding rate and noise variance. For BPSK modulation, ES/N0 equals Eb/N0 because the number of bits per symbol (bps) is 1. To ease reuse of this code for other modulation schemes, calculations in this example include the bps terms. Define the packet length, trellis structure, and number of iterations. Calculate the noise variance using ES/N0 and the code rate. Set the random number generator to its default state to ensure that the results are repeatable.

modOrd = 2; % Modulation order
bps = log2(modOrd); % Bits per symbol
EbNo = 1; % Energy per bit to noise power spectral density ratio in dB
EsNo = EbNo + 10*log10(bps); % Energy per symbol to noise power spectral density ratio in dB

L = 256; % Input packet length in bits
trellis = poly2trellis(4,[13 15 17],13);
numiter = 4;
n = log2(trellis.numOutputSymbols);
numTails = log2(trellis.numStates)*n;
M = L*(2*n - 1) + 2*numTails; % Output codeword packet length
rate = L/M; % Coding rate

snrdB = EsNo + 10*log10(rate); % Signal to noise ratio in dB
noiseVar = 1./(10.^(snrdB/10)); % Noise variance

rng default

Generate random interleaver indices.

intrlvrIndices = randperm(L);

Create a turbo encoder and decoder pair. Use the defined trellis structure and random interleaver indices. Configure the decoder to run a maximum of four iterations.

turboenc = comm.TurboEncoder(trellis,intrlvrIndices);
turbodec = comm.TurboDecoder(trellis,intrlvrIndices,numiter);

Create a BPSK modulator and demodulator pair, where the demodulator outputs soft bits determined using an LLR method.

bpskmod = comm.BPSKModulator;
bpskdemod = comm.BPSKDemodulator('DecisionMethod','Log-likelihood ratio', ...
    'Variance',noiseVar);

Create an AWGN channel object and an error rate object.

awgnchan = comm.AWGNChannel('NoiseMethod','Variance','Variance',noiseVar);
errrate = comm.ErrorRate;

The main processing loop performs these steps.

  1. Generate binary data.

  2. Turbo encode the data.

  3. Modulate the encoded data.

  4. Pass the modulated signal through an AWGN channel.

  5. Demodulate the noisy signal by using LLR to output soft bits.

  6. Turbo decode the demodulated data. Because the bit mapping from the demodulator is opposite of the mapping expected by the turbo decoder, the decoder input must use the inverse of the demodulated signal.

  7. Calculate the error statistics.

for frmIdx = 1:100
    data = randi([0 1],L,1);
    encodedData = turboenc(data);
    modSignal = bpskmod(encodedData);
    receivedSignal = awgnchan(modSignal);
    demodSignal = bpskdemod(receivedSignal);
    receivedBits = turbodec(-demodSignal);
    errorStats = errrate(data,receivedBits);
end

Display the error data.

fprintf('Bit error rate = %5.2e\nNumber of errors = %d\nTotal bits = %d\n', errorStats)
Bit error rate = 2.34e-04
Number of errors = 6
Total bits = 25600

Simulate an end-to-end communication link by using a 16-QAM signal and turbo codes in an AWGN channel. Inside a frame processing loop, packet sizes are randomly selected to be 500, 1000, or 1500 bits. Because the packet size varies, the interleaver indices are provided to the turbo encoder and decoder as an input argument of their associated System object.

Set the modulation order and Eb/N0. Compute the number of bits per symbol and the energy per symbol to noise ratio (ES/N0) based on the modulation order and Eb/N0. To get repeatable results, set the random number generator to its default state.

modOrder = 16;
bps = log2(modOrder); % Bits per symbol
EbNo = 2.8; % Energy per bit to noise power spectral density ratio in dB
EsNo = EbNo + 10*log10(bps); % Energy per symbol to noise power spectral density ratio in dB
rng default

Create a turbo encoder and decoder pair. Because the packet length varies for each frame, specify that the interleaver indices be supplied by an input argument of the System object when executed. Specify that the decoder perform four iterations.

turboEnc = comm.TurboEncoder('InterleaverIndicesSource','Input port');
turboDec = comm.TurboDecoder('InterleaverIndicesSource','Input port','NumIterations',4);
trellis = poly2trellis(4,[13 15 17],13);
n = log2(turboEnc.TrellisStructure.numOutputSymbols);
numTails = log2(turboEnc.TrellisStructure.numStates)*n;

Create an error rate object.

errRate = comm.ErrorRate;

The frame processing loop performs these steps.

  1. Select a random packet length, and generate random binary data.

  2. Compute the output codeword length and coding rate.

  3. Compute the signal to noise ratio (SNR) and noise variance.

  4. Generate interleaver indices.

  5. Turbo encode the data.

  6. Apply 16-QAM modulation, and normalize the average signal power.

  7. Pass the modulated signal through an AWGN channel.

  8. Demodulate the noisy signal by using an LLR method, output soft bits, and normalize the average signal power.

  9. Turbo decode the data. Because the bit mapping order from the demodulator is opposite the mapping order expected by the turbo decoder, the decoder input must use the inverse of the demodulated signal.

  10. Calculate the error statistics.

numFrames = 100;
for pktIdx = 1:numFrames
    L = 500*randi([1 3],1,1); % Packet length in bits
    data = randi([0 1],L,1);

    M = L*(2*n - 1) + 2*numTails; % Output codeword packet length
    rate = L/M; % Coding rate for current packet
    snrdB = EsNo + 10*log10(rate); % Signal to noise ratio in dB
    noiseVar = 1./(10.^(snrdB/10)); % Noise variance
    
    intrlvrIndices = randperm(L);
    encodedData = turboEnc(data,intrlvrIndices);
    modSignal = qammod(encodedData,modOrder,'InputType','bit','UnitAveragePower',true);
    receivedSignal = awgn(modSignal,snrdB);
    demodSignal = qamdemod(receivedSignal,modOrder,'OutputType','llr', ...
        'UnitAveragePower',true,'NoiseVariance',noiseVar);
    receivedBits = turboDec(-demodSignal,intrlvrIndices); % Demodulated signal is negated
    
    errorStats = errRate(data,receivedBits);
end

Display the error data.

fprintf('Bit error rate = %5.2e\nNumber of errors = %d\nTotal bits = %d\n',errorStats)
Bit error rate = 8.51e-04
Number of errors = 80
Total bits = 94000

More About

expand all

References

[1] Benedetto, S., G. Montorsi, D. Divsalar, and F. Pollara. "A Soft-Input Soft-Output Maximum A Posterior (MAP) Module to Decode Parallel and Serial Concatenated Codes." Jet Propulsion Lab TDA Progress Report, 42–127, (November 1996).

[2] Viterbi, A.J. “An Intuitive Justification and a Simplified Implementation of the MAP Decoder for Convolutional Codes.” IEEE Journal on Selected Areas in Communications 16, no. 2 (February 1998): 260–64. https://doi.org/10.1109/49.661114.

[3] Berrou, C., A. Glavieux, and P. Thitimajshima. “Near Shannon Limit Error-Correcting Coding and Decoding: Turbo-Codes.” Proceedings of ICC 93 - IEEE International Conference on Communications, Geneva, Switzerland, May 1993, 1064–70. https://doi.org/10.1109/icc.1993.397441.

[4] Schlegel, Christian, and Lance Perez. Trellis and Turbo Coding. IEEE Press Series on Digital & Mobile Communication. Piscataway, NJ ; Hoboken, NJ: IEEE Press ; Wiley-Interscience, 2004.

[5] 3GPP TS 36.212. "Multiplexing and channel coding." 3rd Generation Partnership Project; Technical Specification Group Radio Access Network; Evolved Universal Terrestrial Radio Access (E-UTRA). https://www.3gpp.org.

Extended Capabilities

Introduced in R2012a