Are there some mistakes in the example of function ldpcDecode?
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Santosh Fatale
2022-4-7
Hi Ping,
I have brought this issue to the notice of concerned persons. They will investigate the matter further.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Error Detection and Correction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!