Main Content




[seq,cinit] = nrPRBS(cinit,n) returns the elements specified by n of the pseudorandom binary sequence (PRBS) generator, when initialized with cinit. The function implements the generator specified in TS 38.211 Section 5.2.1 [1]. For uniformity with the channel-specific PRBS functions, the function also returns the initialization value cinit.

[seq,cinit] = nrPRBS(cinit,n,Name,Value) specifies additional output formatting options by using one or more name-value pair arguments. Unspecified options take their default values.


collapse all

Generate a 1000-bit binary scrambling sequence. Initialize the PRBS generator with the specified value.

cinit = 9;
prbs = nrPRBS(cinit,1000);

Input Arguments

collapse all

Initialization value for the PRBS generator, specified as an integer from 0 to 231 – 1.

Data Types: double

Elements in returned sequence, specified as one of these values:

  • Nonnegative integer — seq contains the first n elements of the PRBS generator.

  • [p m] row vector — seq contains m contiguous elements of the PRBS generator, starting at position p (0-based).

Data Types: double

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: 'MappingType','signed' specify non-default sequence formatting properties.

Output sequence formatting, specified as the comma-separated pair consisting of 'MappingType' and one of these values:

  • 'binary' — This value maps true to 1 and false to 0. The data type of the output sequence is logical.

  • 'signed' — This value maps true to –1 and false to 1. The data type of the output sequence is double. To specify single data type, use the 'OutputDataType' name-value pair.

Data Types: char | string

Data type of output sequence, specified as the comma-separated pair consisting of 'OutputDataType' and 'double' or 'single'. This name-value pair applies only when 'MappingType' is set to 'signed'.

Data Types: char | string

Output Arguments

collapse all

Pseudorandom scrambling sequence, returned as a logical or numeric column vector. The output seq contains the elements of the PRBS generator specified by n. If you set 'MappingType' to 'signed', the data type of seq is either double or single. If you set 'MappingType' to 'binary', the output data type is logical.

Data Types: double | single | logical


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

Extended Capabilities

Version History

Introduced in R2018b

See Also