estimate BER for LDPC 1/2 code
10 次查看(过去 30 天)
显示 更早的评论
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')
0 个评论
采纳的回答
Sriram Tadavarty
2020-3-19
编辑:Sriram Tadavarty
2020-3-19
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");
Hope this helps.
Regards,
Sriram
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 PHY Components 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!