Main Content

nrPRSIndices

Generate PRS resource element indices

Since R2021a

    Description

    ind = nrPRSIndices(carrier,prs) generates positioning reference signal (PRS) resource element (RE) indices 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.

    example

    ind = nrPRSIndices(carrier,prs,Name=Value) specifies options by using one or more name-value arguments. For example, IndexBase='0based' specifies the RE indexing base as 0.

    example

    Examples

    collapse all

    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
          ⋮
    
    

    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');

    Figure contains an axes object. The axes object with title PRS Resource Elements, xlabel OFDM Symbols, ylabel Subcarriers contains 3 objects of type image, line. These objects represent PRS Resource 1, PRS Resource 2.

    Input Arguments

    collapse all

    Carrier configuration parameters for a specific OFDM numerology, specified as an nrCarrierConfig object. This function uses only these nrCarrierConfig 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'.

    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

    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

    Output format of PRS resource element indices, specified as one of these values:

    • 'concatenated' — The output ind is a single column vector containing all PRS resource element indices concatenated.

    • 'cell' — The output ind is a cell array where each cell corresponds to a single PRS resource.

    Data Types: char | string

    Output Arguments

    collapse all

    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 the OutputResourceFormat 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 the OutputResourceFormat 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

    Version History

    Introduced in R2021a

    expand all