%% Deinterleave PDCCH Symbols
% Perform PDCCH resource element group (REG) deinterleaving. A vector of PDCCH symbols is first interleaved. The output is then deinterleaved and compared with the input vector. Note that instead of actual PDCCH symbols, a range of values from 1 to NRE are used to highlight the interleaved order.
% Create a cell-wide configuration structure initialized for RMC R.0. Instead of actual PDCCH symbols, a range of values from 1 to NRE are used to highlight the interleaved order. Interleave the PDCCH symbols, pdcchSym.

enb = lteRMCDL('R.0');
pdcchInfo = ltePDCCHInfo(enb);
pdcchSym = (1:pdcchInfo.NRE).';
startingSymbolOrder = pdcchSym(1:4)
interleavedSym = ltePDCCHInterleave(enb,pdcchSym);
interleavedSymbolOrder = interleavedSym(1:4)

%
% Deinterleave symbols and view the first four.

deinterleavedSym = ltePDCCHDeinterleave(enb,interleavedSym);
deinterleavedSymbolOrder = deinterleavedSym(1:4)

%
% Confirm deinterleaved symbol vector matches the input symbol vector.

isequal(pdcchSym,deinterleavedSym)

% Copyright 2012 The MathWorks, Inc.