%% Decode UL-SCH
% Generate and decode 2 transmissions (RV=0 then RV=2) as part of a single codeword HARQ process for the A3-3 FRC.
% Initialize one subframe of an FRC A3-3 transmission. Create a codeword with RV = 0. Turn logical bits into 'LLR' data. Initialize the decoder states for the first HARQ transmission. The returned decState contains the decoder buffer state for each transport block for an active HARQ process.

nsf = 1;
frc = lteRMCUL('A3-3');
trBlkLen = frc.PUSCH.TrBlkSizes(nsf);
trBlkData = randi([0,1],trBlkLen,1);

%

frc.PUSCH.RV = 0;
cw = lteULSCH(frc,frc.PUSCH,trBlkData);

%

cw(cw == 0) = -1;

%

decState = [];
[rxTrBlk,~,decState] = lteULSCHDecode(frc,frc.PUSCH,trBlkLen,cw,decState);

% Create a second retransmitted codeword with RV = 2. Turn logical bits into 'LLR' data. The previous transmission decoder buffer state, decState, is used as part of the sequence of active HARQ transmissions.
%

frc.PUSCH.RV = 2;
cWord = lteULSCH(frc,frc.PUSCH,trBlkData);

%

cWord(cWord == 0) = -1;

%

rxTrBlk = lteULSCHDecode(frc,frc.PUSCH,trBlkLen,cWord,decState);

% Copyright 2012 The MathWorks, Inc.