nrGNB
Description
Use the nrGNB object to create and configure 5G new radio (NR)
base station (gNB) nodes. This feature also requires the
Wireless Network
Toolbox™ product (since R2026a).
Creation
Description
creates a default gNB
object.gnb = nrGNB
gnb = nrGNB( creates one
or more similar gNB objects, and sets writable PropertyName=Value)properties using one
or more optional name-value arguments. For example, Position=[100 100 0; 5000 100
0],Name=["gNB1","gNB2"] creates two gNB objects, one with the name
"gNB1" and the other named "gNB2", positioned at
[100 100 0] and [5000 100 0], respectively. The
number of rows in the Position argument defines the number of gNB
objects created. If you create N nodes but supply M
names, where M is greater than N, the
nrGNB object uses only the first N names. If
M is less than N, the object uses default names
for the trailing (N-M) nodes.
Properties
Name of the gNB node, specified as a character vector, string scalar, vector of string array, or cell array of character vectors.
If you do not set the Name property, the nrGNB
object sets a default name, NodeX, where
X is the ID of the node.
To set the value of this property for multiple gNB nodes simultaneously, you must specify it at object creation.
Note
Starting in R2026a, you can set this property only at object creation. After creation, the property is read-only. In releases R2025b and before, after creating the object, you can set the value of this property for one node object at a time.
Data Types: char | string
Node position in 3-D Cartesian coordinates, specified as a three-element numeric row
vector or N-by-3 matrix. N is
the number of nrGNB objects to create using the creation function. Each
row specifies the position of the node in Cartesian x-,
y-, and z- coordinates. Units are in
meters.
To set the value of this property for multiple gNB nodes simultaneously, you must specify it at object creation. After object creation, you can set the value of this property for one gNB object at a time.
Data Types: double
This property is read-only after object creation.
Noise figure, specified as a nonnegative finite scalar. Units are in dB.
Data Types: double
This property is read-only after object creation.
Receiver antenna gain, specified as a nonnegative finite scalar. Units are in dB.
Data Types: double
This property is read-only after object creation.
Number of transmit antennas, specified as one of these options.
12481632
Data Types: double
This property is read-only after object creation.
Number of receive antennas, specified as one of these options.
12481632
Data Types: double
This property is read-only after object creation.
Peak transmit power of a gNB node, specified as a finite numeric scalar. Units are
in dBm. This value represents the maximum power output delivered to a load with unit
impedance, measured when the transmission uses all resource blocks. It defines the
maximum total output power of the gNB, as specified in section 3 of 3GPP TR 21.905. The
maximum transmit power you can specify is 60 dBm.
Data Types: double
Since R2026a
This property is read-only after object creation.
Physical (PHY) layer model, specified as one of these options. Note that all the gNB and user equipment (UE) nodes must use the same PHY model.
"abstract-phy"— Enable the link-to-system mapping-based abstracted PHY. The abstracted PHY models the link quality and performance to calculate the packet error rate (PER). Unlike full PHY, it does not involve waveform generation and decoding. For more information about the abstracted PHY, see Composition of NR Nodes."full-phy"— Enable full PHY processing. Full PHY processing involves waveform generation and decoding at the PHY layer.
Data Types: char | string
This property is read-only after object creation.
Duplexing mode, specified as one of these options.
"FDD"— Frequency division duplex"TDD"— Time division duplex
Data Types: char | string
This property is read-only after object creation.
Carrier frequency, specified as a real number. Units are in Hz.
Note
The value of the CarrierFrequency property must be same for
all interfering gNBs.
Data Types: double
This property is read-only after object creation.
Channel bandwidth, specified as one of these options. Units are in Hz.
5e610e615e620e630e635e640e645e650e660e670e680e690e6100e6200e6400e6
In FDD mode, the downlink (DL) and uplink (UL) operations occur in separate bands of the specified size. In TDD mode, both DL and UL share a single band of the specified size.
Note
The value of the ChannelBandwidth property must be same for
all interfering gNBs.
Data Types: double
This property is read-only after object creation.
Subcarrier spacing used across the cell, specified as one of these options. You may enter the value in Hz (such as 15e3) or in kHz (such as 15):
15e3or1530e3or3060e3or60120e3or120
Note
The value of the SubcarrierSpacing property must be same for
all interfering gNBs.
Data Types: double
This property is read-only after object creation.
Number of resource blocks in the channel bandwidth, specified as an integer in the
range [4,273].
In the FDD mode, the DL bandwidth and UL bandwidth each contain resource blocks
equal to NumResourceBlocks. In the TDD mode, the DL and UL bandwidths
share these resource blocks. If you do not specify this name-value argument, then the
nrgNB object derives it automatically from the channel bandwidth
and the subcarrier spacing. The default value, 25, corresponds to the
default 5e6 Hz channel bandwidth and 15e3 Hz SCS.
The minimum value, 4, is the minimum required transmission bandwidth for a sounding
reference signal (SRS), as defined in TS 38.211, table 6.4.1.4.3-1 [3].
Data Types: double
This property is read-only after object creation.
DL and uplink UL time division configuration for TDD mode, specified as a structure. The structure contains these fields.
DLULPeriodicity— DL-UL pattern periodicity in milliseconds. If you specify SCS as15e3,30e3,60e3, or120e3, then the default value of theDLULPeriodicityfield is5milliseconds,2.5milliseconds,1.25milliseconds, or0.625milliseconds, respectively.NumDLSlots— Number of full DL slots at the start of the DL-UL pattern. The default value is2.NumDLSymbols— Number of DL symbols after the full DL slots. The default value is12.NumULSymbols— Number of full UL symbols at the end of the DL-UL pattern. The default value is1.NumULSlots— Number of UL slots before the full UL slots. The default value is2.
The nrGNB object sets the reference SCS for the DL-UL pattern
to the value of SubcarrierSpacing. The configuration supports one S slot after the full DL
slots and before the full UL slots. The S slot consists of
NumDLSymbols at the start and NumULSymbols
at the end. The object sets the guard period between DL and UL time to 14 -
(NumDLSymbols + NumULSymbols). You can set NumULSymbols
to 0 or 1. If you set
NumULSymbols to 1, the gNB reserves the UL
symbol for sounding reference signal (SRS).
Dependencies
To enable this property, set the DuplexMode
property to "TDD".
Since R2025a
This property is read-only after object creation.
Sounding reference signal (SRS) transmission periodicity of a UE node, specified as
5, 8, 10,
16, 20, 32,
40, 64, 80,
160, 320, 640,
1280, or 2560 slots. This value is identical for
all connected UE nodes. This periodicity must also be an integer multiple of
L, where L is the interval in slots at which the
gNB reserves one symbol for the SRS resource across the entire bandwidth. The minimum
value of L is 5. For FDD, the nrGNB object fixes the
value of L at 5. For TDD, L is the minimum of
these values: 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, or 2560 slots; the
value of L is also a multiple of the DL-UL pattern length.
Data Types: double
Since R2026a
This property is read-only after object creation.
SRS-based downlink channel measurement configuration, specified as a structure with these fields:
PrecoderFormat— Precoder calculation mode, specified as"wideband"or"subband". The default value for this field is"wideband".MCSFormat— Modulation and coding scheme (MCS) calculation mode, specified as"wideband"or"subband". To enable"subband", setPrecoderFormatto"subband". When specified as"subband", the object calculates both subband and wideband MCS values. The default value for this field is"wideband".SubbandSize— Subband size for precoder and MCS calculations, specified as2or4. The default value is 4. This field is applicable when you setPrecoderFormatto"subband".
Note
Enabling the SRSMeasurementConfigDL property of the
nrGNB object sets the default value of the CSIMeasurementSignalDL argument of the configureScheduler function to "SRS".
Dependencies
To enable this property, set the DuplexMode
property to "TDD".
This property is read-only after object creation.
Number of hybrid automatic repeat request (HARQ) processes used for each UE in the DL and UL directions, specified as an integer in the range [1, 16].
Data Types: double
Since R2026a
Node mobility model, represented as an object of a subclass of
wnet.Mobility class.
Note
Only the nrGNB subclass can set the Mobility
property in its constructor or methods.
This property is read-only.
Node identifier, represented as a positive integer. This value specifies a unique identifier for the node in the simulation.
Note
If you create and store the gNB nodes in an uninitialized matrix, the node IDs that this property allocates to the nodes can be non-sequential because of the memory allocation to the object in the matrix. For more information about memory allocation, see How MATLAB Allocates Memory.
Data Types: double
This property is read-only.
Radio network temporary identifiers (RNTIs) of the UEs connected to a gNB node, represented as a vector of positive integers.
Data Types: double
Since R2024a
This property is read-only.
IDs of the UE nodes connected to the gNB node, represented as a vector of positive integers.
Data Types: double
Since R2024a
This property is read-only.
Names of the UE nodes connected to the gNB node, represented as a vector of strings.
This property is read-only.
MCS used for DL and UL, represented as a table. For more information about this property, see TS 38.214, table 5.1.3.1-2 [1].
Since R2026a
This property is read-only.
Node velocity in 3-D Cartesian coordinates, represented as a three-element numeric row vector. The units are in meters per second.
Data Types: double
Object Functions
configureScheduler | Configure scheduler at gNB |
configureULPowerControl | Configure uplink power control parameters |
connectUE | Connect one or more UEs to gNB |
addTrafficSource | Add data traffic source to 5G NR node |
registerEventCallback | Register callback for event from 5G node |
statistics | Statistics of gNB |
Examples
Create two similar gNB nodes, one with the name "gNB1" and the other named "gNB2", positioned at [100 100 0] and [5000 100 0], respectively.
gNBs = nrGNB(Name=["gNB1" "gNB2"],Position=[100 100 0; 5000 100 0])
gNBs = 1×2 nrGNB array
gNBs(1)
ans =
nrGNB with properties:
Position: [100 100 0]
Name: "gNB1"
Mobility: []
Read-only properties:
NoiseFigure: 6
ReceiveGain: 6
TransmitPower: 34
NumTransmitAntennas: 1
NumReceiveAntennas: 1
PHYModel: "abstract-phy"
DuplexMode: "FDD"
CarrierFrequency: 2.6000e+09
ChannelBandwidth: 5000000
SubcarrierSpacing: 15000
NumResourceBlocks: 25
NumHARQ: 16
ULPowerControlParameters: [1×1 struct]
SRSPeriodicityUE: 5
SRSMeasurementConfigDL: [1×1 struct]
ID: 1
Velocity: [0 0 0]
Constant properties:
MCSTable: [28×4 table]
gNBs(2)
ans =
nrGNB with properties:
Position: [5000 100 0]
Name: "gNB2"
Mobility: []
Read-only properties:
NoiseFigure: 6
ReceiveGain: 6
TransmitPower: 34
NumTransmitAntennas: 1
NumReceiveAntennas: 1
PHYModel: "abstract-phy"
DuplexMode: "FDD"
CarrierFrequency: 2.6000e+09
ChannelBandwidth: 5000000
SubcarrierSpacing: 15000
NumResourceBlocks: 25
NumHARQ: 16
ULPowerControlParameters: [1×1 struct]
SRSPeriodicityUE: 5
SRSMeasurementConfigDL: [1×1 struct]
ID: 2
Velocity: [0 0 0]
Constant properties:
MCSTable: [28×4 table]
Create a default gNB node.
gnb = nrGNB
gnb =
nrGNB with properties:
Position: [0 0 0]
Name: "Node1"
Mobility: []
Read-only properties:
NoiseFigure: 6
ReceiveGain: 6
TransmitPower: 34
NumTransmitAntennas: 1
NumReceiveAntennas: 1
PHYModel: "abstract-phy"
DuplexMode: "FDD"
CarrierFrequency: 2.6000e+09
ChannelBandwidth: 5000000
SubcarrierSpacing: 15000
NumResourceBlocks: 25
NumHARQ: 16
ULPowerControlParameters: [1×1 struct]
SRSPeriodicityUE: 5
SRSMeasurementConfigDL: [1×1 struct]
ID: 1
Velocity: [0 0 0]
Constant properties:
MCSTable: [28×4 table]
Create a default UE node.
ue = nrUE
ue =
nrUE with properties:
Position: [0 0 0]
Name: "Node2"
Mobility: []
Read-only properties:
NoiseFigure: 6
ReceiveGain: 0
TransmitPower: 23
NumTransmitAntennas: 1
NumReceiveAntennas: 1
PHYModel: "abstract-phy"
ConnectionState: "Idle"
ID: 2
Velocity: [0 0 0]
Establish a connection between the UE node and the gNB node.
connectUE(gnb,ue)
Initialize wireless network simulator.
networkSimulator = wirelessNetworkSimulator.init;
Create a gNB node with these specifications.
Duplex mode — Time division duplex
Channel bandwidth — 20 MHz
Subcarrier spacing — 30 KHz
gnb = nrGNB(ChannelBandwidth=20e6,DuplexMode="TDD",SubcarrierSpacing=30e3);Create a UE node with a transmit power of 20 dBm.
ue = nrUE(TransmitPower=20);
Add a random way point mobility model to the UE node.
addMobility(ue,BoundaryShape="rectangle")Establish a connection between the UE and gNB nodes.
connectUE(gnb,ue)
Create a voice over Internet protocol (VoIP) application traffic pattern object.
traffic = networkTrafficVoIP;
Add the data traffic source to the gNB node. Set the destination node as the UE node.
addTrafficSource(gnb,traffic,DestinationNode=ue)
Add the gNB node to the wireless network simulator.
addNodes(networkSimulator,gnb)
Add the UE node to the wireless network simulator.
addNodes(networkSimulator,ue)
Specify the simulation time, in seconds.
simulationTime = 0.3;
Run the simulation for the specified simulation time.
run(networkSimulator,simulationTime)
Obtain the statistics for the gNB and UE nodes.
gnbStats = statistics(gnb); ueStats = statistics(ue);
References
[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.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[4] 3GPP TS 38.321. “NR; Medium Access Control (MAC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
[5] 3GPP TS 38.322. “NR; Radio Link Control (RLC) protocol specification.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
Version History
Introduced in R2023aUse the PHYModel property to specify the physical (PHY)
model type at object creation. Use PHYModel instead of the
PHYAbstractionMethod object property (to be removed).
Specify PHYModel as one of these options:
"abstract-phy"(default) — Enable the link-to-system mapping-based abstracted PHY. The abstracted PHY models the link quality and performance to calculate the packet error rate (PER). Unlike full PHY, this option does not involve waveform generation and decoding."full-phy"— Enable full PHY processing. Full PHY processing involves waveform generation and decoding.
The PHYAbstractionMethod property will be removed in a future
release.
Starting in R2026a:
Use the
PHYModelobject property instead, as described in this table.Remove Property Recommended Replacement PHYAbstractionMethod = "linkToSystemMapping"PHYModel = "abstract-phy"PHYAbstractionMethod = "none"PHYModel = "full-phy"The
PHYAbstractionMethodis hidden. If you setPHYAbstractionMethodat object creation, the object automatically sets thePHYModelproperty.
Starting in R2026a, this feature is available in 5G Toolbox™ and also requires a Wireless Network Toolbox license. In prior releases, the feature is available through the Communications Toolbox™ Wireless Network Simulation Library add-on.
Starting in R2026a, you can set the Name property only at object
creation. After creation, the property is read-only. In releases R2025b and before, after
object creation, you can set the value of this property for one node object at a
time.
The nrGNB object now enables you to configure SRS-based downlink
channel measurements through the SRSMeasurementConfigDL property.
The nrGNB object now enables you to register a function callback for a
specified event on the gNB nodes by using the registerEventCallback function.
The nrGNB object now allows you to specify the SRS transmission periodicity of a
UE node through the SRSPeriodicityUE name-value
argument.
The nrGNB object now allows you to access the IDs and names of the UE nodes
connected to a gNB node through the UENodeIDs and UENodeNames properties, respectively.
The nrGNB object now supports these functionalities.
Configure UL power control parameters through the
configureULPowerControlobject function.Select a PHY layer processing method through the PHYModel property.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)