Main Content

NR Intercell Interference Modeling

This example shows the impact on network performance due to intercell downlink (DL) interference caused by nearby cells. The example models a 5G New Radio (NR) network of multiple cells operating in the same frequency band. Each cell has a gNB placed at the center of the cell that serves a set of user equipments (UEs). The NR stack on the nodes includes radio link control (RLC), medium access control (MAC), and physical (PHY) layers.


The example considers the following operations within gNB and UEs that facilitate DL transmissions and receptions.

The complete PDSCH packet is transmitted in the first symbol of its allocated symbol set. Receiver processes the packet in the symbol just after the last symbol in the allocated symbol set.

This example models:

  • Co-channel intercell interference.

  • Slot based and symbol based DL scheduling of PDSCH resources.

  • Configurable subcarrier spacing resulting in different slot durations.

  • Noncontiguous allocation of frequency-domain resources in terms of resource block groups (RBGs).

  • PDSCH demodulation reference signal (DM-RS).

  • DL channel quality measurement by UEs based on the CSI-RS received from gNB. By default, the CSI-RS resource element is transmitted in each slot for each resource block (RB) in DL bandwidth, for all UEs. The same CSI-RS configuration is applicable to all the UEs in the cell.

  • Free space path loss (FSPL), and additive white Gaussian noise (AWGN).

  • Single input single output (SISO) antenna configuration.

  • Single bandwidth part across the whole carrier.

Control packets such as DL assignment, PDSCH feedback, and channel quality indicator (CQI) report, are assumed to be sent out of band, that is, without the need for resources for transmission and assured error-free reception.

Co-Channel Interference

In cellular systems, each cell operates on a particular carrier frequency. The cells operating on the same carrier frequency are called co-channel cells. Co-channel cells can interfere in transmissions between them.

Consider this sample network topology consisting of 3 cells. Cell-1 and cell-3 operate on the same frequency band. Cell-2 operates on a different frequency band and does not interfere with cell-1 or cell-3.

NR Protocol Stack

A node (gNB or UE) consists of applications generating traffic, in addition to RLC, medium access control (MAC) and PHY. The helper classes hNRGNB.m and hNRUE.m create gNB and UE nodes respectively, containing RLC, MAC, and PHY layers. For more details on each layer, refer to the 'NR Protocol Stack' section in the NR Cell Performance Evaluation with Physical Layer Integration example.

Scenario Configuration

For simulation, set the following key configuration parameters.

  • Simulation time

  • Number of cells

  • Cell radius (all the UEs connected to a gNB are within this distance)

  • Positions of gNBs

  • Number of UEs in each cell

  • Signal to interference and noise ratio (SINR) to CQI mapping table for 0.1 block error rate (BLER). The lookup table to map the received SINR to CQI index for 0.1 BLER. The lookup table corresponds to the CQI table as per 3GPP TS 38.214 Table For more information about the process of generating this lookup table, see the 5G NR Downlink CSI Reporting example.

  • Transmit power of gNB

  • DL carrier bandwidth in terms of number of resource blocks (RBs)

  • DL carrier frequency

  • Subcarrier spacing

  • DL application traffic model

rng('default'); % Reset the random number generator
simParameters = []; % Clear the simParameters variable
simParameters.NumFramesSim = 20; % Simulation time in terms of number of 10 ms frames
simParameters.SchedulingType = 0; % Set the value to 0 (slot based scheduling) or 1 (symbol based scheduling)

Number of cells in the simulation. Cells are assumed to have sequential cell identifiers (NCellIDs) from 0 to NumCells-1. If you change the number of cells, ensure that the number of rows in simParameters.GNBPosition is equal to NumCells.

simParameters.NumCells = 3; % Number of cells
simParameters.CellRadius = 500; % Radius of each cell (in meters)

The N-by-2 matrix represents the position of gNBs in (X, Y) coordinates, where 'N' is the number of cells in the simulation. The row number 'P' represents the X and Y coordinates of the gNB in the cell having cell ID 'P-1'. For example, the value [3000, 600] in the 2nd row represents the (X, Y) coordinates of the gNB in the cell having cell ID 1.

