image thumbnail

IEEE 802.11b Link Layer Code for MATLAB-based SDR

version (1.99 MB) by Ram Subramanian
IEEE 802.11b standard compliant link layer code for MATLAB-based SDR


Updated 14 Dec 2016

From GitHub

View license on GitHub

LinkLayer-MATLAB-NAV-GUI is a IEEE 802.11b Standard Compliant Link Layer (PHY and MAC layer) for MATLAB-based SDR. The code is highly modular and is entirely written in MATLAB. See each file for further documentation. The default settings in the files work well with our N210s using WBX daughterboards.
The system is modeled using a finite state machine (FSM) that transitions only on the clock cycles derived from the USRP clock, allowing for slot-time synchronized operations, thereby eliminating the need for external clocks. Futhermore, the model helps create a state-action based system design, wherein the same node switches between transmitter and receiver functions.

The IEEE 802.11b PHY and MAC layer packet structure specifications is adopted in our implementation. Our approach collects all the bits in the packet in multiples of 8 octets, which forms one USRP frame. This makes it easy for us to work with the MATLAB system objects and with PHY and MAC header fields in the RTS/CTS/DATA/ACK packet that happen to have sizes that are multiples of 8 octets. Multiple USRP frames will compose the standard-compliant 802.11b packet.

DBPSK (differential binary phase shift keying) and DSSS direct sequence spread spectrum at the PHY layer and CSMA/CA (carrier sense multiple access with collision avoidance) at the MAC layer is implemented.

802.11 relies mainly on physical carrier sensing and is known to suffer from the hidden node problem. We have implemented the virtual carrier sensing in CSMA/CA using the optional IEEE 802.11 RTS/CTS exchange. RTS/CTS is known to partially solve the hidden node problem in wireless networks. The duration field in the MAC header specifies basically the time the medium will be busy. The nodes will read into the duration field and set their Network Allocation Vector (NAV) counter, which is essentially indicates how long it must defer medium access.

The consistent performance of the two node (1 DTx and 1 DRx; essentially a bi-directional link) and the three node (2 DTxs and 1 DRx) experimental results demonstrate the robustness of the system in mitigating packet collisions and enforcing fairness among nodes when accessing a common channel.

The current work provides a testbed to experiment with and enables creation of new MAC protocols starting from the fundamental IEEE 802.11b compliant standard.

This work is supported by MathWorks under the Development-Collaboration Research Grant. We would like to thank Mike McLernon and Ethem Sozer for their continued support on this project.

This code is licensed under the LGPLv3 license. Please feel free to use the code in your research and development works. We would appreciate a citation to the paper below when this code is helpful in obtaining results in your future publications.

Publication for citation:
R. Subramanian, B. Drozdenko, E. Doyle, R. Ahmed, M. Leeser and K. R. Chowdhury, "High-Level System Design of IEEE 802.11b Standard-Compliant Link Layer for MATLAB-Based SDR," in IEEE Access, vol. 4, no. , pp. 1494-1509, 2016. doi: 10.1109/ACCESS.2016.2553671

R. Subramanian, E. Doyle, B. Drozdenko, M. Leeser and K. R. Chowdhury, "State-Action Based Link Layer Design for IEEE 802.11b Compliant MATLAB-Based SDR," 2016 International Conference on Distributed Computing in Sensor Systems (DCOSS), Washington, DC, USA, 2016, pp. 193-198. doi: 10.1109/DCOSS.2016.34

Check out the Three-Node Visual Demo on YouTube:

Cite As

Ram Subramanian (2021). IEEE 802.11b Link Layer Code for MATLAB-based SDR (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.