# 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.

# wlanWaveformGenerator

Generate WLAN waveform

## Syntax

``waveform = wlanWaveformGenerator(bits,cfgFormat)``
``waveform = wlanWaveformGenerator(bits,cfgFormat,Name,Value)``

## Description

example

````waveform = wlanWaveformGenerator(bits,cfgFormat)` generates a waveform for the specified information bits, and format configuration. For more information, see IEEE 802.11 PPDU Format.```

example

````waveform = wlanWaveformGenerator(bits,cfgFormat,Name,Value)` overrides default generator configuration values using one or more `Name,Value` pair arguments.```

## Examples

collapse all

Generate a time-domain signal for an 802.11ac VHT transmission with one packet.

Create the format configuration object, `vht`. Assign two transmit antennas and two spatial streams, and disable STBC. Set the MCS to `1`, which assigns QPSK modulation and a 1/2 rate coding scheme per the 802.11 standard. Set the number of bytes in the A-MPDU pre-EOF padding, `APEPLength`, to `1024`.

```vht = wlanVHTConfig; vht.NumTransmitAntennas = 2; vht.NumSpaceTimeStreams = 2; vht.STBC = false; vht.MCS = 1; vht.APEPLength = 1024; ```

Generate the transmission waveform.

```bits = [1;0;0;1]; txWaveform = wlanWaveformGenerator(bits,vht); ```

Configure `wlanWaveformGenerator` to produce a time-domain signal for an 802.11ac VHT transmission with five packets and a 30 microsecond idle period between packet. Use a random scrambler initial state for each packet.

Create a VHT configuration object and confirm the channel bandwidth for scaling the x-axis of the plot.

```vht = wlanVHTConfig; vht.ChannelBandwidth ```
```ans = 'CBW80' ```

Generate and plot the waveform. Display the time in microseconds on the x-axis.

```numPkts = 5; scramInit = randi([1 127],numPkts,1); txWaveform = wlanWaveformGenerator([1;0;0;1],vht,'NumPackets',numPkts,'IdleTime',30e-6,'ScramblerInitialization',scramInit); time = [0:length(txWaveform)-1]/80e-6; plot(time,abs(txWaveform)) xlabel ('Time (microseconds)') ylabel('Amplitude') ```

Five packets separated by 30 microsecond idle periods.

## Input Arguments

collapse all

Information bits for a single user, including any MAC padding representing multiple concatenated PSDUs, specified as a binary vector stream. Internally, the input `bits` vector is looped as required to generate the specified number of packets. The property `cfgFormat``.``PSDULength` specifies the number of data bits taken from the bit stream for each transmission packet generated. The property `NumPackets` specifies the number of packets to generate.

• When `bits` is a cell array, each element of the cell array must be a `double` or `int8` typed binary vector.

• When `bits` is a vector or scalar cell array, the specified bits apply to all users.

• When `bits` is a vector cell array, each element applies to each user correspondingly. For each user, if the number of bits required across all packets of the generation exceeds the length of the vector provided, the applied bit vector is looped. Looping on the bits allows you to define a short pattern, for example. `[1;0;0;1]`, that is repeated as the input to the PSDU coding across packets and users. In each packet generation, for the ith user, the ith element of the `cfgFormat`.`PSDULength` indicates the number of data bytes taken from its stream. Multiple `PSDULength` by eight to compute the number of bits

Example: `[1 1 0 1 0 1 1]`

Data Types: `double` | `int8`

Packet format configuration, specified as a `wlanDMGConfig`, `wlanS1GConfig`, `wlanVHTConfig`, `wlanHTConfig`, or `wlanNonHTConfig` object. The type of `cfgFormat` object determines the IEEE® 802.11™ format of the generated waveform. For a description of the properties and valid settings for the various packet format configuration objects, see:

The data rate and PSDU length of generated PPDUs is determined based on the properties of the packet format configuration object.

Specify optional comma-separated pairs of `Name,Value` arguments. `Name` is the argument name and `Value` is the corresponding value. `Name` must appear inside single quotes (`' '`). You can specify several name and value pair arguments in any order as `Name1,Value1,...,NameN,ValueN`.