simParameters.GNBPosition = [1700 600;
    3000 600;
    2500 2000];

% Number of UEs in a cell. Each cell contains same number of UEs
simParameters.NumUEsCell = 4;

simParameters.GNBTxPower = 32; % Tx power for gNB (in dBm)

% Set the channel bandwidth to 10 MHz and subcarrier spacing (SCS) to 30 kHz
% as defined in 3GPP TS 38.104 Section 5.3.2.
simParameters.NumRBs = 24;
simParameters.SCS = 30; % kHz
simParameters.DLCarrierFreq = 2.635e9; % Hz
simParameters.DLBandwidth = 10e6; % Hz

% SINR to CQI mapping table for 0.1 BLER
simParameters.SINR90pc = [-5.46 -0.46 4.54 9.05 11.54 14.04 15.54 18.04 ...
    20.04 22.43 24.93 25.43 27.43 30.43 33.43];

% Maximum limit on the RBs allotted for PDSCH. Transmission limit is
% applicable for new PDSCH assignments and not for the retransmissions
simParameters.RBAllocationLimitDL = 15; % For PDSCH

Logging and visualization configuration.

% Specify the ID of cell of interest. All the visualizations and metrics are shown for this cell
simParameters.CellOfInterest = 2; % Set a value from 0 to NumCells-1

% The parameters CQIVisualization and RBVisualization control the display
% of these visualizations: (i) CQI visualization of RBs (ii) RB assignment
% visualization. By default, the 'RBVisualization' plot is disabled. You
% can enable it by setting to 'true'
simParameters.CQIVisualization = true;
simParameters.RBVisualization = false;
% The output metrics plots are updated periodically NumMetricsSteps times within the
% simulation duration
simParameters.NumMetricsSteps = 20;
% MAT-files to write the logs into. They are used for post simulation analysis and visualization
simParameters.ParametersLogFile = 'simParameters'; % For logging the simulation parameters
simParameters.SimulationLogFile = 'simulationLogs'; % For logging the simulation logs

Application traffic configuration.

% Set the periodic DL application traffic model for UEs. The following
% configuration applies for each cell
simParameters.DLPacketPeriodicityUEs = 10; % Periodicity (in ms) at which the DL packets are generated for UEs at gNB
simParameters.DLPacketSizesUEs = 2e4; % Size of the DL packets generated (in bytes) for UEs at gNB

% Validate the simulation configuration

Derived Parameters

Based on the primary configuration parameters, compute the derived parameters. Additionally, set some example specific constants.

simParameters.DuplexMode = 0; % FDD
simParameters.ULBandwidth = 10e6; % Hz
simParameters.ULCarrierFreq = 2.515e9; % Hz
simParameters.NumUEs = simParameters.NumUEsCell; % Number of UEs in a cell
simParameters.NCellIDList = 0:simParameters.NumCells-1; % List of physical cell IDs

% CSI-RS resource configuration. All UEs are assumed to measure channel quality on same CSI-RS resource
simParameters.CSIRSRowNumber = 2; % Possible row numbers for single transmit antenna case are 1 and 2
simParameters.SubbandSize = 8; % Size of sub-band for CQI reporting in terms of number of RBs

% Set the BSRPeriodicity to 'inf' as there is no UL traffic
simParameters.BSRPeriodicity = inf; % In ms

% Slot duration for the selected SCS and number of slots in a 10 ms frame
slotDuration = 1/(simParameters.SCS/15); % In ms
numSlotsFrame = 10/slotDuration; % Number of slots in a 10 ms frame
numSlotsSim = simParameters.NumFramesSim * numSlotsFrame; % Number of slots in the simulation

% Interval at which metrics visualization updates in terms of number of
% slots. As one slot is the finest time-granularity of the simulation, make
% sure that MetricsStepSize is an integer
simParameters.MetricsStepSize = ceil(numSlotsSim / simParameters.NumMetricsSteps);
if mod(numSlotsSim, simParameters.NumMetricsSteps) ~= 0
    % Update the NumMetricsSteps parameter if NumSlotsSim is not
    % completely divisible by it
    simParameters.NumMetricsSteps = floor(numSlotsSim / simParameters.MetricsStepSize);

