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

조회 수: 3 (최근 30일)
Xiangbo Meng
Xiangbo Meng 2024년 5월 6일
댓글: Jaynik 2024년 5월 14일
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
Jaynik
Jaynik 2024년 5월 14일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 QPSK에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by