nrPRSIndices
Description
generates positioning reference signal (PRS) resource element (RE) indices
ind
= nrPRSIndices(carrier
,prs
)ind
, as defined in TS 38.211 Section 7.4.1.7.3 [1], for carrier configuration
carrier
and PRS configuration prs
. The function
also handles the conditions related to the mapping of PRS resources to slots, as defined in
TS 38.211 Section 7.4.1.7.4.
specifies options by using one or more name-value arguments. For example,
ind
= nrPRSIndices(carrier
,prs
,Name,Value
)'IndexBase','0based'
specifies the RE indexing base as 0.
Examples
Generate PRS Indices for Multiple Resources in Resource Set
Create a default carrier configuration object.
carrier = nrCarrierConfig;
Create a default PRS configuration object.
prs = nrPRSConfig;
Set properties that are common to all PRS resources in a resource set.
prs.PRSResourceSetPeriod = [20 0]; prs.PRSResourceRepetition = 4; prs.PRSResourceTimeGap = 2; prs.MutingPattern1 = [1 0]; prs.MutingBitRepetition = 2; prs.MutingPattern2 = [1 0 1 0]; prs.NumRB = 32; prs.RBOffset = 10; prs.CombSize = 4;
Set properties that are unique to each PRS resource in a resource set. You can specify these properties as a scalar or vector. If you specify a scalar, the object applies that value to all of the PRS resources in a PRS resource set. If you specify a vector, the object applies the vector element values to the corresponding PRS resource. The length of this vector must be equal to the number of PRS resources to be configured in a PRS resource set.
prs.PRSResourceOffset = [0 10]; prs.NumPRSSymbols = [6 4]; prs.SymbolStart = [0 1]; prs.REOffset = 0; prs.NPRSID = [10 50];
Generate 0-based PRS RE indices with subscript RE indexing form.
ind = nrPRSIndices(carrier,prs,'IndexStyle','subscript','IndexBase','0based')
ind = 576x3 uint32 matrix
120 0 0
124 0 0
128 0 0
132 0 0
136 0 0
140 0 0
144 0 0
148 0 0
152 0 0
156 0 0
⋮
Generate PRS Symbols and Indices for Two Resources
Create a default carrier configuration object.
carrier = nrCarrierConfig;
Create a default PRS configuration object.
prs = nrPRSConfig;
Set properties related to the PRS slot configuration.
prs.PRSResourceSetPeriod = [8 0]; % Resource set periodicity of 8 slots and resource set slot offset of 0 slots prs.PRSResourceOffset = [0 4]; % Configure two PRS resources with slot offsets 0 and 4 relative to resource set offset prs.PRSResourceRepetition = 2; % Repeat each PRS resource twice prs.PRSResourceTimeGap = 1; % Configure two PRS resource repetition indices with no time gap
Set properties related to the PRS muting configuration.
prs.MutingPattern1 = [1 1]; % Transmit all PRS resource set instances prs.MutingBitRepetition = 1; % One instance of a PRS resource set corresponding to a single element of MutingPattern1 binary vector prs.MutingPattern2 = [1 0]; % Mute second repetition index of all the PRS resources within an active instance of a PRS resource set
Set properties related to the PRS time-domain allocation.
prs.NumPRSSymbols = [6 12]; prs.SymbolStart = [6 0];
Set properties related to the PRS frequency-domain allocation.
prs.NumRB = 40;
prs.RBOffset = 4;
prs.CombSize = 4;
prs.REOffset = [1 3];
prs.NPRSID = 5; % Set PRS sequence identity
Get the number of orthogonal frequency division multiplexing (OFDM) symbols per slot.
numSymPerSlot = carrier.SymbolsPerSlot;
Set the number of slots to 20.
numSlots = 20;
Map the resource elements (RE) for both of the PRS resources on the carrier resource grid.
grid = complex(zeros(carrier.NSizeGrid*12,carrier.SymbolsPerSlot*numSlots)); for slotIdx = 0:numSlots-1 carrier.NSlot = slotIdx; indCell = nrPRSIndices(carrier,prs,'OutputResourceFormat','cell'); symCell = nrPRS(carrier,prs,'OutputResourceFormat','cell'); slotGrid = nrResourceGrid(carrier); slotGrid(indCell{1}) = 70*symCell{1}; % Resource element mapping of PRS resource 1 with some scaling for plotting purpose slotGrid(indCell{2}) = 250*symCell{2}; % Resource element mapping of PRS resource 2 with some scaling for plotting purpose grid(:,(1:numSymPerSlot)+numSymPerSlot*slotIdx) = slotGrid; end figure image(abs(grid)); axis xy; L = line(ones(2),ones(2),'LineWidth',8); % Generate lines set(L,{'color'},{[0.18 0.51 0.98]; [0.96 0.95 0.11]}); % Set the colors legend('PRS Resource 1','PRS Resource 2'); % Create legend title('PRS Resource Elements'); xlabel('OFDM Symbols'); ylabel('Subcarriers');
Input Arguments
carrier
— Carrier configuration parameters
nrCarrierConfig
object
Carrier configuration parameters for a specific OFDM numerology, specified as an
nrCarrierConfig
object. This function uses only these nrCarrierConfig
object
properties.
SubcarrierSpacing
— Subcarrier spacing in kHz
15
(default) | 30
| 60
| 120
| 240
| 480
| 960
Subcarrier spacing in kHz, for all channels and reference signals of the carrier, specified as
15
, 30
, 60
,
120
, 240
, 480
, or
960
.
Data Types: double
CyclicPrefix
— Cyclic prefix length
'normal'
(default) | 'extended'
Cyclic prefix length, specified as one of these options.
'normal'
— Use this value to specify normal cyclic prefix. This option corresponds to 14 OFDM symbols in a slot.'extended'
— Use this value to specify extended cyclic prefix. This option corresponds to 12 OFDM symbols in a slot. For the numerologies specified in TS 38.211 Section 4.2, extended cyclic prefix length applies for only 60 kHz subcarrier spacing.
Data Types: char
| string
NSizeGrid
— Number of RBs in carrier resource grid
52
(default) | integer from 1 to 275
Number of RBs in the carrier resource grid, specified as an integer from 1 to 275. The default
value of 52
corresponds to the maximum number of RBs of a 10 MHz
carrier with 15 kHz SCS.
Data Types: double
NStartGrid
— Start of carrier resource grid relative to CRB 0
0
(default) | integer from 0 to 2199
Start of carrier resource grid relative to CRB 0, specified as an integer from 0 to 2199. This property is the higher-layer parameter offsetToCarrier.
Data Types: double
NSlot
— Slot number
0
(default) | nonnegative integer
Slot number, specified as a nonnegative integer. You can set NSlot
to a value larger than the number of slots per frame. For example, you can set this value using transmission loop counters in a MATLAB® simulation. In this case, you may have to ensure that the property value is modulo the number of slots per frame in a calling code.
Data Types: double
NFrame
— System frame number
0
(default) | nonnegative integer
System frame number, specified as a nonnegative integer. You can set NFrame
to a value larger than the maximum frame number 1023. For example, you can set this value using transmission loop counters in a MATLAB simulation. In this case, you may have to ensure that the property value is modulo 1024 in a calling code.
Data Types: double
prs
— PRS configuration parameters
nrPRSConfig
object
PRS configuration parameters, specified as an nrPRSConfig
object. This function
uses only these nrPRSConfig
object properties.
PRSResourceSetPeriod
— PRS resource set slot periodicity and slot offset
'on'
(default) | 'off'
| two-element vector
PRS resource set slot periodicity and slot offset, specified as one of these options.
'on'
— All of the PRS resources are present in the operating slot.'off'
— All of the PRS resources are absent in the operating slot.Two-element vector of the form [TPRSPeriod, TPRSOffset] — TPRSPeriod is the resource set slot periodicity. The nominal value of TPRSPeriod must equal 2μ multiplied by one of the values in the set {4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 160, 320, 640, 1280, 2560, 5120, 10,240}, where μ is the subcarrier spacing configuration with a value of 0, 1, 2, or 3. TPRSOffset is the resource set slot offset and must equal a value in the range [0, TPRSPeriod – 1].
Data Types: double
| string
| char
PRSResourceOffset
— Slot offset of each PRS resource
0
(default) | scalar in the range [0, 511] | vector of integers in the range [0, 511]
Slot offset of each PRS resource (0-based) provided by the higher layer parameter dl-PRS-ResourceSlotOffset-r16, specified as a scalar in the range [0, 511] or a vector of integers in the range [0, 511]. This property represents the starting slot offset of a PRS resource relative to the PRS resource set offset (TPRSOffset).
Configure this property for each resource in a resource set separately based on one of these options.
When a single resource is present, specify this property as a scalar.
When multiple resources are present, specify this property as a scalar or vector. If you specify a scalar, the object applies that value to all of the PRS resources in a PRS resource set. If you specify a vector, the object applies the vector element values to the corresponding PRS resource. The length of this vector must be equal to the number of PRS resources to be configured in a PRS resource set.
Dependencies
To enable this property, set the PRSResourceSetPeriod
property to a two-element vector
of the form [TPRSPeriod, TPRSOffset].
Data Types: double
PRSResourceRepetition
— PRS resource repetition factor
1
(default) | 2
| 4
| 6
| 8
| 16
| 32
PRS resource repetition factor provided by the higher layer parameter
dl-PRS-ResourceRepetitionFactor-r16, specified as
1
, 2
, 4
,
6
, 8
, 16
, or
32
. This property value is the same for all of the PRS resources
in a PRS resource set.
Dependencies
To enable this property, set the PRSResourceSetPeriod
property to a two-element vector of the form [TPRSPeriod,
TPRSOffset].
Data Types: double
PRSResourceTimeGap
— Slot offset between two consecutive repeated instances of a PRS resource
1
(default) | 2
| 4
| 8
| 16
| 32
Slot offset between two consecutive repeated instances of a PRS resource, specified as
1
, 2
, 4
,
8
, 16
, or 32
. The property
represents the offset in terms of the number of slots between two repeated instances of
a PRS resource. This property value is same the for all of the PRS resources in a PRS
resource set. This property is the higher layer parameter
dl-PRS-ResourceTimeGap-r16.
Dependencies
To enable this property, set the PRSResourceSetPeriod
property to a
two-element vector of the form [TPRSPeriod,
TPRSOffset] and the PRSResourceRepetition
property to a value greater than
1.
Data Types: double
MutingPattern1
— Muting bit pattern option-1
[]
(default) | binary-valued vector of length 2, 4, 6, 8, 16, or 32
Muting bit pattern option-1, specified as []
or a binary-valued vector of
length 2, 4, 6, 8, 16, or 32.
If the higher layer parameter mutingOption1-r16 is configured, set this property to a binary-valued vector of length 2, 4, 6, 8, 16, or 32. Each element in the vector corresponds to a number of consecutive instances of a PRS resource set based on the
MutingBitRepetition
property. The vector element also indicates whether all of the PRS resources within the PRS resource set instances are transmitted (binary 1) or muted (binary 0).If the higher layer parameter mutingOption1-r16 is not configured, set this property to
[]
. To disable the muting bit pattern option-1, set this property to[]
.
Dependencies
To enable this property, set the PRSResourceSetPeriod
property to a
two-element vector of the form [TPRSPeriod,
TPRSOffset].
Data Types: double
MutingBitRepetition
— Muting bit repetition factor
1
(default) | 2
| 4
| 8
Muting bit repetition factor provided by the higher layer parameter
dl-PRS-MutingBitRepetitionFactor-r16, specified as
1
, 2
, 4
, or
8
. This property indicates the number of consecutive instances of
the PRS resource set, N, corresponding to each element of the
MutingPattern1
property. The first element in
MutingPattern1
corresponds to the first N
instances of a PRS resource set, the second element corresponds to the next
N instances of a PRS resource set, and so on.
Dependencies
To enable this property, set the PRSResourceSetPeriod
property to a
two-element vector of the form [TPRSPeriod,
TPRSOffset] and the MutingPattern1
property to a value other than []
.
Data Types: double
MutingPattern2
— Muting bit pattern option-2
[]
(default) | binary-valued vector of length 1, 2, 4, 6, 8, 16, or 32
Muting bit pattern option-2, specified as []
or a binary-valued vector of
length 1, 2, 4, 6, 8, 16, or 32.
If the higher layer parameter mutingOption2-r16 is configured, set this property to a binary-valued vector of length 1, 2, 4, 6, 8, 16, or 32. Each element in the vector relates to the corresponding repetition index. Each element in the vector corresponds to a single repetition index of each PRS resource in an active instance of a PRS resource set. The vector element also indicates whether the repetition index for all of the PRS resources is transmitted (binary 1) or muted (binary 0).
If the higher layer parameter mutingOption2-r16 is not configured, set this property to
[]
. To disable the muting bit pattern option-2, set this property to[]
.
Dependencies
To enable this property, set the PRSResourceSetPeriod
property to a two-element vector of the form [TPRSPeriod,
TPRSOffset].
Data Types: double
NumPRSSymbols
— Number of consecutive OFDM symbols allocated for each PRS resource
12
(default) | scalar in the range [0, 12] | vector of integers in the range [0, 12]
Number of consecutive OFDM symbols allocated for each PRS resource, specified as a scalar in the range [0, 12] or a vector of integers in the range [0, 12].
Configure this property for each resource in a resource set separately based on one of these options.
When a single resource is present, specify this property as a scalar.
When multiple resources are present, specify this property as a scalar or vector. If you specify a scalar, the object applies that value to all of the PRS resources in a PRS resource set. If you specify a vector, the object applies the vector element values to the corresponding PRS resource. The length of this vector must be equal to the number of PRS resources to be configured in a PRS resource set.
This property is the higher layer parameter
dl-PRS-NumSymbols-r16, and the nominal value of this property must
be 2
, 4
, 6
, or
12
. To indicate no PRS resource allocation, set this property to
0
.
Data Types: double
SymbolStart
— Starting OFDM symbol of each PRS resource in slot
0
(default) | scalar in the range [0, 13] | vector of integers in the range [0, 13]
Starting OFDM symbol of each PRS resource in a slot (0-based), specified as a scalar in the range [0, 13] or a vector of integers in the range [0, 13].
Configure this property for each resource in a resource set separately based on one of these options.
When a single resource is present, specify this property as a scalar.
When multiple resources are present, specify this property as a scalar or vector. If you specify a scalar, the object applies that value to all of the PRS resources in a PRS resource set. If you specify a vector, the object applies the vector element values to the corresponding PRS resource. The length of this vector must be equal to the number of PRS resources to be configured in a PRS resource set.
This property is the higher layer parameter dl-PRS-ResourceSymbolOffset-r16, and the nominal value of this property must be in the range [0, 12].
Data Types: double
NumRB
— Number of PRBs allocated for all PRS resources
52
(default) | scalar in the range [0, 275]
Number of PRBs allocated for all PRS resources in a resource set, specified as a scalar in the
range [0, 275]. This property is the higher layer parameter
dl-PRS-ResourceBandwidth-r16, and the nominal value of this
property must be in the range [24, 272] with a granularity of 4 PRBs. To indicate no PRS
resource allocation, set this property to 0
.
Data Types: double
RBOffset
— Starting PRB index of all PRS resources relative to carrier resource grid
0
(default) | scalar in the range [0, 274]
Starting PRB index of all PRS resources relative to the carrier resource grid, specified as a scalar in the range [0, 274].
Data Types: double
CombSize
— Comb size of all PRS resources
2
(default) | 4
| 6
| 12
Comb size of all PRS resources in a resource set, specified as 2
,
4
, 6
, or 12
. The comb size
represents the resource element spacing in each OFDM symbol. This property is the higher
layer parameter dl-PRS-CombSizeN-r16. The value
2
specifies for the object to allocate every 2nd RE in the PRB
for PRS, the value 4
specifies for the object to allocate every 4th
RE in the PRB for PRS, and so on.
Data Types: double
REOffset
— Starting RE offset in first PRS OFDM symbol of each PRS resource
0
(default) | scalar in the range [0, (CombSize
–1)] | vector of integers in the range [0, (CombSize
–1)]
Starting RE offset in the first PRS OFDM symbol of each PRS resource, specified as a scalar in
the range [0, (CombSize
–1)] or a vector of integers in the range [0,
(CombSize
–1)]. The relative RE offsets of the next PRS OFDM
symbols are defined relative to the REOffset
value, as described in
TS 38.211 Table 7.4.1.7.3-1.
Configure this property for each resource in a resource set separately based on one of these options.
When a single resource is present, specify this property as a scalar.
When multiple resources are present, specify this property as a scalar or vector. If you specify a scalar, the object applies that value to all of the PRS resources in a PRS resource set. If you specify a vector, the object applies the vector element values to the corresponding PRS resource. The length of this vector must be equal to the number of PRS resources to be configured in a PRS resource set.
This property is the higher layer parameter dl-PRS-ReOffset-r16.
Data Types: double
Note
The maximum vector length of these five properties of nrPRSConfig
object specifies the number of configured PRS resources.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'IndexStyle','subscript'
specifies the RE indexing style of
the output indices as 'subscript'
.
IndexStyle
— RE indexing form
'index'
(default) | 'subscript'
RE indexing form, specified as one of these values:
'index'
— The indices are in linear index form.'subscript'
— The indices are in [subcarrier, symbol, antenna] subscript row form.
Data Types: char
| string
IndexBase
— RE indexing base
'1based'
(default) | '0based'
RE indexing base, specified as one of these values:
'1based'
— The index counting starts from 1.'0based'
— The index counting starts from 0.
Data Types: char
| string
OutputResourceFormat
— Output format of PRS resource element indices
'concatenated'
(default) | 'cell'
Output format of PRS resource element indices, specified as one of these values:
'concatenated'
— The outputind
is a single column vector containing all PRS resource element indices concatenated.'cell'
— The outputind
is a cell array where each cell corresponds to a single PRS resource.
Data Types: char
| string
Output Arguments
ind
— PRS RE indices
column vector | M-by-3 matrix | cell array of column vectors | cell array of matrices
PRS RE indices, returned as one of these values.
Column vector — The function returns the indices output in this format when you set the
IndexStyle
name-value argument to'index'
.M-by-3 matrix — The function returns the indices output in this format when you set the
IndexStyle
name-value argument to'subscript'
. The matrix rows correspond to the [subcarrier, symbol, antenna] subscripts based on the number of subcarriers, OFDM symbols, and number of antennas, respectively.Cell array of column vectors — The function returns the indices output in this format when you set the
IndexStyle
name-value argument to'index'
and theOutputResourceFormat
name-value argument to'cell'
.Cell array of matrices — The function returns the indices output in this format when
IndexStyle
is set to'subscript'
and theOutputResourceFormat
name-value argument to'cell'
. The number of rows in each cell varies based on the PRS resource configurations in a PRS resource set.
Depending on the value of IndexBase
, the function returns
either 1-based or 0-based indices.
Data Types: uint32
References
[1] 3GPP TS 38.211. “NR; Physical channels and modulation (Release 16).” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
The
'OutputResourceFormat'
name-value argument must be compile-time
constant for code generation. For example, when you call the function with
'OutputResourceFormat','concatenated'
, include
{coder.Constant('OutputResourceFormat'),coder.Constant('concatenated')}
in the -args
value of the codegen
function. For more
information, see the coder.Constant
(MATLAB Coder) class.
Version History
Introduced in R2021aR2023a: C/C++ code generation updates
For C/C++ code generation, the limitation to specify 'IndexStyle'
or 'IndexBase'
name-value arguments as compile-time constants has been
removed.
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)