comm.APPDecoder seems not accepting "Terminated" as one of the "TerminationMethod"

2 views (last 30 days)
clear;clc;
frameLen = 10; % Payload length in bits
trellis = poly2trellis(5,[37,21],37); % Constraint Length 5, Generator Polynomial [37 21], feedback 37
conEnc = comm.ConvolutionalEncoder(trellis,"TerminationMethod","Terminated");
cAPPDec = comm.APPDecoder('TrellisStructure',trellis, 'TerminationMethod','Terminated', 'Algorithm','True APP');
snrdB = 0; % SNR
nVar = 10.^(-snrdB/10); % Noise variance
errorRate = comm.ErrorRate; % Calculates BER
msg = ones(frameLen,1);
% msg = randi([0 1],frameLen,1);
code = conEnc(msg);
modCode = qammod(code,2, ...
'InputType','bit', ...
'UnitAveragePower',true); % QPSK Modulation
receivedOut = awgn(modCode, snrdB);
demodOut = qamdemod(receivedOut,2, ...
'OutputType','llr', ...
'UnitAveragePower',true, ...
'NoiseVariance',nVar); % QPSK Demodulation
uncoded_ber = sum(abs(-sign(demodOut) - (2*code-1)))/2/length(code)
uncoded_ber = 0.1071
% BCJR(trellis,)
[decoded_soft, Lc_out] = step(cAPPDec, zeros(size(msg)),-demodOut);
Error using comm.APPDecoder/step
Dimension mismatch with input 2; expected [20,1], got [28,1].
decoded = (sign(decoded_soft)+1)/2;
errorStats = errorRate(msg,decoded);
fprintf('Error rate = %f\n',errorStats(1));
fprintf('Number of errors detected = %f\n',errorStats(2));
fprintf('Total bits compared = %f\n',errorStats(3));
Since the termination method is terminated, the error should no exist, it at least needs to expect some tail bits and thus not only expecting 20 elements. Why is it giving me this error?
  1 Comment
Jaynik
Jaynik on 14 May 2024
The issue is arising as the decoder is expecting a certain number of tail bits based on the trellis structure, but it seems to be receiving more than expected.
To resolve this, verify that the encoder adds the correct number of tail bits as anticipated by the decoder. You might need to adjust either the trellis structure or the frame length to ensure compatibility based on your application.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!