numLogicalChannels = 1; % Only 1 logical channel is assumed in each UE in this example

% Logical channel configuration applies for all the nodes (UEs and gNBs) in the simulation
simParameters.LCHConfig.LCID = 4;

% RLC entity direction. Value 0 represents DL only, 1
% represents UL only and 2 represents both UL and DL
% directions. Setting entity direction to have both UL and DL
simParameters.RLCConfig.EntityDir = 0;

% Create RLC channel configuration structure
rlcChannelConfigStruct.LCGID = 1; % Mapping between logical channel and logical channel group ID
rlcChannelConfigStruct.Priority = 1; % Priority of each logical channel
rlcChannelConfigStruct.PBR = 8; % Prioritized bitrate (PBR), in kilobytes per second, of each logical channel
rlcChannelConfigStruct.BSD = 10; % Bucket size duration (BSD), in ms, of each logical channel
rlcChannelConfigStruct.EntityType = simParameters.RLCConfig.EntityDir;
rlcChannelConfigStruct.LogicalChannelID = simParameters.LCHConfig.LCID;

% Maximum RLC service data unit (SDU) length (in bytes) as per 3GPP TS 38.323
simParameters.maxRLCSDULength = 9000;

% Generate the positions of UEs in each cell
simParameters.UEPosition = generateUEPositions(simParameters);

% Total number of UEs in the simulation
simParameters.MaxReceivers = simParameters.NumCells * simParameters.NumUEsCell;

if ~isfield(simParameters, 'SchedulingType') || simParameters.SchedulingType == 0 % If no scheduling type is specified or slot based scheduling is specified
    rbAssignmentPlotPeriodicity = numSlotsFrame; % Update RB assignment visualization every frame (10 ms)
    tickGranularity = 14;
    simParameters.PUSCHMappingType = 'A';
    simParameters.PDSCHMappingType = 'A';
else % Symbol based scheduling
    rbAssignmentPlotPeriodicity = 1; % Update RB assignment visualization every slot
    tickGranularity = 1;
    simParameters.PUSCHMappingType = 'B';
    simParameters.PDSCHMappingType = 'B';

Multicell Setup

Set up the cells with an individual cell consisting of one gNB and multiple UEs. For each cell, create the gNB and UE objects, initialize the channel quality information for UEs, and set up the logical channel at gNB and UEs. The helper classes hNRGNB.m and hNRUE.m create gNB and UE nodes respectively, containing the RLC, MAC, and PHY layers.

gNB = cell(simParameters.NumCells, 1);
UEs = cell(simParameters.NumCells, simParameters.NumUEsCell);
% Create DL packet distribution object
dlPacketDistributionObj = hNRPacketDistribution(simParameters, 0); % 0 for DL
% Create UL packet distribution object
ulPacketDistributionObj = hNRPacketDistribution(simParameters, 1); % 1 for UL

