Main Content

nrPUSCHScramble

Perform PUSCH scrambling

Description

scrambled = nrPUSCHScramble(cw,nid,rnti) returns scrambled codewords resulting from physical uplink shared channel (PUSCH) scrambling, as defined in TS 38.211 Section 6.3.1.1 [1]. cw is one or two uplink shared channel (UL-SCH) codewords, as described in TS 38.212 Section 6.2.7 [2]. nid is the scrambling identity, and rnti is the radio network temporary identifier (RNTI) of the user equipment (UE).

example

scrambled = nrPUSCHScramble(cw,nid,rnti,nrapid) specifies random access preamble index nrapid to initialize the scrambling sequence for msgA on the PUSCH, as defined in Release 16 of TS 38.211 Section 6.3.1.1.

When cw is a cell array of two UL-SCH codewords, the function ignores nrapid. (since R2024a)

Examples

collapse all

Create a random sequence of binary values corresponding to a codeword containing 5000 bits.

cw = randi([0 1],5000,1)
cw = 5000×1

     1
     1
     0
     1
     1
     0
     0
     1
     1
     1
      ⋮

Perform PUSCH scrambling initialized with the specified physical layer cell identity number and RNTI.

ncellid = 42;
rnti = 101;
scrambled = nrPUSCHScramble(cw,ncellid,rnti)
scrambled = 5000x1 logical array

   0
   1
   1
   1
   1
   0
   1
   0
   0
   1
      ⋮

Input Arguments

collapse all

UL-SCH codewords from TS 38.212 Section 6.2.7, specified as a column vector representing one UL-SCH codeword or a cell array of one or two column vectors representing one or two UL-SCH codewords. The vector elements must be integers from –2 to 1.

  • 0 and 1 represent false and true bit values, respectively.

  • –1 and –2 represent x and y placeholders in the uplink control information (UCI), respectively. For more details, see TS 38.212 Sections 5.3.3.1 and 5.3.3.2.

Data Types: double | int8

Scrambling identity, specified as an integer from 0 to 1023. nid is higher layer parameter dataScramblingIdentityPUSCH, ranging from 0 to 1023, if the higher layer parameter is configured. Otherwise, nid is physical layer cell identity number NCellID, ranging from 0 to 1007. For more information, see TS 38.211 Section 6.3.1.1.

Data Types: double

RNTI of the UE, specified as an integer from 0 to 65,535.

Data Types: double

Random access preamble index, specified as one of these values.

  • [] — Use this value to indicate that the scrambling initialization does not consider msgA on PUSCH.

  • Integer from 0 to 63 — Use this value to initialize the scrambling sequence for msgA on PUSCH, as defined in Release 16 of TS 38.211 Section 6.3.1.1.

Data Types: double

Output Arguments

collapse all

Scrambled UL-SCH codewords, returned as one of these values:

  • Logical column vector — The function only returns this value when the cw input is a column vector.

  • Cell array of one or two logical column vectors — The function only returns this value when the cw input is a cell array of one or two column vectors, respectively. (since R2024a)

Data Types: logical

References

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

[2] 3GPP TS 38.212. “NR; Multiplexing and channel coding.” 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 R2019a

expand all

See Also

Functions