%% Get PDCCH Search Space Candidates
% Find and use PDCCH search space candidates.
% To illustrate the search space structuring of the PDCCH, set up a cell wide parameter structure, enb, with the following field values.

enb.NDLRB = 50;
enb.CFI = 2;
enb.CellRefP = 2;
enb.Ng = 'Sixth';
enb.NSubframe = 0;

%
% This configuration defines a control region with the following information.

resInfo = ltePDCCHInfo(enb)

%
% The entire data block of padded, multiplexed PDCCHs needs to be 1920 bits, resInfo.MTot, in length. Using -1 to represent NIL padding "bits", create an "empty" multiplex.

pdcchs = -1*ones(1,resInfo.MTot);

%
% Suppose you want to transmit all zeros in the first candidate of the UE-specific search space for PDCCH format 2 and the UE's RNTI = 1. For this format, a PDCCH spans 4 CCE or 288 bits, and the UE-specific search space contains two PDCCH candidates.

candidates = ltePDCCHSpace(enb,struct('PDCCHFormat',2,'RNTI',1))

%
% These location values arise for enb.NSubframe = 0. They change in a pseudorandom fashion as the subframe number increases. Since the default candidate indices define inclusive, 1-based bounds, we can use them to index the PDCCH data multiplex directly by using the MATLAB® colon operator.

pdcchs(candidates(1,1):candidates(1,2)) = 0;

% This command sets the 288 bits of the first PDCCH candidate to all zeros. The second candidate actually falls within the common search space also.
% Copyright 2012 The MathWorks, Inc.