Skip to content

DianaC01/xor-in-the-air

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

XOR in the Air – Cooperative Transmission Simulation πŸ“‘

MATLAB simulation of a cooperative wireless system implementing Network Coding (XOR in the Air).
The project compares Simple Forwarding vs Network Coding (XOR) under IEEE 802.11g-like settings, and reports transmission time and packet loss.


🧠 Theory (Short Overview)

Wireless links often suffer from collisions and losses when multiple nodes transmit. In a classic three-node setup (Alice β†’ Relay β†’ Bob), the relay can operate in two ways:

1) Simple Forwarding

  • The relay retransmits each packet separately (Aβ†’R then Rβ†’B; and Bβ†’R then Rβ†’A).
  • Pros: straightforward, robust.
  • Cons: 4 transmissions per bidirectional exchange β†’ lower spectral efficiency.

2) Network Coding – β€œXOR in the Air”

  • The relay combines packets from Alice and Bob using bitwise XOR: Pxor = PA βŠ• PB.
  • It broadcasts one coded packet instead of two.
  • Alice and Bob decode the other’s data by XOR-ing with their own packet.
  • Effect: reduces transmissions from 4 β†’ 3 per full exchange β†’ higher efficiency.
  • Trade-off: if either of the two upstream packets is lost, the coded transmission cannot proceed.

Loss & Retransmissions

  • Each link may lose packets with probability p (here 10%).
  • Every failed transmission is retried up to 3 times; after that the packet is counted as lost.

πŸ§ͺ Simulation Setup

  • Standard: IEEE 802.11g-like channel
  • Channel capacity: 54 Mbps
  • Packet size: 1024 bits
  • Trials: 100 bidirectional exchanges
  • Loss probability: 10% per link attempt
  • Max retries: 3 per hop

πŸ“Š Results (from the report)

Metric Simple Forwarding Network Coding
Total transmissions 447 322
Lost packets 0 31
Transmission time (sec.) 0.008476 0.006106

Takeaways

  • XOR coding reduces transmissions and lowers time.
  • It may experience higher losses.
  • Choice depends on efficiency vs robustness requirements.

πŸ“‚ Project Structure

xor-in-the-air/
β”œβ”€ src/Proiect_CasuneanuDiana.mlx   # MATLAB Live Script
β”œβ”€ results/                         # optional: export plots/tables
β”œβ”€ README.md
└─ .gitignore

▢️ How to Run

  1. Open MATLAB (R2020+ recommended).
  2. Load src/Proiect_CasuneanuDiana.mlx.
  3. Run the Live Script to simulate both modes.
  4. Export plots/tables into results/ if needed.

πŸ”– Suggested Topics

matlab, network-coding, xor-in-the-air, wireless-networks, simulation, computer-networks

Releases

No releases published

Packages

 
 
 

Contributors