This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Configure Eb/No for AWGN Channels with Coding

This example shows how to set the bit energy to noise density ratio (Eb/No) for communication links employing channel coding.

Specify the codeword and message length for a Reed-Solomon code. Specify the modulation order.

N = 15;       % R-S codeword length in symbols
K = 9;        % R-S message length in symbols
M = 16;       % Modulation order

Construct a (15,9) Reed-Solomon encoder and a 16-PSK modulator. Specify the objects so that they accept bit inputs.

rsEncoder = comm.RSEncoder('CodewordLength',N,'MessageLength',K, ...
pskModulator = comm.PSKModulator('ModulationOrder',M,'BitInput',true);

Create the corresponding Reed-Solomon decoder and 16-PSK demodulator objects.

rsDecoder = comm.RSDecoder('CodewordLength',N,'MessageLength',K, ...
pskDemodulator = comm.PSKDemodulator('ModulationOrder',M,'BitOutput',true);

Calculate the Reed-Solomon code rate based on the ratio of message symbols to the codeword length. Determine the bits per symbol for the PSK modulator.

codeRate = K/N;
bitsPerSymbol = log2(M);

Specify the uncoded Eb/No in dB. Convert the uncoded Eb/No to the corresponding coded Eb/No using the code rate.

UncodedEbNo = 6;
CodedEbNo = UncodedEbNo + 10*log10(codeRate);

Construct an AWGN channel taking into account the number of bits per symbol. Set the EbNo property of channel to the coded Eb/No.

channel = comm.AWGNChannel('BitsPerSymbol',bitsPerSymbol);
channel.EbNo = CodedEbNo;

Set the total number of errors and bits for the simulation. For accuracy, the simulation should run until a sufficient number of bit errors are encountered. The number of total bits is used to ensure that the simulation does not run too long.

totalErrors = 100;
totalBits = 1e6;

Construct an error rate calculator System object™ and initialize the error rate vector.

errorRate = comm.ErrorRate;
errorVec = zeros(3,1);

Run the simulation to determine the BER.

while errorVec(2) < totalErrors && errorVec(3) < totalBits
    % Generate random bits
    dataIn = randi([0,1],360,1);
    % Use the RS (15,9) encoder to add error correction capability
    dataEnc = rsEncoder(dataIn);
    % Apply 16-PSK modulation
    txSig = pskModulator(dataIn);
    % Pass the modulated data through the AWGN channel
    rxSig = channel(txSig);
    % Demodulate the received signal
    demodData = pskDemodulator(rxSig);
    % Decode the demodulated data with the RS (15,9) decoder
    dataOut = rsDecoder(demodData);
    % Collect error statistics
    errorVec = errorRate(dataIn,demodData);

Display the resultant bit error rate.

ber = errorVec(1)
ber =


Was this topic helpful?