Generate WLAN waveform
generates a waveform for waveform
= wlanWaveformGenerator(bits
,cfg
)bits
, the specified information bits,
and cfg
, the physical layer (PHY) format configuration. For
more information, see IEEE 802.11 PPDU Format.
specifies additional options using one or more namevalue pair arguments.waveform
= wlanWaveformGenerator(bits
,cfg
,Name,Value
)
Configure and generate a WLAN waveform containing an HE TB uplink packet.
Create a configuration object for a WLAN HE TB uplink transmission.
cfgHETB = wlanHETBConfig;
Obtain the PSDU length, in bytes, from the configuration object by using the getPSDULength
object function.
psduLength = getPSDULength(cfgHETB);
Generate a PSDU of the relevant length.
psdu = randi([0 1],8*psduLength,1);
Generate and plot the waveform.
waveform = wlanWaveformGenerator(psdu,cfgHETB); figure; plot(abs(waveform)); title('HE TB Waveform'); xlabel('Time (nanoseconds)'); ylabel('Amplitude');
Generate a timedomain signal for an 802.11ac VHT transmission with one packet.
Create a VHT configuration object. Assign two transmit antennas and two spatial streams, and disable spacetime block coding (STBC). Set the modulaltion and coding scheme 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 AMPDU preEOF padding, APEPLength
, to 1024
.
cfg = wlanVHTConfig('NumTransmitAntennas',2,'NumSpaceTimeStreams',2,'STBC',0,'MCS',1,'APEPLength',1024);
Generate the transmit waveform.
bits = [1;0;0;1]; txWaveform = wlanWaveformGenerator(bits,cfg);
HE MUMIMO Configuration With SIGB Compression
Generate a full bandwidth HE MUMIMO configuration at 20 MHz bandwidth with SIGB compression. All three users are on a single content channel, which includes only the user field bits.
cfgHE = wlanHEMUConfig(194); cfgHE.NumTransmitAntennas = 3;
Create PSDU data for all users.
psdu = cell(1,numel(cfgHE.User)); psduLength = getPSDULength(cfgHE); for j = 1:numel(cfgHE.User) psdu = randi([0 1],psduLength(j)*8,1,'int8'); end
Generate and plot the waveform.
y = wlanWaveformGenerator(psdu,cfgHE); plot(abs(y))
Generate a full bandwidth HE MUMIMO waveform at 80 MHz bandwidth with SIGB compression. HESIGB content channel 1 has four users. HESIGB content channel 2 has three users.
cfgHE = wlanHEMUConfig(214); cfgHE.NumTransmitAntennas = 7;
Create PSDU data for all users.
psdu = cell(1,numel(cfgHE.User)); psduLength = getPSDULength(cfgHE); for j = 1:numel(cfgHE.User) psdu = randi([0 1],psduLength(j)*8,1,'int8'); end
Generate and plot the waveform.
y = wlanWaveformGenerator(psdu,cfgHE); plot(abs(y));
HE MUMIMO Configuration Without SIGB Compression
Generate a full bandwidth HE MUMIMO configuration at 20 MHz bandwidth without SIGB compression. All three users are on a single content channel, which includes both common and user field bits.
cfgHE = wlanHEMUConfig(194); cfgHE.SIGBCompression = false; cfgHE.NumTransmitAntennas = 3;
Create PSDU data for all users.
psdu = cell(1,numel(cfgHE.User)); psduLength = getPSDULength(cfgHE); for j = 1:numel(cfgHE.User) psdu = randi([0 1],psduLength(j)*8,1,'int8'); end
Generate and plot the waveform.
y = wlanWaveformGenerator(psdu,cfgHE); plot(abs(y))
Generate an 80 MHz HE MU waveform for six users without SIGB compression. HESIGB content channel 1 has four users. HESIGB content channel 2 has two users.
cfgHE = wlanHEMUConfig([202 114 192 193]); cfgHE.NumTransmitAntennas = 6; for i = 1:numel(cfgHE.RU) cfgHE.RU{i}.SpatialMapping = 'Fourier'; end
Create PSDU data for all users.
psdu = cell(1,numel(cfgHE.User)); psduLength = getPSDULength(cfgHE); for j = 1:numel(cfgHE.User) psdu = randi([0 1],psduLength(j)*8,1,'int8'); end
Generate and plot the waveform.
y = wlanWaveformGenerator(psdu,cfgHE); plot(abs(y));
Generate a full bandwidth HE MUMIMO waveform at 80 MHz bandwidth without SIGB compression. HESIGB content channel 1 has seven users. HESIGB content channel 2 has zero users.
cfgHE = wlanHEMUConfig([214 115 115 115]); cfgHE.NumTransmitAntennas = 7;
Create PSDU data for all users.
psdu = cell(1,numel(cfgHE.User)); psduLength = getPSDULength(cfgHE); for j = 1:numel(cfgHE.User) psdu = randi([0 1],psduLength(j)*8,1,'int8'); end
Generate and plot the waveform.
y = wlanWaveformGenerator(psdu,cfgHE); plot(abs(y))
Generate a timedomain signal for an 802.11ac VHT transmission with five packets and a 30microsecond idle period between packets. Use a random scrambler initial state for each packet.
Create a VHT configuration object and confirm the channel bandwidth for scaling the xaxis of the plot.
cfg = wlanVHTConfig; disp(cfg.ChannelBandwidth)
CBW80
Generate and plot the waveform. Display the time in microseconds on the xaxis.
numPkts = 5; bits = [1;0;0;1]; scramInit = randi([1 127],numPkts,1); txWaveform = wlanWaveformGenerator(bits,cfg,'NumPackets',numPkts,'IdleTime',30e6,'ScramblerInitialization',scramInit); time = [0:length(txWaveform)1]/80e6; plot(time,abs(txWaveform)); title('Five Packets Separated by 30Microsecond Idle Periods'); xlabel ('Time (microseconds)'); ylabel('Amplitude');
bits
— Information bits0
 1
 binaryvalued vector  cell array  vector cell arrayInformation bits for a single user, including any MAC padding representing multiple concatenated PSDUs, specified as one of these values.
