Main Content

Estimate BER of QPSK in AWGN with Reed-Solomon Coding

Transmit Reed-Solomon encoded data using QPSK over an AWGN channel. Demodulate and decode the received signal and collect error statistics. Compute the theoretical bit error rate (BER) for coded and noncoded data. Plot the BER results to compare performance.

Define the example parameters.

rng(1993);     % Seed random number generator for repeatable results
M = 4;         % Modulation order
bps = log2(M); % Bits per symbol
N = 7;         % RS codeword length
K = 5;         % RS message length

Create AWGN channel and error rate objects.

awgnChannel = comm.AWGNChannel( ...
errorRate = comm.ErrorRate;

Create a (7,5) Reed-Solomon encoder and decoder pair that accepts bit inputs.

rsEncoder = comm.RSEncoder( ...
    BitInput=true, ...
    CodewordLength=N, ...
rsDecoder = comm.RSDecoder( ...
    BitInput=true, ...
    CodewordLength=N, ...

Set the range of Eb/N0 values and account for RS coding gain. Initialize the error statistics matrix.

ebnoVec = (3:0.5:8)';
ebnoVecCodingGain = ...
    ebnoVec + 10*log10(K/N); % Account for RS coding gain
errorStats = zeros(length(ebnoVec),3);

Estimate the bit error rate for each Eb/N0 value. The simulation runs until either 100 errors or 107 bits is encountered. The simulation loop encodes and modulates random data, filters the signal through an AWGN channel, demodulate and decodes the signal, and then computes error statistics.

for i = 1:length(ebnoVec)
    awgnChannel.EbNo = ebnoVecCodingGain(i);
    while errorStats(i,2) < 100 && errorStats(i,3) < 1e7
        data = randi([0 1],1500,1);
        encData = rsEncoder(data);
        modData = pskmod(encData,M,InputType='bit');
        rxSig = awgnChannel(modData);
        rxData = pskdemod(rxSig,M,OutputType='bit');
        decData = rsDecoder(rxData);
        errorStats(i,:) = errorRate(data,decData);

Fit a curve to the BER data using berfit. Generate an estimate of QPSK performance with and without coding by using the bercoding and berawgn functions.

berCurveFit = berfit(ebnoVecCodingGain,errorStats(:,1));
berwCoding = bercoding(ebnoVec,'RS','hard',N,K,'psk',M,'nondiff');
berNoCoding = berawgn(ebnoVec,'psk',M,'nondiff');

Plot the RS-coded BER data, curve fit of the BER data, theoretical performance with RS coding, and theoretical performance without RS coding. The (7,5) RS code improves the Eb/N0 required to achieve a 10-2 bit error rate by approximately 1.2 dB.

semilogy(ebnoVecCodingGain,errorStats(:,1),'b*', ...
    ebnoVecCodingGain,berCurveFit,'c-', ...
    ebnoVecCodingGain,berwCoding,'r', ...
xlabel('Eb/No (dB)')
legend( ...
    'RS-coded BER','Curve fit', ...
    'Theory with coding','Theory no coding')