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

enb.NNCellID = 0;
enb.NBRefP = 1;
chs.NRep = 10;

% Set the output codeword length to 320 and generate the codeword bits. Specify the encoder and decoder state as empty at the start of the bundle.

cwLen = 320;
cw = ones(cwLen,1); % Codeword bits
estate = []; 
dstate = []; 

% Generate the NPDCCH symbols for each of the 10 subframes and then decode them.

for nsf = 0:chs.NRep-1
       enb.NSubframe = nsf;
       [sym,estate] = lteNPDCCH(enb,chs,cw,estate);
       [rxcw,dstate] = lteNPDCCHDecode(enb,chs,sym,dstate);
end

% The value of the field CWSFCount in structure dstate indicates that NPDCCH subframe has been received ten times.

dstate.EndOfTx
dstate.CWSFCount

% Copyright 2019 The MathWorks, Inc.