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.
prs
— PRS configuration parameters
nrPRSConfig
object
PRS configuration parameters, specified as an nrPRSConfig
object. This function
uses only these nrPRSConfig
object properties.
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.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)