%% Decode PUCCH Format 2 Signal
% Decode a PUCCH format 2 signal from an equalized resource array, grid.
% First, create a UE configuration structure, ue, and a PUCCH configuration structure, pucch2.

ue = struct('NULRB',6,'NCellID',0,'NSubframe',0,'RNTI',1);
pucch2 = struct('ResourceIdx',0);

%
% For the transmitter, create a PUCCH format 2 resource grid.

rgrid = lteULResourceGrid(ue);
pucch2Indices = ltePUCCH2Indices(ue,pucch2);
tx = [1;0;0;0;0;1];
encoded = lteUCIEncode(tx);
rgrid(pucch2Indices) = ltePUCCH2(ue,pucch2,encoded);

%
% On the receiver side, decode the PUCCH format 2 signal contained in equalized resource array, grid. Also decode the UCI bits.

rx = ltePUCCH2Decode(ue,pucch2,rgrid(pucch2Indices));
decoded = lteUCIDecode(rx,length(tx))

% Copyright 2012 The MathWorks, Inc.