estimate BER for LDPC 1/2 code

10 views (last 30 days)
I try to find the ber for LDPC code but I the result it seems wrong. pls help!!
EbNoVec = (-1:0.5:11 )'; % Eb/No values (dB)
berEst = zeros(size(EbNoVec));
bpskModulator = comm.BPSKModulator;
bpskDEModulator = comm.BPSKDemodulator;
p = dvbs2ldpc(1/2);
ldpcEncoder = comm.LDPCEncoder(p);
ldpcDecoder = comm.LDPCDecoder(p);
msg = logical(randi([0 1],size(p,2)-size(p,1),1));
for n = 1:length(EbNoVec)
% Reset the error and bit counters
numErrs = 0;
numBits = 0;
while numErrs < 1000 && numBits < 1e6
% Transmit and receive LDPC coded signal data
encData = ldpcEncoder(msg);
%channel
dataMod_psk = bpskModulator(encData);
% Pass through AWGN channel
channel = comm.AWGNChannel('EbNo',EbNoVec(n),'BitsPerSymbol',1);
dataMod_psk2=channel(dataMod_psk);
dataDeMod_psk3=bpskDEModulator(dataMod_psk2);
rxBits = ldpcDecoder(dataDeMod_psk3);
MSG=rxBits;
chk = isequal(msg,MSG);
% Calculate the number of bit errors
nErrors = biterr(msg,MSG);
% Increment the error and bit counters
numErrs = numErrs + nErrors;
numBits = numBits + length(msg);
end
% Estimate the BER
berEst(n) = numErrs/numBits;
end
berTheory = berawgn(EbNoVec,'psk',2,'nondiff');
semilogy(EbNoVec,berEst,'-.')
grid
legend('Estimated BER ldpc')
xlabel('Eb/No (dB)')
ylabel('Bit Error Rate')

Accepted Answer

Sriram Tadavarty
Sriram Tadavarty on 19 Mar 2020
Edited: Sriram Tadavarty on 19 Mar 2020
Hi Pertesis,
The issue you observe is due to the usage of comm.BPSKDemodulator with hard decision (which is the default) in conjunction with the LDPC decoder. Note that LDPC decoder expects the input to be the LLR's, but due to the hard decision from the BPSK demodulation, the output is bits from it. This is provided to LDPC decoder and it just wasn't able to decode any of it properly. I suggest you to make the following update to the BPSK demodulator and place the EbNoVec range from -11:0.1:2 to see the free falling curve.
bpskDEModulator = comm.BPSKDemodulator('DecisionMethod',"Log-likelihood ratio");
More details of the usage of LDPC decoder and BPSK demod can be accessed with the links.
Hope this helps.
Regards,
Sriram
  1 Comment
pertesis aris
pertesis aris on 29 Mar 2020
ok thnx for the help. I would like to ask who can I use comm.LDPCEncoder for 16384 bits length?

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!