Example: `'NumPackets',21,'ScramblerInitialization',[52,17]`

Number of packets to generate in a single function call, specified as a positive integer.

Data Types: `double`

Idle time added after each packet, specified as a nonnegative scalar in seconds. The default value is 0. If `IdleTime` is not set to the default value, it must be:

• ≥ 1e-06 seconds for DMG format

• ≥ 2e-06 seconds for VHT, HT-mixed, non-HT formats

Example: `20e-6`

Data Types: `double`

Initial scrambler state of the data scrambler for each packet generated, specified as an integer from 1 to 127, or as an NP-by-NUsers matrix of integers with values from 1 to 127. NP is the number of packets, and NUsers is the number of users.

The default value of 93 is the example state given in IEEE Std 802.11-2012 [1], Section L.1.5.2 and applies for S1G, VHT, HT, and Non-HT OFDM formats. For the DMG format, specifying `ScramblerInitialization` with `wlanWaveformGenerator` overrides the value specified by the `wlanDMGConfig` configuration object. For more information, see Scrambler Initialization.

• When specified as a scalar, the same scrambler initialization value is used to generate each packet for each user of a multipacket waveform.

• When specified as a matrix, each element represents an initial state of the scrambler for packets in the multipacket waveform generated for each user. Each column specifies the initial states for a single user, therefore up to four columns are supported. If a single column is provided, the same initial states are used for all users. Each row represents the initial state of each packet to generate. Therefore, a matrix with multiple rows enables you to use a different initial state per packet, where the first row contains the initial state of the first packet. If the number of packets to generate exceeds the number of rows of the matrix provided, the rows are looped internally.

### Note

`ScramblerInitialization` is not valid for non-HT DSSS.

Example: `[3 56 120]`

Data Types: `double` | `int8`

Duration of the window transition applied to each OFDM symbol, specified in seconds as a nonnegative scalar. No windowing is applied if `WindowTransitionTime` = 0. The default and maximum value permitted is shown for the various formats, type of guard interval, and channel bandwidth.

Maximum Permitted `WindowTransitionTime` (seconds)
DMGS1GVHTHT-mixednon-HT
2640 MHz1, 2, 4, 8, or 16 MHz20, 40, 80, or 160 MHz20 or 40 MHz20 MHz10 MHz5 MHz
Default6.0606e-09

(= 16/2640e6)

1.0e-071.0e-071.0e-071.0e-071.0e-071.0e-07
Maximum9.6969e-08

(= 256/2640e6)

Maximum Permitted for Long Guard Interval 1.6e-051.6e-061.6e-061.6e-063.2e-066.4e-06
Maximum Permitted for Short Guard Interval 8.0e-068.0e-078.0e-07

Data Types: `double`

## Output Arguments

collapse all

Packetized waveform, returned as an NS-by-NT matrix. NS is the number of time-domain samples, and NT is the number of transmit antennas. `waveform` contains one or more packets of the same IEEE 802.11 PPDU Format. Each packet can contain different information bits. Waveform packet windowing is enabled by setting `WindowTransitionTime` > 0. Windowing is enabled by default.

For more information, see Waveform Sampling Rate, OFDM Symbol Windowing, and Waveform Looping.

Data Types: `double`
Complex Number Support: Yes

collapse all

### IEEE 802.11 PPDU Format

IEEE 802.11[1] [2] PPDU formats defined for transmission include VHT, HT, non-HT, S1G, and DMG. For all formats, the PPDU field structure includes preamble and data portions. The DMG format PPDU contains a header field and optional training fields.

VHT, HT-Mixed, and Non-HT Format PPDU Field Structures

Subcarrier duration varies with channel bandwidth for the legacy preamble fields.

Channel Bandwidth (MHz)Preamble Field Duration
TSHORT: L-STF DurationTLONG: L-LTF DurationTSIGNAL: Duration of the L-SIG Symbol

20, 40, 80, 160

8 μs8 μs4 μs

10

16 μs16 μs8 μs

5

32 μs32 μs16 μs

S1G Format PPDU Field Structure

In S1G, there are three transmission modes:

• ≥2-MHz long preamble mode

• ≥2-MHz short preamble mode