0
or 1
.
A binaryvalued vector.
A onebyone cell containing a binaryvalued scalar or vector– The specified bits apply to all users.
A vector cell array of binaryvalued scalars or vectors – Each
element applies to each user correspondingly. The length of this
cell array must be equal to the number of users. For each user,
if the number of bits required across all packets of the
generation exceeds the length of the vector provided, the
function loops the applied bit vector. 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 kth user, the
kth element of the
PSDULength
property of the
cfg
input indicates the number of data
bytes taken from its stream. To compute the number of bits,
multiply PSDULength
by 8.
Internally, the function loops this input to generate the specified number
of packets. The PSDULength
property of the
cfg
input specifies the number of data bits taken
from the bit stream for each transmission packet generated. The
'NumPackets'
input specifies the number of packets
to generate.
Example: [1 1 0 1 0 1 1]
Data Types: double
 int8
cfg
— Packet format configurationwlanHEMUConfig
object  wlanHESUConfig
object  wlanHETBConfig
object  wlanWURConfig
object  wlanDMGConfig
object  wlanS1GConfig
object  wlanVHTConfig
object  wlanHTConfig
object  wlanNonHTConfig
objectPacket format configuration, specified as one of these objects: wlanHEMUConfig
, wlanHESUConfig
, wlanHETBConfig
,
wlanWURConfig
,
wlanDMGConfig
, wlanS1GConfig
, wlanVHTConfig
, wlanHTConfig
, or wlanNonHTConfig
. The type of
object you specify determines the IEEE^{®}
802.11™ format of the generated waveform.
The properties of the packet format configuration object determine the data rate and PSDU length of generated PPDUs.
Specify optional
commaseparated pairs of Name,Value
arguments. Name
is
the argument name and Value
is the corresponding value.
Name
must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
'NumPackets',21,'ScramblerInitialization',[52,17]
NumPackets
— Number of packets1
(default)  positive integerNumber of packets to generate in a single function call, specified as a positive integer.
Data Types: double
IdleTime
— Idle time added after each packet0
(default)  nonnegative scalarIdle time, in seconds, added after each packet, specified as a nonnegative scalar. Except for the default value, this input must be greater than or equal to:
1e6
for DMG format
2e6
for all other formats
Example: 2e5
Data Types: double
OversamplingFactor
— Oversampling factor1
(default)  scalar greater than or equal to 1Oversampling factor, specified as a scalar greater than or equal to 1. The oversampled cyclic prefix length must be an integer number of samples. for more information about oversampling, see FFTBased Oversampling.
This argument applies only for HE, WUR, VHT, HT, nonHT, S1G, and nonHT OFDM formats.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
ScramblerInitialization
— Initial scrambler state or initial pseudorandom scrambler sequence93
(default)  integer in the interval [1, 127]  matrix of integers in the interval [1, 127]Initial scrambler state or initial pseudorandom scrambler sequence for each generated packet and each user, specified as one of these values.
An integer in the interval [1, 127] — This input
represents the initial scrambler state for all packets and
users in HE, S1G, VHT, and HT waveforms, and nonHT OFDM
waveforms with bandwidth signaling disabled. For multiuser
and multipacket waveforms, the function uses the value you
specify for all packets and users. The default value,
93
, is the example state in Section
I.1.5.2 of [2].
For more information, see Scrambler Initialization.
An integer in the interval [min,
max] — This input represents
the initial pseudorandom scrambler sequence of a nonHT
transmission with bandwidth signaling enabled, described in
Table 177 of [2]. If
you do not specify this input, the function uses the
N_{B} most
significant bits of the default value,
93
. The values of min,
max, and
N_{B} depend on
the values of the BandwidthOperation
and ChannelBandwidth
properties of the
cfg
input according to this table.
Value of
cfg . BandwidthOperation  Value of
cfg . ChannelBandwidth  Value of min  Value of max  Value of N_{B} 

