%% Encode DCI Message on EPDCCH
% Use the DCI encoding function, lteDCIEncode, to code a DCI for transmission on EPDCCH. The required size is output by the lteEPDCCHIndices function and defined by info.EPDCCHG.
% Specify the cell-wide settings in parameter structure enb.

enb.NDLRB = 6;
enb.NSubframe = 0;
enb.NCellID = 0;
enb.CellRefP = 1;
enb.CyclicPrefix = 'Normal';
enb.DuplexMode = 'FDD';
enb.NFrame = 0;
enb.CSIRSPeriod = 'Off';
enb.ZeroPowerCSIRSPeriod = 'Off';

%
% Specify the channel transmission configuration in parameter structure chs.

chs.ControlChannelType = 'EPDCCH';
chs.SearchSpace = 'UESpecific';
chs.EnableCarrierIndication = 'Off';
chs.EnableMultipleCSIRequest = 'Off';
chs.EnableSRSRequest = 'Off';
chs.NTxAnts = 1;
chs.EPDCCHECCE = [2 3];
chs.EPDCCHType = 'Localized';
chs.EPDCCHPRBSet = 4:5;
chs.EPDCCHStart = 2;
chs.EPDCCHNID = 0;
chs.PDCCHFormat = 1;
chs.RNTI = 1;
dciInfo = lteDCIInfo(enb,chs);
dciin = zeros(dciInfo.Format1A,1);

%
% Determine the EPDCCH data bit capacity, output by lteEPDCCHIndices in info.EPDCCHG.

[ind,info] = lteEPDCCHIndices(enb,chs);
info

%
% Encode the DCI bits.

cw1 = lteDCIEncode(chs,dciin);
size(cw1)

%
% Encode the DCI bits again, setting the output length to info.EPDCCHG bits.

cw2 = lteDCIEncode(chs,dciin,info.EPDCCHG);
size(cw2)

% The output vector length for cw2 is 114, rather than the encoded format 1A length of 144 bits in cw1, as expected for the configuration.
% Copyright 2012 The MathWorks, Inc.