%% Generate PUCCH Format 2 DM-RS Using Virtual Cell ID
% Demonstrate Uplink Release 11 coordinated multipoint (CoMP) operation. Intercell interference can be avoided by using a virtual cell identity for a potentially interfering UE in a neighboring cell.
% Configuration for UE of interest, UE 1 in cell 1.

ue1.NCellID = 1;
ue1.NSubframe = 0;
ue1.CyclicPrefixUL = 'Normal';
ue1.Hopping = 'Off';

chs1.ResourceIdx = 0;
chs1.ResourceSize = 0;
chs1.CyclicShifts = 0;

ack1 = 0;

%
% Configuration for interferer, UE 2 in cell 2.

ue2.NCellID = 2;
ue2.NSubframe = 0;
ue2.CyclicPrefixUL = 'Normal';
ue2.Hopping = 'Off';
 
chs2.ResourceIdx = 1;
chs2.ResourceSize = 0;
chs2.CyclicShifts = 0;

ack2 = 0;

%
% Measure the interference between the DM-RS signals.

interferenceNoCoMP = abs(sum(ltePUCCH2DRS(ue1,chs1,ack1).*conj(ltePUCCH2DRS(ue2,chs2,ack2))))

%
% Reconfigure interferer for CoMP operation: use virtual cell identity equal to the cell identity for the UE of interest.

ue2.NPUCCHID = ue1.NCellID;

%
% Measure the interference between the DM-RS signals when using CoMP.

interferenceUsingCoMP = abs(sum(ltePUCCH2DRS(ue1,chs1,ack1).*conj(ltePUCCH2DRS(ue2,chs2,ack2))))

% Comparing the correlations between the DM-RS signals for two UEs with and without CoMP, interferenceUsingCoMP and interferenceNoCoMP respectively. Using CoMP, the interference is reduced to effectively zero.
% Copyright 2012 The MathWorks, Inc.