comm.TurboEncoder System object

Package: comm

Encode input signal using parallel concatenated encoding scheme

Description

The Turbo Encoder System object™ encodes a binary input signal using a parallel concatenated coding scheme. This coding scheme uses two identical convolutional encoders and appends the termination bits at the end of the encoded data bits.

To encode an input signal using a turbo coding scheme:

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

  2. Call step to encode a binary signal according to the properties of comm.TurboEncoder. The behavior of step is specific to each object in the toolbox.

Construction

H = comm.TurboEncoder creates a System object, H, that encodes binary data using a turbo encoder.

H = comm.TurboEncoder(Name, Value) creates a turbo encoder object, H, with the specified property name set to the specified value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.

H = comm.TurboEncoder(TRELLIS, INTERLVRINDICES) creates a turbo encoder object, H. In this construction, the TrellisStructure property is set to TRELLIS, and the InterleaverIndices property is set to INTERLVRINDICES.

Properties

TrellisStructure

Trellis structure of constituent convolutional code

Specify the trellis as a MATLAB structure that contains the trellis description of the constituent convolutional code. Use the istrellis function to check if a structure is a valid trellis structure. The default is the result of poly2trellis(4, [13 15], 13).

InterleaverIndicesSource

Source of interleaver indices

Specify the source of the interleaver indices as one of Property | Input port. When you set this property to Input port, the object uses the interleaver indices specified as an input to the step method. When you set this property to Property, the object uses the interleaver indices that you specify in the InterleaverIndices property. When you set this property to Input port, the object processes variable-size signals.

Default: Property

InterleaverIndices

Interleaver indices

Specify the mapping used to permute the input bits at the encoder as a column vector of integers. This mapping is a vector with the number of elements equal to the length of the input for the step method. Each element must be an integer between 1 and L, with no repeated values.

Default: (64:-1:1).'.

Methods

cloneCreate Turbo Encoder object with same property values
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepEncode input signal using parallel concatenated coding scheme

Examples

expand all

Transmit and Receive Turbo-Encoded Data over a BPSK-Modulated AWGN Channel

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

Set the Eb/No (dB) and frame length parameters. Set the random number generator to its default state to ensure that the results are repeatable.

EbNo= -6;
frmLen = 256;
rng default

Calculate the noise variance from the Eb/No ratio. Generate random interleaver indices.

noiseVar = 10^(-EbNo/10);
intrlvrIndices = randperm(frmLen);

Create a turbo encoder and decoder pair using the trellis structure given by poly2trellis(4,[13 15 17],13) and intrlvrIndices.

hTEnc = comm.TurboEncoder('TrellisStructure',poly2trellis(4, ...
    [13 15 17],13),'InterleaverIndices',intrlvrIndices);

hTDec = comm.TurboDecoder('TrellisStructure',poly2trellis(4, ...
    [13 15 17],13),'InterleaverIndices',intrlvrIndices, ...
    'NumIterations',4);

Create a BPSK modulator and demodulator pair, where the demodulator outputs soft bits determined by using a log-likelihood ratio method.

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

Create an AWGN channel object and an error rate object.

hChan = comm.AWGNChannel('EbNo',EbNo);
hError = comm.ErrorRate;

The main processing loop performs the following steps:

  • Generate binary data

  • Turbo encode the data

  • Modulate the encoded data

  • Pass the modulated signal through an AWGN channel

  • Demodulate the noisy signal using LLR to output soft bits

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

  • Calculate the error statistics

for frmIdx = 1:100
    data = randi([0 1],frmLen,1);
    encodedData = step(hTEnc,data);
    modSignal = step(hMod,encodedData);
    receivedSignal = step(hChan,modSignal);
    demodSignal = step(hDemod,receivedSignal);
    receivedBits = step(hTDec,-demodSignal);
    errorStats = step(hError,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

Turbo Coding with 16-QAM Modulation in an AWGN Channel

Simulate an end-to-end communication link employing 16-QAM using turbo codes in an AWGN channel. The frame sizes are randomly selected from a set of {500, 1000, 1500}. Because the frame size varies, provide the interleaver indices to the turbo encoder and decoder objects as an input to their associated step functions.

Set the modulation order and Eb/No (dB) parameters. Set the random number generator to its default state to be able to repeat the results.

M = 16;
EbNo= -2;
rng default

Calculate the noise variance from the Eb/No ratio and the modulation order.

noiseVar = 10^(-EbNo/10)*(1/log2(M));

Create a turbo encoder and decoder pair, where the interleaver indices are supplied by an input argument to the step function.

hTEnc = comm.TurboEncoder('InterleaverIndicesSource','Input port');

hTDec = comm.TurboDecoder('InterleaverIndicesSource','Input port', ...
    'NumIterations',4);

Create a QPSK modulator and demodulator pair, where the demodulator outputs soft bits determined by using a log-likelihood ratio method. The modulator and demodulator objects are normalized to use an average power of 1 W.

hMod = comm.RectangularQAMModulator('ModulationOrder',M, ...
    'BitInput',true, ...
    'NormalizationMethod','Average power');
hDemod = comm.RectangularQAMDemodulator('ModulationOrder',M, ...
    'BitOutput',true, ...
    'NormalizationMethod','Average power', ...
    'DecisionMethod','Log-likelihood ratio', ...
    'Variance',noiseVar);

Create an AWGN channel object and an error rate object.

hChan = comm.AWGNChannel('EbNo',EbNo,'BitsPerSymbol',log2(M));
hError = comm.ErrorRate;

The processing loop performs the following steps:

  • Select a random frame size and generate interleaver indices

  • Generate random binary data

  • Turbo encode the data

  • Apply 16-QAM modulation

  • Pass the modulated signal through an AWGN channel

  • Demodulate the noisy signal using an LLR algorithm

  • Turbo decode the data

  • Calculate the error statistics

for frmIdx = 1:100

    % Randomly select one of three possible frame sizes
    frmLen = 500*randi([1 3],1,1);

    % Determine the interleaver indices given the frame length
    intrlvrIndices = randperm(frmLen);

    % Generate random binary data
    data = randi([0 1],frmLen,1);

    % Turbo encode the data
    encodedData = step(hTEnc,data,intrlvrIndices);

    % Modulate the encoded data
    modSignal = step(hMod,encodedData);

    % Pass the signal through the AWGN channel
    receivedSignal = step(hChan,modSignal);

    % Demodulate the received signal
    demodSignal = step(hDemod,receivedSignal);

    % Turbo decode the demodulated signal. Because the bit mapping from the
    % demodulator is opposite that expected by the turbo decoder, the
    % decoder input must use the inverse of demodulated signal.
    receivedBits = step(hTDec,-demodSignal,intrlvrIndices);

    % Calculate the error statistics
    errorStats = step(hError,data,receivedBits);
end

Display the error statistics.

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

Algorithms

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

Was this topic helpful?