for cellIdx = 1:simParameters.NumCells % For each cell
    simParameters.NCellID = simParameters.NCellIDList(cellIdx); % Cell ID
    simParameters.Position = [simParameters.GNBPosition(cellIdx, :) 0]; % gNB position in (x,y,z) coordinates
    gNB{cellIdx} = hNRGNB(simParameters); % Create gNB node
    scheduler = hNRSchedulerProportionalFair(simParameters); % Create proportional fair scheduler
    addScheduler(gNB{cellIdx}, scheduler); % Add scheduler to gNB
    gNB{cellIdx}.PhyEntity = hNRGNBPhy(simParameters); % Create the PHY layer instance
    configurePhy(gNB{cellIdx}, simParameters); % Configure the PHY layer
    setPhyInterface(gNB{cellIdx}); % Set up the interface to PHY layer
    % For each cell, create the set of UE nodes and place them randomly within the cell radius
    for ueIdx = 1:simParameters.NumUEsCell
        simParameters.Position = [simParameters.UEPosition{cellIdx}(ueIdx, :) 0]; % Position of UE in (x,y,z) coordinates
        UEs{cellIdx, ueIdx} = hNRUE(simParameters, ueIdx);
        UEs{cellIdx, ueIdx}.PhyEntity = hNRUEPhy(simParameters, ueIdx); % Create the PHY layer instance
        configurePhy(UEs{cellIdx, ueIdx}, simParameters); % Configure the PHY layer
        setPhyInterface(UEs{cellIdx, ueIdx}); % Set up the interface to PHY
        % Setup logical channel at gNB for the UE
        configureLogicalChannel(gNB{cellIdx}, ueIdx, rlcChannelConfigStruct);
        % Setup logical channel at UE
        configureLogicalChannel(UEs{cellIdx, ueIdx}, ueIdx, rlcChannelConfigStruct);
        % Add data traffic pattern generators to gNB node
        packetSize = simParameters.DLPacketSizesUEs;
        % Calculate the data rate (in kbps) of On-Off traffic pattern using
        % packet size (in bytes) and packet interval (in ms)
        dataRate = ceil(1000/simParameters.DLPacketPeriodicityUEs) * packetSize * 8e-3;
        % Limit the size of the generated application packet to the maximum
        % RLC SDU size. The maximum supported RLC SDU size is 9000 bytes
        if packetSize > simParameters.maxRLCSDULength
            packetSize = simParameters.maxRLCSDULength;
        % Create an object for On-Off network traffic pattern for the specified
        % UE and add it to the gNB. This object generates the downlink data
        % traffic on the gNB for the UE
        app = networkTrafficOnOff('PacketSize', packetSize, 'GeneratePacket', true, ...
            'OnTime', simParameters.NumFramesSim/100, 'OffTime', 0, 'DataRate', dataRate);
        gNB{cellIdx}.addApplication(ueIdx, simParameters.LCHConfig.LCID, app);
    % Setup the UL and DL packet distribution mechanism
    hNRSetUpPacketDistribution(simParameters, gNB{cellIdx}, UEs(cellIdx, :), dlPacketDistributionObj, ulPacketDistributionObj);

Processing Loop

Simulation is run slot by slot. For each cell, in each slot, these operations are executed:

  • Run the MAC and PHY layers of gNB

  • Run the MAC and PHY layers of UEs

  • Layer-specific logging and visualization

  • Advance the timer for the nodes. Every 1 ms it also sends trigger to application and RLC layers. Application layer and RLC layer execute their scheduled operations based on 1 ms timer trigger.

% Display network topology

Figure Network Topology Visualization contains an axes. The axes with title Network Topology Visualization contains 18 objects of type line, scatter. These objects represent Interfering cells, Cell of interest, gNodeB, UE.

simSchedulingLogger = cell(simParameters.NumCells, 1);
simPhyLogger = cell(simParameters.NumCells, 1);
for cellIdx = 1:simParameters.NumCells
    % Create an object for MAC DL scheduling information visualization and logging
    simParameters.NCellID = simParameters.NCellIDList(cellIdx);
    simSchedulingLogger{cellIdx} = hNRSchedulingLogger(simParameters, 0); % 0 for DL
    % Create an object for PHY layer metrics logging
    simPhyLogger{cellIdx} = hNRPhyLogger(simParameters, 0); % 0 for DL

% Store the index of cell ID of interest
cellOfInterestIdx = find(simParameters.CellOfInterest == simParameters.NCellIDList);

% Create metrics visualization object for MAC and PHY metrics (DL direction is represented as 0)
visualizer = hNRMetricsVisualizer(simParameters, 'MACLogger', simSchedulingLogger{cellOfInterestIdx}, 'PhyLogger', simPhyLogger{cellOfInterestIdx}, 'VisualizationFlag', 0);