'Absent'  'CBW20'  1  31  5 
'Absent'  'CBW5' ,
'CBW10' ,
'CBW40' ,
'CBW80' , or
'CBW160'  0  31  5 
'Static' or
'Dynamic'  'CBW20'  1  15  4 
'Static' or
'Dynamic'  'CBW5' ,
'CBW10' ,
'CBW40' ,
'CBW80' , or
'CBW160'  0  15  4 
A matrix of integers in the interval [1, 127], of size N_{P}byN_{Users} — Each element represents an initial state of the scrambler for each packet and for each user in VHT, S1G, and HE multiuser (MU) waveforms comprising multiple packets. Each column specifies the initial states for a single user. You can specify up to eight columns for HE MU waveforms, or up to four columns for VHT, S1G. If you specify a single column, the function uses the same initial states for all users. Each row represents the initial state of each packet to generate. 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 function loops the rows internally.
N_{P} is the number of packets.
N_{Users} is the number of users.
For DMG transmissions, specifying this argument overrides the value of
the ScramblerInitialization
property of the wlanDMGConfig
configuration
object.
Example: [3 56 120]
This argument is not valid for WUR and DSSS nonHT formats.
Data Types: double
 int8
WindowTransitionTime
— Duration of window transitionDuration, in seconds, of the window transition applied to each OFDM
symbol, specified as a nonnegative scalar. The function does not apply
windowing if you specify this input as 0
. This table
shows the default and maximum values permitted for each format, the type
of guard interval, and the channel bandwidth.
Format  Bandwidth  Permitted
WindowTransitionTime
(seconds)  

Default Value  Maximum Value  Maximum Permitted Value Based on Guard Interval Duration  
3.2 µs  1.6 µs  0.8 µs (Long)  0.4 µs (Short)  
HE SU , HE MU, and HE TB  20, 40, 80, or 160 MHz 
 Not applicable 


 Not applicable 
VHT  20, 40, 80, or 160 MHz 
 Not applicable  Not applicable  Not applicable 


HTmixed  20 or 40 MHz 
 Not applicable  Not applicable  Not applicable 


nonHT  20, 40, 80, or 160 MHz 
 Not applicable  Not applicable  Not applicable 
 Not applicable 
10 MHz  1.0e07  Not applicable  Not applicable  Not applicable 
 Not applicable  
5 MHz  1.0e07  Not applicable  Not applicable  Not applicable 
 Not applicable  
WUR  20, 40, 80 MHz 
 Not applicable  Not applicable  Not applicable  Not applicable  Not applicable 