• 1-MHz mode

Each transmission mode has a specific PPDU preamble structure:

• An S1G ≥2-MHz long preamble mode PPDU supports single-user and multi-user transmissions. The long preamble PPDU consists of two portions; the omni-directional portion and the beam-changeable portion.

• The omni-directional portion is transmitted to all users without beamforming. It consists of three fields:

• The short training field (STF) is used for coarse synchronization.

• The long training field (LTF1) is used for fine synchronization and initial channel estimation.

• The signal A field (SIG-A) is decoded by the receiver to determine transmission parameters relevant to all users.

• The data portion can be beamformed to each user. It consists of four fields:

• The beamformed short training field (D-STF) is used by the receiver for automatic gain control.

• The beamformed long training fields (D-LTF-N) are used for MIMO channel estimation.

• The signal B field (SIG-B) in a multi-user transmission, signals the MCS for each user. In a single-user transmission, the MCS is signaled in the SIG-A field of the omni-directional portion of the preamble. Therefore, in a single-user transmission the SIG-B symbol transmitted is an exact repetition of the first D-LTF. This repetition allows for improved channel estimation.

• The data field is variable in length. It carries the user data payload.

• An S1G ≥2-MHz short preamble mode PPDU supports single-user transmissions. All fields in the PPDU can be beamformed.

The PPDU consists of these five fields:

• The short training field (STF) is used for coarse synchronization.

• The first long training field (LTF1) is used for fine synchronization and initial channel estimation.

• The signaling field (SIG) is decoded by the receiver to determine transmission parameters.

• The subsequent long training fields (LTF2-N) are used for MIMO channel estimation. NSYMBOLS = 1 per subsequent LTF

• The data field is variable in length. It carries the user data payload.

• An S1G 1-MHz mode PPDU supports single-user transmissions. It is composed of the same five fields as the S1G ≥2-MHz short preamble mode PPDU and all fields can be beamformed. An S1G 1-MHz mode PPDU has longer STF, LTF1, and SIG fields so this narrower bandwidth mode can achieve sensitivity that is similar to the S1G ≥2-MHz short preamble mode transmissions.

DMG Format PPDU Field Structure

In DMG, there are three physical layer (PHY) modulation schemes supported: control, single carrier, and OFDM.

The single-carrier chip timing, TC = 1/FC = 0.57 ns. For more information, see Waveform Sampling Rate.

The supported DMG format PPDU field structures each contain these fields:

• The preamble contains a short training field (STF) and channel estimation field (CEF). The preamble is used for packet detection, AGC, frequency offset estimation, synchronization, indication of modulation type (Control, SC, or OFDM), and channel estimation. The format of the preamble is common to the Control, SC, and OFDM PHY packets.

• The STF is composed of Golay Ga sequences as specified in 802.11ad™-2012 [2], Section 21.3.6.2.

• The CEF is composed of Golay Gu and Gv sequences as specified in 802.11ad-2012 [2], Section 21.3.6.3.

• When the header and data fields of the packet are modulated using a single carrier (control PHY and SC PHY), the Golay sequencing for the CEF waveform is shown in 802.11ad-2012 [2], Figure 21-5.

• When the header and data fields of the packet are modulated using OFDM (OFDM PHY), the Golay sequencing for the CEF waveform is shown in 802.11ad-2012 [2], Figure 21-6.

• The header field is decoded by the receiver to determine transmission parameters.

• The data field is variable in length. It carries the user data payload.

• The training fields (AGC and TRN-R/T subfields) are optional. They can be included to refine beamforming.

IEEE 802.11ad-2012 [2] specifies the common aspects of the DMG PPDU packet structure in Section 21.3. The PHY modulation-specific aspects of the packet structure are specified in these sections:

• The DMG control PHY packet structure is specified in Section 21.4.

• The DMG OFDM PHY packet structure is specified in Section 21.5.

• The DMG SC PHY packet structure is specified in Section 21.6.

### Waveform Sampling Rate

At the output of `wlanWaveformGenerator`, the generated waveform has a sampling rate equal to the channel bandwidth.

