%% Generate and Receive NPDSCH Symbols
% Generate and receive the NPDSCH symbols subframe by subframe for a bundle of 12 subframes.
%
% Specify the cell-wide settings and channel transmission configuration in parameter structures enb and chs.

enb.NNCellID = 0;
enb.NBRefP = 1;
enb.NFrame = 1;
chs.NSF = 3;
chs.NRep = 4;
chs.RNTI = 0;
chs.NPDSCHDataType = 'NotBCCH';

%
% Set the output codeword length to 960 and generate the codeword bits. Do not provide the encoder or decoder states at the start of the bundle.

cwLen = 960;
eState = [];
statein = [];
txcw = ones(cwLen,1);

%
% Generate the NPDSCH symbols for each of the 12 subframes and then decode them.

for subframeIdx = 0:(chs.NSF*chs.NRep-1)
    enb.NSubframe = subframeIdx;
    [sym,eState] = lteNPDSCH(enb,chs,txcw,eState);
    [cw,stateout] = lteNPDSCHDecode(enb,chs,sym,statein);
    statein = stateout;
end

%
% The value of the field CWSFCount in structure dstate indicates that all three subframes in the codeword have been received four times.

disp(stateout.EndOfTx)
disp(stateout.CWSFCount)

% Copyright 2012 The MathWorks, Inc.