%% Generate PUSCH DM-RS Using Alternate IDs
% Demonstrate Uplink Release 11 coordinated multipoint (CoMP) operation. To avoid intercell interference, use a virtual cell identity (NPUSCHID) and a distinct DM-RS cyclic shift hopping identity (NDMRSID) for a potentially interfering UE in a neighboring cell.
% Configure the UE of interest: UE 1 in cell 1.

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

chs1.PRBSet = (0:5).';
chs1.NLayers = 1;
chs1.DynCyclicShift = 0;
chs1.OrthCover = 'Off';

%
% Configure the interferer: UE 2 in cell 2.

ue2.NCellID = 2;
ue2.NSubframe = 0;
ue2.CyclicPrefixUL = 'Normal';
ue2.NTxAnts = 1;
ue2.Hopping = 'Off';
ue2.SeqGroup = 0;
ue2.CyclicShift = 0;

chs2.PRBSet = (0:5).';
chs2.NLayers = 1;
chs2.DynCyclicShift = 0;
chs2.OrthCover = 'Off';

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

interferenceNoCoMP = ...
    abs(sum(ltePUSCHDRS(ue1,chs1).*conj(ltePUSCHDRS(ue2,chs2))));

%
% Reconfigure for CoMP operation. Use a virtual cell identity equal to the cell identity for the UE of interest. Configure the two UEs with different cyclic shift hopping patterns using the DM-RS identity parameter.

ue1.NDMRSID = 1;
ue2.NPUSCHID = ue1.NCellID;
ue2.NDMRSID = 2;

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

interferenceUsingCoMP = ...
    abs(sum(ltePUSCHDRS(ue1,chs1).*conj(ltePUSCHDRS(ue2,chs2))));

%
% Compare the correlations between the DM-RS signals for the two UEs with and without CoMP, interferenceUsingCoMP and interferenceNoCoMP, respectively.

interferenceUsingCoMP
interferenceNoCoMP

% With CoMP, the interference is reduced to effectively zero.
% Copyright 2012 The MathWorks, Inc.