# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# ltePSBCHPRBS

PSBCH pseudorandom binary scrambling sequence

## Syntax

``seq = ltePSBCHPRBS(ue,n)``
``seq = ltePSBCHPRBS(ue,n,mapping)``

## Description

example

````seq = ltePSBCHPRBS(ue,n)` returns a column vector containing the first `n` outputs of the PSBCH pseudorandom binary scrambling sequence (PRBS) for the specified UE settings structure.The scrambling sequence generated should be applied to the coded PSBCH data carried by the associated subframe. The PRBS sequence generator used is initialized with cinit = `ue`.`NSLID`. ```

example

````seq = ltePSBCHPRBS(ue,n,mapping)` specifies the format of the returned sequence through the `mapping` input.```

## Examples

collapse all

Scramble a PSBCH codeword by generating the PSBCH pseudorandom binary sequence (PRBS) and applying an exclusive OR operation on the two sequences.

Create a UE configuration structure and SL-BCH codeword. Generate the required length of the PRBS and scramble the PSBCH codeword with the PRBS sequence using `xor`.

```ue = struct('NSLID',2); codeword = lteSLBCH(ue,ones(40,1)); psbchPrbs = ltePSBCHPRBS(ue,length(codeword)); scrambled = xor(psbchPrbs,codeword); ```

Scramble PSBCH Codeword

• Create a UE configuration structure and SL-BCH codeword.

• Generate the required length of the PRBS and scramble the PSBCH codeword with the PRBS sequence using `xor`.

• Modulate the logical scrambled data.

```ue = struct('NSLID',2); codeword = lteSLBCH(ue,ones(40,1)); psbchPrbs = ltePSBCHPRBS(ue,length(codeword)); scrambled = xor(psbchPrbs,codeword); txsym = lteSymbolModulate(scrambled,'QPSK'); ```

Descramble Recovered Codeword

• Generate the PSBCH PRBS in signed form.

• Descramble a vector of noisy demodulated symbols representing a sequence of soft bits. To do so, perform a pointwise multiplication between the PRBS sequence and the recovered data.

• Compare the transmitted codeword to the recovered codeword.

```rxsym = awgn(double(txsym),30,'measured'); softdata = lteSymbolDemodulate(rxsym,'QPSK'); scramblingSeq = ltePSBCHPRBS(ue,length(softdata),'signed'); descrambled = softdata.*scramblingSeq; isequal(codeword,descrambled > 0) ```
```ans = logical 1 ```

The transmitted codeword matches the hard decision on the descrambled data.

## Input Arguments

collapse all

User equipment settings, specified as a parameter structure containing this field:

Physical layer sidelink synchronization identity, specified as an integer from 0 to 355. (${N}_{\text{ID}}^{\text{SL}}$)

Data Types: `double`

Data Types: `struct`

Number of outputs, specified as a nonnegative integer.

Data Types: `double`

Output sequence formatting, specified as `'binary'` or `'signed'`.

• `'binary'` maps `true` to 1 and `false` to 0.

• `'signed'` maps `true` to –1 and `false` to 1.

Data Types: `char`

## Output Arguments

collapse all

PSBCH pseudorandom scrambling sequence, returned as a column vector. `seq` contains the first `n` outputs of the physical sidelink broadcast channel (PSBCH) scrambling sequence.

• When `mapping` is set to `'signed'`, then `seq` is a `double` column vector.

• When `mapping` is set to `'binary'`, then `seq` is a `logical` column vector.

Data Types: `logical` | `double`