Are there some mistakes in the example of function ldpcDecode?

3 visualizzazioni (ultimi 30 giorni)
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

Risposte (1)

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

Categorie

Scopri di più su Interpolation of 2-D Selections in 3-D Grids in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by