For all VHT, HT, and non-HT format OFDM modulation, the channel bandwidth is configured via the `ChannelBandwidth` property of the format configuration object.

For the DMG format modulation schemes, the channel bandwidth is always 2640 MHz and the channel spacing is always 2160 MHz These values are specified in IEEE 802.11ad-2012 [2], Section 21.3.4 and Annex E-1, respectively.

For the non-HT format DSSS modulation scheme, the chipping rate is always 11 MHz, as specified in IEEE 802.11-2012[1], Section 17.1.1.

This table indicates the waveform sampling rates associated with standard channel spacing for each configuration format prior to filtering.

Configuration Object

`Modulation`

`ChannelBandwidth`

Channel Spacing (MHz)

Sampling Rate (MHz)

(FS, FC)

`wlanDMGConfig`

Control PHY

For DMG, the channel bandwidth is fixed at 2640 MHz.

2160

FC = ⅔ FS = 1760

SC

OFDM

FS = 2640

`wlanS1GConfig`

OFDM

`'CBW1'`

1

FS = 1

`'CBW2'`

2

FS = 2

`'CBW4'`

4

FS = 4

`'CBW8'`

8

FS = 8

`'CBW16'`

16

FS = 16

`wlanVHTConfig`

OFDM

`'CBW20'`

20

FS = 20

`'CBW40'`

40

FS = 40

`'CBW80'`

80

FS = 80

`'CBW160'`

160

FS = 160

`wlanHTConfig`

OFDM

`'CBW20'`

20

FS = 20

`'CBW40'`

40

FS = 40

`wlanNonHTConfig`

DSSS/CCK

Not applicable

11

FC = 11

OFDM

`'CBW5'`

5

FS = 5

`'CBW10'`

10

FS = 10

`'CBW20'`

20

FS = 20

FS is the OFDM sampling rate.

FC is the chip rate for single carrier, control PHY, and DSSS/CCK modulations.

### OFDM Symbol Windowing

OFDM naturally lends itself to processing with Fourier transforms. A negative side effect of using an IFFT to process OFDM symbols is the resulting symbol-edge discontinuities. These discontinuities cause out-of-band emissions in the transition region between consecutive OFDM symbols. To smooth the discontinuity between symbols and reduce the intersymbol out-of-band emissions, you can use the `wlanWaveformGenerator` function to apply OFDM symbol windowing. To apply windowing, set `WindowTransitionTime` to greater than zero.

When windowing is applied, transition regions are added to the leading and trailing edge of the OFDM symbol by the `wlanWaveformGenerator`. Windowing extends the length of the OFDM symbol by `WindowTransitionTime` (TTR).

The extended waveform is windowed by pointwise multiplication in the time domain, using the windowing function specified in IEEE Std 802.11-2012 [1], Section 18.3.2.5:

`${w}_{\text{T}}\left(t\right)=\left\{\begin{array}{c}{\mathrm{sin}}^{2}\left(\frac{\pi }{2}\left(0.5+\frac{t}{{T}_{\text{TR}}}\right)\right)\text{}\left(-{T}_{\text{TR}}}{2}`
The windowing function applies over the leading and trailing portion of the OFDM symbol:

• TTR/2 to TTR/2

• T – TTR/2 to T + TTR/2

After windowing is applied to each symbol, pointwise addition is used to combine the overlapped regions between consecutive OFDM symbols. Specifically, the trailing shoulder samples at the end of OFDM symbol 1 (T – TTR/2 to T + TTR/2) are added to the leading shoulder samples at the beginning of OFDM symbol 2 (–TTR/2 to TTR/2).

Smoothing the overlap between consecutive OFDM symbols in this manner reduces the out-of-band emissions. `wlanWaveformGenerator` applies OFDM symbol windowing between:

• Each OFDM symbol within a packet

• Consecutive packets within the waveform, considering the `IdleTime` between packets

• The last and the first packet of the generated waveform

Windowing DMG Format Packets

For DMG format, windowing is only applicable to packets transmitted using the OFDM PHY and is applied only to the OFDM modulated symbols. For OFDM PHY, only the header and data symbols are OFDM modulated. The preamble (STF and CEF) and the training fields are single carrier modulated and are not windowed. Similar to the out of band emissions experienced by consecutive OFDM symbols, as shown here the CEF and the first training subfield are subject to a nominal amount out of band emissions from the adjacent windowed OFDM symbol.

