Documentation

wlanScramble

Scramble and descramble binary input sequence

Syntax

y = wlanScramble(bits,scramInit)

Description

example

y= wlanScramble(bits,scramInit)scrambles or descrambles the binary inputbitsfor the specified initial scramble state, using a 127-length frame-synchronous scrambler. The frame-synchronous scrambler uses the generator polynomial defined in IEEE®802.11™-2012, Section 18.3.5.5 and IEEE 802.11ad™-2012, Section 21.3.9. The same scrambler is used to scramble bits at the transmitter and descramble bits at the receiver.

Examples

collapse all

Create the scrambler initialization and the input sequence of random bits.

scramInit = 93; bits = randi([0,1],1000,1);

Scramble and descramble the bits by using the scrambler initialization.

scrambledData = wlanScramble(bits,scramInit); descrambledData = wlanScramble(scrambledData,scramInit);

Verify that the descrambled data matches the original data.

isequal(bits,descrambledData)
ans =logical1

Input Arguments

collapse all

Input sequence to be scrambled, specified as a binary column vector or matrix.

Data Types:double|int8

Initial state of the scrambler, specified as an integer from 1 to 127, or a corresponding 7-by-1 column vector of binary bits.

在传输数据上使用的加扰器初始化遵循IEEE STD 802.11-2012,第18.3.5.5节和IEEE STD 802.11ad-2012,第21.3.9节中描述的过程遵循该过程。遵循扰扰器初始化字段(包括数据填充位)的标题和数据字段通过XORING COUNT-127周期序列XORINGEN-127周期性序列进行扰乱S(x)=x7+x4+1. The octets of the PSDU (Physical Layer Service Data Unit) are placed into a bit stream, and within each octet, bit 0 (LSB) is first and bit 7 (MSB) is last. The generation of the sequence and the XOR operation are shown in this figure:

从整数转换为位使用左侧MSB方向。用十进制初始化扰码器1, the bits are mapped to the elements shown.

Element X7 X6 X5 X4 X3 X2 X1
Bit Value 0 0 0 0 0 0 1

To generate the bit stream equivalent to a decimal, usede2bi. For example, for decimal1:

de2bi(1,7,'left-msb') ans = 0 0 0 0 0 0 1

SamescramInitis applied across all the columns ofbitswhen the input is a matrix.

Example:(0 0 0 0 0 0 1)”

Data Types:double

Output Arguments

collapse all

Scrambled or descrambled output, returned as a binary column vector or matrix with the same size and type asbits.

Extended Capabilities

Introduced in R2017b

Was this topic helpful?