Are there some mistakes in the example of function ldpcDecode?

조회 수: 1 (최근 30일)
Ping Chun Hu
Ping Chun Hu 2022년 3월 22일
답변: Santosh Fatale 2022년 4월 7일
Recently, I use the function ldpcDecode to test my LDPC code.
When I run the MATLAB example, the answer is a little bit tricky.
Here is the command.
openExample('comm/DecodeRate34LDPCCodewordsExample')
I append another snr value into the array, like:
snr = [20 6 3 20];
The output would be like:
SNR = 20
Coded: Error rate = 0.00, Number of errors = 0
Noncoded: Error rate = 0.00, Number of errors = 0
SNR = 6
Coded: Error rate = 0.00, Number of errors = 0
Noncoded: Error rate = 0.02, Number of errors = 221
SNR = 3
Coded: Error rate = 0.02, Number of errors = 301
Noncoded: Error rate = 0.07, Number of errors = 956
SNR = 20
Coded: Error rate = 0.02, Number of errors = 301
Noncoded: Error rate = 0.05, Number of errors = 956
The second snr=20 case shows that the error statistics of each case have accumulated.
I thought that the reset of error statistics is required.
Is it appropriate to advise the example like this:
M = 4;
maxnumiter = 10;
snr = [20 6 3 20];
numframes = 10;
qpskmod = comm.PSKModulator(M,'BitInput',true);
qpskmod2 = comm.PSKModulator(M);
ber = comm.ErrorRate;
ber2 = comm.ErrorRate;
for ii = 1:length(snr)
qpskdemod = comm.PSKDemodulator(M,'BitOutput',true, ...
'DecisionMethod','Approximate log-likelihood ratio', ...
'Variance',1/10^(snr(ii)/10));
qpskdemod2 = comm.PSKDemodulator(M);
for counter = 1:numframes
data = randi([0 1],cfgLDPCEnc.NumInformationBits,1,'int8');
% Transmit and receive with LDPC coding
encodedData = ldpcEncode(data,cfgLDPCEnc);
modSignal = qpskmod(encodedData);
receivedSignal = awgn(modSignal,snr(ii));
demodSignal = qpskdemod(receivedSignal);
receivedBits = ldpcDecode(demodSignal,cfgLDPCDec,maxnumiter);
errStats = ber(data,receivedBits);
% Transmit and receive with no LDPC coding
noCoding = qpskmod2(data);
rxNoCoding = awgn(noCoding,snr(ii));
rxBitsNoCoding = qpskdemod2(rxNoCoding);
errStatsNoCoding = ber2(data,int8(rxBitsNoCoding));
end
fprintf(['SNR = %2d\n Coded: Error rate = %1.2f, ' ...
'Number of errors = %d\n'], ...
snr(ii),errStats(1),errStats(2))
fprintf(['Noncoded: Error rate = %1.2f, ' ...
'Number of errors = %d\n'], ...
errStatsNoCoding(1),errStatsNoCoding(2))
reset(ber)
reset(ber2)
end
We can get the repeatable output.
SNR = 20
Coded: Error rate = 0.00, Number of errors = 0
Noncoded: Error rate = 0.00, Number of errors = 0
SNR = 6
Coded: Error rate = 0.00, Number of errors = 0
Noncoded: Error rate = 0.02, Number of errors = 221
SNR = 3
Coded: Error rate = 0.02, Number of errors = 301
Noncoded: Error rate = 0.07, Number of errors = 956
SNR = 20
Coded: Error rate = 0.00, Number of errors = 0
Noncoded: Error rate = 0.00, Number of errors = 0

답변 (1개)

Santosh Fatale
Santosh Fatale 2022년 4월 7일
Hi Ping,
I have brought this issue to the notice of concerned persons. They will investigate the matter further.

카테고리

Help CenterFile Exchange에서 Error Detection and Correction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by