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 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 modulator, demodulator, AWGN channel, and error rate objects.

pskModulator = comm.PSKModulator('ModulationOrder',M,'BitInput',true);
pskDemodulator = comm.PSKDemodulator('ModulationOrder',M,'BitOutput',true);
awgnChannel = comm.AWGNChannel('BitsPerSymbol',bps);
errorRate = comm.ErrorRate;

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

rsEncoder = comm.RSEncoder('BitInput',true,'CodewordLength',N,'MessageLength',K);
rsDecoder = comm.RSDecoder('BitInput',true,'CodewordLength',N,'MessageLength',K);

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 main simulation loop processing includes encoding, modulation, demodulation, and decoding.

for i = 1:length(ebnoVec)
    awgnChannel.EbNo = ebnoVecCodingGain(i);
    while errorStats(i,2) < 100 && errorStats(i,3) < 1e7
        data = randi([0 1],1500,1);                % Generate binary data
        encData = rsEncoder(data);                 % RS encode
        modData = pskModulator(encData);           % Modulate
        rxSig = awgnChannel(modData);              % Pass signal through AWGN
        rxData = pskDemodulator(rxSig);            % Demodulate
        decData = rsDecoder(rxData);               % RS decode
        errorStats(i,:) = errorRate(data,decData); % Collect error statistics

Fit a curve to the BER data using berfit. Generate an estimate of QPSK performance with and without coding 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*', ...
xlabel('Eb/No (dB)')
legend('RS coded BER','Curve Fit','Theory with coding','Theory no coding')

Figure contains an axes. The axes contains 4 objects of type line. These objects represent RS coded BER, Curve Fit, Theory with coding, Theory no coding.