% Run processing loop
slotNum = 0;
numSymbolsSim = numSlotsSim * 14; % Simulation time in units of symbol duration
% Execute all the symbols in the simulation
for symbolNum = 1 : tickGranularity : numSymbolsSim
    if mod(symbolNum - 1, 14) == 0
        slotNum = slotNum + 1;
    % All the cells operating on same SCS hence slot durations are same
    for cellIdx = 1:simParameters.NumCells % For each cell
        % Run MAC and PHY layers of gNB

        % Run MAC and PHY layers of UEs
        for ueIdx = 1:simParameters.NumUEsCell
            run(UEs{cellIdx, ueIdx});

        % MAC logging
        logCellSchedulingStats(simSchedulingLogger{cellIdx}, symbolNum, gNB{cellIdx}, UEs(cellIdx, :), 0); % 0 for DL

        % PHY logging
        logCellPhyStats(simPhyLogger{cellIdx}, symbolNum, gNB{cellIdx}, UEs(cellIdx, :));

    % Visualization
    % Check slot boundary
    if symbolNum > 1 && ((simParameters.SchedulingType == 1 && mod(symbolNum, 14) == 0) || (simParameters.SchedulingType == 0 && mod(symbolNum-1, 14) == 0))
        % RB assignment visualization (if enabled)
        if simParameters.RBVisualization
            if mod(slotNum, rbAssignmentPlotPeriodicity) == 0
                % Plot at slot boundary, if the update periodicity is reached
        % CQI grid visualization (if enabled)
        if simParameters.CQIVisualization
            if mod(slotNum, numSlotsFrame) == 0 % Plot at frame boundary
        % If the update periodicity is reached, plot scheduler metrics and PHY metrics visualization
        % at slot boundary
        if mod(slotNum, simParameters.MetricsStepSize) == 0
            plotMetrics(visualizer, slotNum);

    for cellIdx = 1:simParameters.NumCells
        % Advance timer ticks for gNB and UEs by the number of symbols per slot
        advanceTimer(gNB{cellIdx}, tickGranularity);
        for ueIdx = 1:simParameters.NumUEsCell
            advanceTimer(UEs{cellIdx, ueIdx}, tickGranularity);

Figure Channel Quality Visualization contains an axes and other objects of type uicontrol. The axes with title Channel Quality Visualization for Cell ID - 2 contains 80 objects of type rectangle.

Simulation Visualization

The five types of run-time visualization shown are:

  • Display of Network Topology: The figure shows the configured cell topology. For each cell, it shows the position of the gNB and the connected UEs.

  • Display of CQI values for UEs over the PDSCH bandwidth: For details, see the 'Channel Quality Visualization' figure description in the NR PUSCH FDD Scheduling example.

  • Display of resource grid assignment to UEs: The 2D time-frequency grid shows the resource allocation to the UEs. You can enable this visualization in the Logging and Visualization Configuration section. For details, see the 'Resource Grid Allocation' figure description in the NR PUSCH FDD Scheduling example.

  • Display of DL scheduling metrics plots: For details, see the 'Downlink Scheduler Performance Metrics ' figure description in the NR FDD Scheduling Performance Evaluation example.

  • Display of DL Block Error Rates: For details, see the 'Block Error Rate (BLER) Visualization' figure description in the NR Cell Performance Evaluation with Physical Layer Integration example.

Simulation Logs

The parameters used for simulation and the simulation logs are saved in MAT-files for post simulation analysis and visualization. The simulation parameters are saved in a MAT-file with the file name as the value of configuration parameter simParameters.ParametersLogFile. The per time step logs, scheduling assignment logs, and BLER logs are captured for each cell in the simulation and saved in the MAT-file simParameters.SimulationLogFile. After the simulation, open the file to load NCellID, DLTimeStepLogs, SchedulingAssignmentLogs, and BLERLogs in the workspace.

NCellID: This stores the cell ID and represents cell to which the simulation logs belong.

DL Time step logs: Stores the per slot logs of the simulation with each slot as one row in the simulation. For details of log format, see the 'Simulation Logs' section of the NR PUSCH FDD Scheduling example.

Scheduling Assignment logs: Information of all the scheduling assignments and related information is logged in this file. For details of log format, see the 'Simulation Logs' section in the NR FDD Scheduling Performance Evaluation example.

