%% Synchronize and Demodulate Using PUCCH Format 2 DM-RS
% This example performs synchronization and uses the PUCCH format 2 DM-RS when demodulating a transmission that has been delayed by 5 samples.
% Initialize ue specific parameter structure, PUCCH2 structure, UL resource grid and txAck parameter.

ue.NULRB = 6;
ue.NCellID = 0;
ue.NSubframe = 0;
ue.Hopping = 'Off';
ue.CyclicPrefixUL = 'Normal';
ue.NTxAnts = 1;
pucch2.ResourceIdx = 0;
pucch2.ResourceSize = 0;
pucch2.CyclicShifts = 0;
rgrid = lteULResourceGrid(ue);
txAck = [1;1];
rgrid(ltePUCCH2DRSIndices(ue,pucch2)) = ltePUCCH2DRS(ue,pucch2,txAck);

%
% Generate modulated waveform and add a five sample delay.

waveform = lteSCFDMAModulate(ue,rgrid);
tx = [zeros(5,1);waveform];

%
% Use PUCCH format 2 DM-RS to estimate UL frame offset timing, then demodulate the waveform.

offset = lteULFrameOffsetPUCCH2(ue,pucch2,tx,length(txAck))
rxGrid = lteSCFDMADemodulate(ue,tx(1+offset:end));

% Copyright 2012 The MathWorks, Inc.