MATLAB Examples

WLAN Link Modeling in Simulink

This example shows how to simulate an IEEE® 802.11n™ HT link in Simulink® with WLAN System Toolbox™.



An 802.11n HT [ 1 ] link with a fading channel is simulated in this model. Multiple packets are transmitted through a 2-by-2 TGn MIMO channel, demodulated and the PSDUs recovered. The PSDUs are compared to those transmitted to determine the packet error rate. Packet detection, timing synchronization, carrier frequency offset correction and pilot phase tracking are performed by the receiver.

The MATLAB Function block allows MATLAB® functions to be used in a Simulink model. In this example an 802.11n link is modeled in Simulink by using MATLAB Function blocks to call WLAN System Toolbox functions. For an equivalent 802.11n simulation in MATLAB see the example 802.11n Packet Error Rate Simulation for 2x2 TGn Channel.

Structure of the Example

The model has four main parts:

  • Transmitter: Generates a random PSDU and creates an 802.11n HT packet.
  • Channel: Models a TGn 2x2 MIMO channel with AWGN.
  • Receiver: Recovers the transmitted PSDU by performing packet detection, time and frequency synchronization, MIMO channel estimation and PSDU demodulation and decoding.
  • Analysis: Compares the transmitted and recovered PSDUs to determine the packet error rate, and displays the equalized symbols.

The following sections describe the transmitter and receiver in more detail.


The Transmitter block creates a random PSDU and encodes the bits to create a single packet waveform. The function wlanWaveformGenerator is called within the Packet Generator block to generate a waveform for a packet. An idle period is added after each packet to create periodic bursts.


The receiver has two components: packet detection and packet recovery.

The function wlanPacketDetect is called within the Packet Detector block. If a packet is detected the Packet Recovery subsystem is enabled to process the detected packet.

The Packet Recovery subsystem processing consists of the following steps:

  1. Coarse carrier frequency offset is estimated and corrected.
  2. Fine timing synchronization is established.
  3. Fine carrier frequency offset is estimated and corrected.
  4. The L-LTF is extracted from the synchronized received waveform, demodulated and the noise power estimated.
  5. The HT-LTF is extracted from the synchronized received waveform. The HT-LTF is OFDM demodulated and channel estimation is performed.
  6. The HT Data field is extracted from the synchronized received waveform and the PSDU is recovered using the extracted field, the channel and noise power estimates.

Results and Displays

When the simulation is run, the packet error rate is displayed. This is updated after each packet is processed. The equalized data symbols are also displayed for each packet processed. By default, 200 packets are simulated.

Exploring the Example

Try changing the signal to noise ratio (SNR) in the AWGN channel block. Decreasing the SNR increases the packet error rate and the noise visible in the equalized symbol constellation. Link parameters such as the modulation and coding scheme (MCS), number of transmit and receive antennas and space-time streams can be changed in the Model Parameters block.

Selected Bibliography

  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.