DMG  2640 MHz 
(=

(=
 Not applicable  Not applicable  Not applicable  Not applicable 
S1G  1, 2, 4, 8, or 16 MHz 
 Not applicable  Not applicable  Not applicable 


Data Types: double
waveform
— Packetized waveformPacketized waveform, returned as an
N_{S}byN_{T}
matrix. N_{S} is the number of
timedomain samples, and N_{T} is the
number of transmit antennas. waveform
contains one or
more packets of the same PPDU format. Each packet can contain different
information bits. Enable waveform packet windowing by setting the
WindowTransitionTime
input to a positive value.
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
Supported IEEE 802.11 PPDU formats defined for transmission include HE, WUR, VHT, HT, nonHT, S1G, and DMG. For all formats, the PPDU field structure includes preamble and data portions. For a detailed description of the packet structures for the various formats supported, see WLAN PPDU Structure.
At the output of this function, the generated waveform has a sampling rate equal to the channel bandwidth.
For all HE, VHT, HT, and nonHT 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 sections 20.3.4 and E.1 of [2], respectively.
For the nonHT format DSSS modulation scheme, the chipping rate is always 11 MHz, as specified in section 16.1.1 of [2].
This table indicates the waveform sampling rates associated with standard channel spacing for each configuration format prior to filtering.
Configuration Object  Modulation Type 
 Channel Spacing (MHz)  Sampling Rate (MHz) (F_{S}, F_{C}) 

 OFDMA 
 20  F_{S} = 20 
 40  F_{S} = 40  
 80  F_{S} = 80  
 160  F_{S} = 160  
 OFDM 
 20  F_{S} = 20 
 40  F_{S} = 40  
 80  F_{S} = 80  
 160  F_{S} = 160  
 OFDM 
 20  F_{S} = 20 
 40  F_{S} = 40  
 DSSS/CCK  Not applicable  11  F_{C} = 11 
OFDM 
 5  F_{S} = 5  
 10  F_{S} = 10  
 20  F_{S} = 20  
'CBW40'  40  F_{S} = 40  
'CBW80'  80  F_{S} = 80  
'CBW160  160  F_{S} = 160  
wlanWURConfig  OFDM  'CBW20'  20  F_{S} = 20 
'CBW40'  40  F_{S} = 40  
'CBW80'  80  F_{S} = 20  
 Control PHY  For DMG, the channel bandwidth is fixed at 2640 MHz.  2160  F_{C} = ⅔ F_{S} = 1760 
SC  
OFDM  F_{S} = 2640  
 OFDM 
 1  F_{S} = 1 
 2  F_{S} = 2  
 4  F_{S} = 4  
 8  F_{S} = 8  
 16  F_{S} = 16  
F_{S} is the OFDM sampling rate. F_{C} is the chip rate for singlecarrier, control PHY, DSSS, and CCK modulations. 
OFDM naturally lends itself to processing with Fourier transforms. A negative
side effect of using an IFFT to process OFDM symbols is the resulting symboledge
discontinuities. These discontinuities cause outofband emissions in the transition
region between consecutive OFDM symbols. To smooth the discontinuity between symbols
and reduce the intersymbol outofband emissions, you can use the
wlanWaveformGenerator
function to apply OFDM symbol
windowing. To apply windowing, set the WindowTransitionTime
input to a positive value.
When windowing is applied, the function adds transition regions to the leading and trailing
edge of the OFDM symbol. Windowing extends the length of the OFDM symbol by
WindowTransitionTime
(T_{TR}).
The extended waveform is windowed by pointwise multiplication in the time domain, using this windowing function specified in section 17.3.2.5 of [2]:
$${w}_{T}(t)=\{\begin{array}{ll}{\mathrm{sin}}^{2}\left[\frac{\pi}{2}\left(\frac{1}{2}+\frac{t}{{T}_{\text{TR}}}\right)\right]\hfill & \text{if}t\in \left[\frac{{T}_{\text{TR}}}{2},\frac{{T}_{\text{TR}}}{2}\right],\hfill \\ 1\hfill & \text{if}t\in \left[\frac{{T}_{\text{TR}}}{2},T\frac{{T}_{\text{TR}}}{2}\right],\hfill \\ {\mathrm{sin}}^{2}\left[\frac{\pi}{2}\left(\frac{1}{2}+\frac{t}{{T}_{\text{TR}}}\right)\right]\hfill & \text{if}t\in \left[T\frac{{T}_{\text{TR}}}{2},T+\frac{{T}_{\text{TR}}}{2}\right].\hfill \end{array}$$
The windowing function applies over the leading and trailing portion of the OFDM symbol:
–T_{TR}/2 to T_{TR}/2
–T – T_{TR}/2 to T + T_{TR}/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 – T_{TR}/2 to T + T_{TR}/2) are added to the leading shoulder samples at the beginning of OFDM symbol 2 (–T_{TR}/2 to T_{TR}/2).
Smoothing the overlap between consecutive OFDM symbols in this manner reduces the outofband emissions. The function applies OFDM symbol windowing between:
Each OFDM symbol within a packet
Consecutive packets within the waveform, considering the idle time
IdleTime
between packets specified by the
'IdleTime'
input
The last and the first packet of the generated waveform
Windowing DMG Format Packets
For the DMG format, windowing applies only 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 outofband emissions experienced by consecutive OFDM symbols, as shown here, the CEF and the first training subfield are subject to a nominal amount of outofband emissions from the adjacent windowed OFDM symbol.
For more information on how the function handles windowing for the consecutive packet idle time and for the last waveform packet, see 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 the 'WindowTransitionTime'
input is positive,
the wlanWaveformGenerator
function 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 by using the 'IdleTime'
input to the
wlanWaveformGenerator
function.
If 'IdleTime'
is 0
, the
function applies windowing as it would be for consecutive OFDM symbols
within a packet.
Otherwise, the extended windowed portion of the first OFDM symbol in packet_1 (from –T_{TR}/2 to 0–T_{S}), is included at the end of the waveform. This extended windowed portion is applied for looping when computing the windowing between the last OFDM symbol of packet_N and the first OFDM symbol of packet_1. T_{S} is the sample time.
Looping DMG Waveforms
DMG waveforms have these three looping scenarios.
The looping behavior for a waveform composed of DMG OFDMPHY 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 0
for the waveform, the windowed portion (from
T to T +
T_{TR}/2) of the
last data symbol is added to the start of the STF
field.
Otherwise, the idle time is appended at the end of the windowed portion (after T + T_{TR}/2) of the last OFDM symbol.
When a waveform composed of DMG OFDM PHY packets includes training subfields, no windowing is applied to the singlecarrier 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 0
for the waveform, there is no overlap.
Otherwise, the value of 'IdleTime'
specifies the delay between the last sample of
packet_N and the first sample of in
packet_1.
When a waveform is composed of DMGSC or DMGControl 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 0
for the waveform, there is no overlap.
Otherwise, the value of 'IdleTime'
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 OFDMPHY packets with training subfields, DMGSC PHY packets, or DMGControl PHY packets.
An oversampled signal is a signal sampled at a frequency that is higher than the Nyquist rate. WLAN signals maximize occupied bandwidth by using small guardbands, which can pose problems for antiimaging and antialiasing filters. Oversampling increases guardband width relative to the total signal bandwidth, thereby increasing the number of samples in the signal.
This function performs oversampling by using a larger IFFT and zero pad when generating an OFDM waveform. This diagram shows the oversampling process for an OFDM waveform with N_{FFT} subcarriers comprising N_{g} guardband subcarriers on either side of N_{st} occupied bandwidth subcarriers.
The scrambler initialization used on the transmission data follows the process described in IEEE Std 802.112012, 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 length127 periodic sequence generated by the polynomial S(x) = x^{7}+x^{4}+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 shows the generation of the sequence and the XOR operation.
Conversion from integer to bits uses leftMSB orientation. For example,
initializing the scrambler with decimal 1
, the bits map to these
elements.
Element  X^{7}  X^{6}  X^{5}  X^{4}  X^{3}  X^{2}  X^{1} 

Bit Value  0  0  0  0  0  0  1 
To generate the bit stream equivalent to a decimal, use the int2bit
function.
For example, for decimal
1
:
int2bit(1,7)' ans = 0 0 0 0 0 0 1
[1] IEEE P802.11ax™/D4.1. “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 1: Enhancements for High Efficiency WLAN.” Draft Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.
[2] IEEE Std 802.112016 (Revision of IEEE Std 802.112012). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.” IEEE Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.
wlanHESUConfig
 wlanHEMUConfig
 wlanHETBConfig
 wlanWURConfig
 wlanDMGConfig
 wlanVHTConfig
 wlanHTConfig
 wlanNonHTConfig
 wlanS1GConfig
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.