Estimate LDPC Performance in AWGN

Transmit an LDPC-encoded, QPSK-modulated bit stream through an AWGN channel. Then demodulate, decode, and count errors.

Create an LDPC encoder and decoder pair.

ldpcEnc = comm.LDPCEncoder;
ldpcDec = comm.LDPCDecoder;

Create a QPSK modulator, a QPSK demodulator, and an Error Rate detector.

qpskMod = comm.QPSKModulator('BitInput',true);
qpskDemod = comm.QPSKDemodulator('BitOutput',true,...
    'DecisionMethod','Approximate log-likelihood ratio', ...
    'VarianceSource','Input port');
errorCnt = comm.ErrorRate;

Create a vector of SNR values to evaluate. Initialize the bit error rate vector.

snrVec = [0 0.2 0.4 0.6 0.65 0.7 0.75 0.8];
ber = zeros(length(snrVec),1);

Encode, modulate, and transmit 32400-bit frames of binary data through an AWGN channel. Then, demodulate, decode, and estimate the bit error rate.

for k = 1:length(snrVec)
    noiseVar = 1/10^(snrVec(k)/10);
    errorStats = zeros(1,3);
    while errorStats(2) <= 200 && errorStats(3) < 5e6
        data = logical(randi([0 1],32400,1));   % Generate binary data
        encData = ldpcEnc(data);                % Apply LDPC encoding
        modSig = qpskMod(encData);              % Modulate
        rxSig = awgn(modSig,snrVec(k));         % Pass through AWGN channel
        demodSig = qpskDemod(rxSig,noiseVar);   % Demodulate
        rxData = ldpcDec(demodSig);             % Decode LDPC
        errorStats = errorCnt(data,rxData);     % Compute error stats
    % Save the BER for the current Eb/No and reset the error rate counter
    ber(k) = errorStats(1);

Plot the bit error rate.

xlabel('SNR (dB)')
ylabel('Bit Error Rate')