For more information on how `wlanWaveformGenerator` handles windowing for the consecutive packet `IdleTime` and for the last waveform packet, see Waveform Looping.

### Waveform Looping

To produce a continuous input stream, you can have your code loop on a waveform from the last packet back to the first packet.

Applying windowing to the last and first OFDM symbols of the generated waveform smooths the transition between the last and first packet of the waveform. When `WindowTransitionTime` is greater than zero, `wlanWaveformGenerator` applies OFDM Symbol Windowing.

When looping a waveform, the last symbol of packet_N is followed by the first OFDM symbol of packet_1. If the waveform has only one packet, the waveform loops from the last OFDM symbol of the packet to the first OFDM symbol of the same packet.

When windowing is applied to the last OFDM symbol of a packet and the first OFDM of the next packet, the idle time between the packets factors into the windowing applied. Specify the idle time using the `IdleTime` property of `wlanWaveformGenerator`.

• If `IdleTime` is zero, OFDM Symbol Windowing is applied as it would be for consecutive OFDM symbols within a packet.

• If the `IdleTime` is nonzero, the extended windowed portion of the first OFDM symbol in packet_1 (from –TTR/2 to 0–TS), is included at the end of the waveform. This extended windowed portion is applied for looping when computing the OFDM Symbol Windowing between the last OFDM symbol of packet_N and the first OFDM symbol of packet_1. TS is the sample time.

Looping DMG Format Waveforms

For DMG format waveforms there are three looping scenarios,

• The looping behavior for a waveform composed of DMG OFDM-PHY packets with no training subfields is similar to the general case outlined in Waveform Looping but the first symbol of the waveform (and each packet) is not windowed.

• If `IdleTime` is zero for the waveform, the windowed portion (from T to T + TTR/2) of the last data symbols is added to the start of the STF field.

• If `IdleTime` is non-zero for the waveform, the `IdleTime` is appended at the end of the windowed portion (after T + TTR/2) of the last OFDM symbol.

• When a waveform composed of DMG OFDM-PHY packets includes training subfields, no windowing is applied to the single carrier modulated symbols the end of the waveform. The last sample of the last training subfield is followed by the first STF sample of the first packet in the waveform.

• If `IdleTime` is zero for the waveform, there is no overlap.

• If `IdleTime` is nonzero for the waveform, the value specifies the delay between the last sample of packet_N and the first sample of in packet_1.

• When a waveform is composed of DMG-SC or DMG-Control PHY packets, the end of the waveform is single carrier modulated, so no windowing is applied to the last waveform symbol. The last sample of the last training subfield is followed by the first STF sample of the first packet in the waveform.

• If `IdleTime` is zero for the waveform, there is no overlap.

• If `IdleTime` is nonzero for the waveform, the value specifies the delay between the last sample of packet_N and the first sample of in packet_1.

### Note

The same looping behavior applies for a waveform composed of DMG OFDM-PHY packets with training subfields, DMG-SC PHY packets, or DMG-Control PHY packets.

### Scrambler Initialization

The scrambler initialization used on the transmission data follows the process described in IEEE Std 802.11-2012, Section 18.3.5.5 and IEEE Std 802.11ad-2012, Section 21.3.9. 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 (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:

Conversion from integer to bits uses left-MSB orientation. For the initialization of the scrambler with decimal `1`, the bits are mapped to the elements shown.

ElementX7X6X5X4X3X2X1
Bit Value0000001

To generate the bit stream equivalent to a decimal, use `de2bi`. For example, for decimal `1`:

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

## References

[1] IEEE Std 802.11™-2012 IEEE Standard for Information technology — Telecommunications and information exchange between systems — Local and metropolitan area networks — Specific requirements — Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.

[2] IEEE Std 802.11ad™-2012 IEEE Standard for Information technology — Telecommunications and information exchange between systems — Local and metropolitan area networks — Specific requirements — Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications — Amendment 3: Enhancements for Very High Throughput in the 60 GHz Band.