Block Error Rate logs: Information of all the scheduling assignments and related information is logged in this file. For details of log format, see the 'Simulation Logs' section in the NR Cell Performance Evaluation with Physical Layer Integration example.

You can run the script NRPostSimVisualization to get a post-simulation visualization of logs. For more details about the options to run this script, see the NR FDD Scheduling Performance Evaluation example.

dlStats = getPerformanceIndicators(simSchedulingLogger{simParameters.CellOfInterest + 1});
[~, avgBLERLogs] = getBLERLogs(simPhyLogger{simParameters.CellOfInterest + 1});
fprintf('\nPeak DL throughput: %0.2f Mbps. Achieved average DL Throughput: %0.2f Mbps', dlStats(1, 1), dlStats(2, 1));
Peak DL throughput: 59.72 Mbps. Achieved average DL Throughput: 9.07 Mbps
fprintf('\nAchieved average DL Goodput: %0.2f Mbps', dlStats(5, 1));
Achieved average DL Goodput: 8.98 Mbps
fprintf('\nPeak DL spectral efficiency: %0.2f bits/s/Hz. Achieved average DL spectral efficiency: %0.2f bits/s/Hz', dlStats(3, 1), dlStats(4, 1));
Peak DL spectral efficiency: 5.97 bits/s/Hz. Achieved average DL spectral efficiency: 0.91 bits/s/Hz
disp(['Block error rate for each UE in the downlink direction: [' num2str(round(avgBLERLogs(:, 1)', 2)) ']']);
Block error rate for each UE in the downlink direction: [0.01           0        0.04        0.03]
% Get the logs
if(simParameters.DuplexMode == 0) % FDD
    logInfo = struct('NCellID', [], 'DLTimeStepLogs', [], 'SchedulingAssignmentLogs', [], 'BLERLogs', [], 'AvgBLERLogs', []);
    logInfo = struct('NCellID', [], 'TimeStepLogs', [], 'SchedulingAssignmentLogs', [], 'BLERLogs', [], 'AvgBLERLogs', []);
simulationLogs = cell(simParameters.NumCells, 1);
for cellIdx = 1:simParameters.NumCells
    logInfo.NCellID = simParameters.NCellIDList(cellIdx);
    if(simParameters.DuplexMode == 0) % FDD
        logInfo.DLTimeStepLogs = getSchedulingLogs(simSchedulingLogger{cellIdx});
    else % TDD
        logInfo.TimeStepLogs = getSchedulingLogs(simSchedulingLogger{cellIdx});
    logInfo.SchedulingAssignmentLogs = getGrantLogs(simSchedulingLogger{cellIdx}); % Scheduling assignments log
    logInfo.BLERLogs = getBLERLogs(simPhyLogger{cellIdx}); % Block error rate logs
    simulationLogs{cellIdx, 1} = logInfo;
save(simParameters.ParametersLogFile, 'simParameters'); % Save simulation parameters in a MAT-file
save(simParameters.SimulationLogFile, 'simulationLogs'); % Save simulation logs in a MAT-file

Further Exploration

You can use this example to further explore these options.

  • Model the uplink interference between the nodes by configuring uplink-related configuration. For details, see the NR Cell Performance Evaluation with Physical Layer Integration example.

  • Model the Aggressor-Victim scenarios: The aggressor is the source of interference and the victim suffers due to the interference. Consider the DL scenario in the following figure. The macro UE is far away from the macro base station (BS) and near to the small cell. The small cell BS interferes with macro BS transmission for macro UE in DL. Due to that macro UE suffers from interference by the small cell BS. The small cell BS is called the aggressor and macro UE is called the victim.

  • To model multiple clusters, where each cluster consists of cells operating on different frequencies, and analyze the impact of interference on the cell edge users.

Based on the described simulation parameters, the example evaluates the performance of the system measured in terms of various metrics. Different visualizations show the run time performance of the system. A more thorough post simulation analysis by using the saved logs gives a detailed picture of the operations happening on a per slot basis.


The example uses these helper functions and classes:

Local functions

function plotNetwork(simParameters)
% Create the figure
figure('Name', 'Network Topology Visualization', 'units', 'normalized', 'outerposition', [0 0 1 1], 'Visible', "on");
title('Network Topology Visualization');
hold on;

for cellIdx = 1:simParameters.NumCells
    % Plot the circle
    th = 0:pi/60:2*pi;
    xunit = simParameters.CellRadius * cos(th) + simParameters.GNBPosition(cellIdx, 1);
    yunit = simParameters.CellRadius * sin(th) + simParameters.GNBPosition(cellIdx, 2);
    if simParameters.CellOfInterest == simParameters.NCellIDList(cellIdx)
        h1 =  plot(xunit, yunit, 'Color', 'green'); % Cell of interest
        h2 =  plot(xunit, yunit, 'Color', 'red');
    xlabel('X-Position (meters)')
    ylabel('Y-Position (meters)')
    % Add tool tip data for gNBs
    s1 = scatter(simParameters.GNBPosition(cellIdx, 1), simParameters.GNBPosition(cellIdx, 2), '^','MarkerEdgeColor', 'magenta');
    cellIdRow = dataTipTextRow('Cell - ',{num2str(simParameters.NCellIDList(cellIdx))});
    s1.DataTipTemplate.DataTipRows(1) = cellIdRow;
    posRow = dataTipTextRow('Position[X, Y]: ',{['[' num2str(simParameters.GNBPosition(cellIdx, :)) ']']});
    s1.DataTipTemplate.DataTipRows(2) = posRow;
    % Add tool tip data for UEs
    uePosition = simParameters.UEPosition{cellIdx};
    for ueIdx = 1:size(uePosition, 1)
        s2 = scatter(uePosition(ueIdx, 1), uePosition(ueIdx, 2), '.','MarkerEdgeColor', 'blue');
        ueIdRow = dataTipTextRow('UE - ',{num2str(ueIdx)});
        s2.DataTipTemplate.DataTipRows(1) = ueIdRow;
        posRow = dataTipTextRow('Position[X, Y]: ',{['[' num2str(uePosition(ueIdx, :)) ']']});
        s2.DataTipTemplate.DataTipRows(2) = posRow;
% Create the legend
if simParameters.NumCells > 1
    legend([h1 h2 s1 s2], 'Cell of interest', 'Interfering cells', 'gNodeB', 'UE', 'Location', 'northeastoutside')
    legend([h1 s1 s2], 'Cell of interest', 'gNodeB', 'UE', 'Location', 'northeastoutside')
axis([0 4000 0 3000]); % Set axis limits
hold off;
daspect([1000,1000,1]); % Set data aspect ratio

function uePositions = generateUEPositions(simParameters)
% Return the position of UEs in each cell

uePositions = cell(simParameters.NumCells, 1);
for cellIdx=1:simParameters.NumCells
    gnbXCo = simParameters.GNBPosition(cellIdx, 1); % gNB X-coordinate
    gnbYCo = simParameters.GNBPosition(cellIdx, 2); % gNB Y-coordinate
    theta = rand(simParameters.NumUEsCell, 1)*(2*pi);
    % Expression to calculate position of UEs with in the cell. By default,
    % it will place the UEs randomly with in the cell
    r = sqrt(rand(simParameters.NumUEsCell, 1))*simParameters.CellRadius;
    x = round(gnbXCo + r.*cos(theta));
    y = round(gnbYCo + r.*sin(theta));
    uePositions{cellIdx} = [x y];


[1] 3GPP TS 38.104. “NR; Base Station (BS) radio transmission and reception.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[2] 3GPP TS 38.214. “NR; Physical layer procedures for data.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[3] 3GPP TS 38.321. “NR; Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[4] 3GPP TS 38.322. “NR; Radio Link Control (RLC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[5] 3GPP TS 38.323. “NR; Packet Data Convergence Protocol (PDCP) specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[6] 3GPP TS 38.331. “NR; Radio Resource Control (RRC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

[7] 3GPP TR 37.910. “Study on self evaluation towards IMT-2020 submission.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

Related Topics