Main Content


Generate PRACH resource element indices

Since R2020a



[ind,info] = nrPRACHIndices(carrier,prach) returns resource element indices ind for the physical random access channel (PRACH), as defined in TS 38.211 Section 5.3.2 [1]. The input carrier specifies carrier configuration parameters for a specific OFDM numerology. The input prach specifies PRACH configuration parameters. The function also returns the structure info, which contains carrier-dependent information about the PRACH.

[ind,info] = nrPRACHIndices(carrier,prach,Name,Value) specifies output formatting options using one or more name-value pair arguments.


collapse all

Configure the PRACH and the carrier with default properties.

carrier = nrCarrierConfig;
prach = nrPRACHConfig;

Generate PRACH symbols and indices using the specified carrier and PRACH configuration parameters.

prachSym = nrPRACH(carrier,prach);
prachInd = nrPRACHIndices(carrier,prach);

Generate a PRACH resource grid of all zeros.

prachGrid = nrPRACHGrid(carrier,prach);

Map the PRACH symbols to the PRACH resource grid by using the indices.

prachGrid(prachInd) = prachSym;

Input Arguments

collapse all

Carrier configuration parameters for a specific OFDM numerology, specified as an nrCarrierConfig object.

PRACH configuration parameters, specified as an nrPRACHConfig object. The function uses only these properties of this input.

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','IndexBase','0based' specifies the indexing form and indexing base of the output.

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 Arguments

collapse all

PRACH resource element indices, returned as one of these values.

  • M-by-1 vector — When 'IndexStyle' is set to 'index'.

  • M-by-3 matrix — When 'IndexStyle' is set 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.

M depends on the length of the Zadoff-Chu preamble sequence and is equal to prach.LRA.

Depending on 'IndexBase', the indices are either 1-based or 0-based.

Data Types: uint32

Carrier-dependent PRACH information, returned as a structure containing one field.

PRBSetPhysical resource block (PRB) indices occupied by the PRACH preamble for the PUSCH (0-based)


[1] 3GPP TS 38.211. “NR; Physical channels and modulation.” 3rd Generation Partnership Project; Technical Specification Group Radio Access Network.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2020a

expand all

See Also