Matlab Simulate Bluetooth Network
MathWorksOfficialCreated by MathWorks
- Skill
- Tool integration
- Science and research
- BSD-2-Clause
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides the framework for performing system-level simulations of Bluetooth networks using the Bluetooth Toolbox. It enables the modeling of various Bluetooth topologies, including BLE ACL data connections, LE Audio streams (CIS/CIG), Classic BR/EDR piconets, and coexistence scenarios with adaptive frequency hopping. The skill integrates with the wireless network simulator to allow for node configuration, traffic generation, and performance analysis through KPIs.
What it does
- Simulates BLE ACL connections and LE Audio streams like CIS/CIG.
- Models Classic BR/EDR piconets with ACL data and SCO voice links.
- Supports BLE and BR/EDR coexistence with adaptive frequency hopping.
- Configures connection parameters such as intervals, offsets, and PHY modes.
- Provides KPI tracking for throughput, latency, and packet loss rates.
- Facilitates node setup using specialized Bluetooth node objects.
When to use it
- When evaluating Bluetooth network performance at the system level.
- For simulating multi-peripheral star networks or LE Audio use cases.
- When testing connection establishment and timing in BLE GAP scenarios.
- For analyzing coexistence between different Bluetooth technologies.
- When you need to model specific Bluetooth topologies like stereo TWS or hearing aids.
Advantages
- Enables system-level performance analysis without needing full PHY-layer modeling.
- Provides pre-validated templates for common audio and data use cases.
- Allows for flexible configuration of connection parameters and channel selection.
- Supports complex multi-node topologies with specific traffic requirements.
- Integrates seamlessly with standard wireless network simulation workflows.
Usage examples
- “How do I set up a basic BLE point-to-point connection?”
- The skill provides a pattern using bluetoothLENode and configureConnection to establish an ACL link between a central and peripheral node.
- “Can I simulate LE Audio for stereo speakers?”
- Yes, the skill supports CIS configuration for LE Audio, allowing you to define ISO intervals and subevents for multi-peripheral audio streams.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/matlab/matlab-simulate-bluetooth-network/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip matlab-simulate-bluetooth-network.zip -d .agents/skills
Documentation by MathWorks
Bluetooth System-Level Simulation
Entry point for all Bluetooth system-level simulation. All Bluetooth simulations use sim = wirelessNetworkSimulator.init and follow the workflow defined in matlab-simulate-wireless-network (simulator init, traffic, mobility, instrumentation, addNodes, run).
When to Use
BLE ACL point-to-point or star network connections
LE Audio unicast with CIS/CIG (stereo speakers, hearing aids)
BLE GAP connection establishment (advertising, scanning, connection timing)
Classic BR/EDR piconets with ACL data or SCO voice
BLE + BR/EDR coexistence with adaptive frequency hopping
Any simulation using
bluetoothLENode,bluetoothNode
When Not to Use
Non-Bluetooth wireless simulations (use
matlab-simulate-wireless-networkinstead)PHY-layer or link level Bluetooth waveform generation, receiver analysis or BER analysis
Generic simulator setup, traffic models, or mobility (use
matlab-simulate-wireless-network)
Scenario → Reference Routing
| Scenario | Reference |
|---|---|
| BLE realistic connection setup (advertising, scanning, GAP) | references/ble-gap-connection.md |
| BLE point-to-point data, star network, ACL connections | references/ble-connection.md |
| LE Audio unicast (stereo speakers, hearing aids, CIS/CIG) | references/ble-cis.md |
| Classic Bluetooth earbuds, SCO voice, ACL data | references/bluetooth-bredr.md |
| BLE + BR/EDR coexistence, adaptive frequency hopping | references/bluetooth-coexistence.md |
| Capture and visualization (PCAP, IQ, event tracing, traffic viewer) | See matlab-simulate-wireless-network skill |
Node Roles
BLE (ACL, CIS):
bluetoothLENode("central"),bluetoothLENode("peripheral")BR/EDR:
bluetoothNode("central"),bluetoothNode("peripheral")— max 7 peripherals per central
Traffic Attachment Rules
addTrafficSource(sourceNode, traffic, ...):
ACL/CIS/BR/EDR:
DestinationNode=peerrequired. CIS also needsCISConfig=cfgCISOut.BR/EDR SCO: No traffic call — implicit via
SCOPacketTypein connection config.
kpi() Availability
| Topology | "throughput" | "latency" | "PLR" / "PDR" | Layer |
|---|---|---|---|---|
| BLE ACL | LL only | App only | Both LL and App | "LL" or "App" |
| BLE CIS | LL only | App only | Both LL and App | "LL" or "App" |
| BR/EDR | Baseband | — | Baseband | "Baseband" |
Connection/Configuration Setup
| Topology | Config Object | Function | Notes |
|---|---|---|---|
| BLE ACL | bluetoothLEConnectionConfig | configureConnection(cfg, central, peripheral) | Per-peripheral in loop; unique AccessAddress per connection |
| BLE CIS | bluetoothLEConnectionConfig + bluetoothLECISConfig | [~, cfgCISOut] = configureConnection(cfg, central, peripheral, CISConfig=cfgCIS) | Pass cfgCISOut to addTrafficSource(..., CISConfig=cfgCISOut) |
| BR/EDR | bluetoothConnectionConfig | configureConnection(cfg, central, peripherals) | Single call with vector of peripherals |
Common Mistakes
bluetoothNodefor BLE (or vice versa): BR/EDR =bluetoothNode, BLE =bluetoothLENodeWrong kpi Layer: BLE throughput →
"LL", BLE latency →"App", BR/EDR →"Baseband"onlyProperties locked after
run(): Node/connection properties cannot change mid-sim. UseupdateChannelListfor mid-sim channel updates.configureConnectionwith peripheral vector for BLE: Must call per-peripheral in loop (BR/EDR accepts vector)Unique
AccessAddressper connection: Each BLE connection on same central needs different AccessAddressDataRate in Kbps:
DataRate=100means 100 Kbps, not 100 bpsGeneratePacket=trueis not valid: Not applicable for network-level simulation. UseOnTime=Inffor continuous traffic.
<!-- Copyright 2026 The MathWorks, Inc. -->
Files
- ATTRIBUTION.mdAdded by AutoGineer1.1 KiB
- LICENSELicence file added by AutoGineer1.4 KiB
- SKILL.md4.7 KiB
- manifest.yaml522 B
- references/ble-cis.md5.9 KiB
- references/ble-connection.md4.9 KiB
- references/ble-gap-connection.md6.3 KiB
- references/bluetooth-bredr.md6.2 KiB
- references/bluetooth-coexistence.md5.1 KiB
references/bluetooth-coexistence.md
Bluetooth Coexistence and Adaptive Frequency Hopping
BLE and BR/EDR in the same 2.4 GHz band, with data-driven channel adaptation to mitigate interference.
Critical Rules
updateChannelList (NOT updateChannelMap)
status = updateChannelList(bleCentral, goodChannels, DestinationNode=blePeripheral);Function is
updateChannelList—updateChannelMapdoes not existDestinationNodeis required and must be a node object (not a string name)Can only be called during simulation (inside a
scheduleActioncallback)Accepts one peripheral per call — for multi-peripheral, call once per peripheral in a loop
Separate addNodes Per Technology
Mixed-type nodes cannot be concatenated:
addNodes(sim, [brCentral; brPeripherals(:)]);
addNodes(sim, [bleCentral; blePeripheral]);Mixed BLE + BR/EDR with AFH
sim = wirelessNetworkSimulator.init;
% BR/EDR piconet
brCentral = bluetoothNode("central", Position=[0 0 0], Name="BRCentral");
brPeripherals = bluetoothNode("peripheral", ...
Position=[0.3 0 0; 0 0.3 0], Name=["BRP1", "BRP2"]);
brCfg = bluetoothConnectionConfig;
brCfg.SCOPacketType = "HV3";
configureConnection(brCfg, brCentral, brPeripherals);
% BLE link (co-located for interference)
bleCentral = bluetoothLENode("central", Position=[0.1 0.1 0], Name="BLECentral");
blePeripheral = bluetoothLENode("peripheral", Position=[5 0 0], Name="BLEPeriph");
bleCfg = bluetoothLEConnectionConfig;
bleCfg.ConnectionInterval = 0.02;
bleCfg.ActivePeriod = 0.005;
configureConnection(bleCfg, bleCentral, blePeripheral);
% Traffic
brTraffic = networkTrafficOnOff(DataRate=100, PacketSize=27, OnTime=Inf);
addTrafficSource(brCentral, brTraffic, DestinationNode=brPeripherals(1));
bleTraffic = networkTrafficOnOff(DataRate=200, PacketSize=50, OnTime=Inf);
addTrafficSource(bleCentral, bleTraffic, DestinationNode=blePeripheral);
% Separate addNodes per technology
addNodes(sim, [brCentral; brPeripherals(:)]);
addNodes(sim, [bleCentral; blePeripheral]);
% Schedule AFH at t=0.3s
userData = struct('bleCentral', bleCentral, 'blePeripheral', blePeripheral);
scheduleAction(sim, @adaptChannelsFcn, userData, 0.3);
run(sim, 0.6);AFH Callback (local function)
function adaptChannelsFcn(actionID, userData)
stats = statistics(userData.blePeripheral);
collisions = stats.PHY.PacketCollisions;
if collisions > 5
goodChannels = 10:36;
updateChannelList(userData.bleCentral, goodChannels, ...
DestinationNode=userData.blePeripheral);
end
endAFH Callback (anonymous — works in evaluate_matlab_code)
reducedChannels = [0:9, 26:36];
scheduleAction(sim, ...
@(~, data) updateChannelList(data.bleCentral, data.channels, ...
DestinationNode=data.blePeripheral), ...
struct('bleCentral', bleCentral, 'blePeripheral', blePeripheral, ...
'channels', reducedChannels), ...
1.0);Two-Simulation Comparison
For before/after AFH comparison, run two identical simulations with same rng(seed). Compare statistics() from each.
BLE Multi-Piconet Coexistence
Multiple BLE piconets interfere on data channels 0–36. Mitigation: stagger ConnectionOffset so active windows don't overlap.
% Piconet 1
cfg1 = bluetoothLEConnectionConfig(ConnectionInterval=0.04, ...
ActivePeriod=0.015, ConnectionOffset=0, PHYMode="LE1M");
configureConnection(cfg1, c1, p1);
% Piconet 2 (staggered — offset ≥ ActivePeriod avoids overlap)
cfg2 = bluetoothLEConnectionConfig(ConnectionInterval=0.04, ...
ActivePeriod=0.015, ConnectionOffset=0.02, ...
AccessAddress="AABBCCDD", PHYMode="LE1M");
configureConnection(cfg2, c2, p2);Collision Statistics
Key fields from statistics(node).PHY (field names differ by technology):
| BLE node field | BR/EDR node field | Description |
|---|---|---|
PacketCollisions | PacketCollisions | Total collisions |
CoChannelCollisions | CoChannelCollisions | Same-channel collisions |
CollisionsWithBLE | CollisionsWithBREDR | Collisions with same technology |
CollisionsWithNonBLE | CollisionsWithNonBREDR | Collisions with other technology |
CollisionsWithBLEAndNonBLE | CollisionsWithBREDRAndNonBREDR | Collisions with both |
Frequency Overlap
BR/EDR hops across channels 0–78 (mapped to 2402–2480 MHz, 1 MHz spacing)
BLE uses data channels 0–36 (mapped to 2402–2480 MHz, 2 MHz spacing, excluding advertising channels)
Common Mistakes
| Mistake | Correct |
|---|---|
updateChannelMap(...) | updateChannelList(...) |
updateChannelList(node, ch) without DestinationNode | Add DestinationNode=nodeObject (required) |
DestinationNode="name" (string) | Must be node object: DestinationNode=blePeripheral |
addNodes(sim, [brNodes; bleNodes]) | Separate calls per technology |
Hardcoding goodChannels = 10:36 | Read statistics() to determine bad channels |
Calling updateChannelList before run() | Only works inside scheduleAction callback |
<!-- Copyright 2026 The MathWorks, Inc. -->
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
The author says: >=R2026a
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- MathWorks
- Publisher
- MathWorks (Official)
- Source
- matlab/matlab-agentic-toolkit · skills-catalog/wireless-communications/matlab-simulate-bluetooth-network · commit 2a7f215
- Licence
- BSD 2-Clause License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE.md)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by MathWorks.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-simulate-bluetooth-network.zip