This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Estimate Turbo Code BER Performance in AWGN

Simulate an end-to-end communication link employing 16-QAM using turbo codes in an AWGN channel. Estimate the bit error rate.

Initialize Simulation

Set the modulation order and the range of Eb/No values to evaluate. Set the frame length to 500.

rng(10,'twister');
M = 16;
bps = log2(M); % bits per symbol
EbNo = (2:0.5:4);
frmLen = 500;

Initialize the bit error rate vector.

ber = zeros(size(EbNo));

Create a turbo encoder and decoder pair, where the interleaver indices are supplied as input arguments.

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

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

Create a QAM 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.

qamModulator = comm.RectangularQAMModulator('ModulationOrder',M, ...
    'BitInput',true, ...
    'NormalizationMethod','Average power');

qamDemodulator = comm.RectangularQAMDemodulator('ModulationOrder',M, ...
    'BitOutput',true, ...
    'NormalizationMethod','Average power', ...
    'DecisionMethod','Log-likelihood ratio', ...
    'VarianceSource','Input port');

Create an AWGN channel and an error rate counter.

awgnChannel = comm.AWGNChannel('NoiseMethod','Variance','Variance',1);
errorRate = comm.ErrorRate;

Use the frame length and turbo encoder settings to determine actual transmitted bit rate. The turbo-coding objects are initialized to use rate-1/2 trellis for their constituent convolutional codes, resulting in a turbo encoder output with 2 parity bit streams, (in addition to the systematic stream) and 12 tail bits for the input frame. The 12 tail bits are due to the specified constraint length of 4 per constituent encoder, which leads to 3-bit outputs per stream, for a total of 4 streams (S1 P1 S2 P2).

    rate = frmLen/(3*frmLen+4*3);

Main Processing Loop

The processing loop performs the following steps:

  • Generate random binary data

  • Generate random interleaver indices

  • 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 k = 1:length(EbNo)
    
    % Initialize error statistics vector, signal-to-noise ratio, and noise variance
    errorStats = zeros(1,3);

    EsNo = EbNo(k) + 10*log10(bps);       
    snrdB = EsNo + 10*log10(rate);      % in dB
    noiseVar = 1./(10.^(snrdB/10)); 

    awgnChannel.Variance = noiseVar;

    while errorStats(2) < 100 && errorStats(3) < 1e7

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

        % Interleaver indices
        intrlvrInd = randperm(frmLen);

        % Turbo encode the data
        encodedData = turboEnc(data,intrlvrInd);

        % Modulate the encoded data
        modSignal = qamModulator(encodedData);

        % Pass the signal through the AWGN channel
        receivedSignal = awgnChannel(modSignal);

        % Demodulate the received signal
        demodSignal = qamDemodulator(receivedSignal,noiseVar);

        % 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 = turboDec(-demodSignal,intrlvrInd);

        % Calculate the error statistics
        errorStats = errorRate(data,receivedBits);
    end
    
    % Save the BER data and reset the bit error rate object
    ber(k) = errorStats(1);
    reset(errorRate)
end

Plot the bit error rate and compare it to the uncoded bit error rate.

semilogy(EbNo,ber,'-o')
grid
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')
uncodedBER = berawgn(EbNo,'qam',M);     % Estimate of uncoded BER
hold on
semilogy(EbNo,uncodedBER)
legend('Turbo','Uncoded','location','sw')

See Also

|