Scramble and descramble binary input sequence
scrambles or descrambles the binary input
y = wlanScramble(
bits for 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 184.108.40.206 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.
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.
ans = logical 1
bits— Input sequence
Input sequence to be scrambled, specified as a binary-valued column vector or matrix.
scramInit— Initial scrambler state
Initial scrambler state, specified as an integer in the interval [1, 127], or the corresponding binary-valued column vector of length 7.
Section 220.127.116.11 of  specifies the scrambling and descrambling process applied to the transmitted data. The header and data fields that follow the scrambler initialization field (including data padding bits) are scrambled by XORing each bit with a length-127 periodic sequence generated by the polynomial S(x) = x7+x4+1. The octets of the PSDU are placed into a bit stream, and, within each octet, bit 0 (LSB) is first and bit 7 (MSB) is last. This figure demonstrates the sequence generation and XOR operation.
Conversion from integer to bits uses left-MSB orientation.
For the initialization of the scrambler with decimal
the bits are mapped to the elements shown.
To generate the bit stream equivalent to a decimal, use the
de2bi function. For example,
for the decimal
de2bi(1,7,'left-msb') ans = 0 0 0 0 0 0 1
[1; 0; 1; 1; 1; 0; 1] conveys the scrambler
initialization state of 93 as a binary-valued columnm vector.