Generated banner for Matlab Simulate Bluetooth Network
Generated logo for Matlab Simulate Bluetooth Network

Matlab Simulate Bluetooth Network

MathWorksOfficialCreated by MathWorks

  • Skill
  • Tool integration
  • Science and research
  • BSD-2-Clause
  • No issues found

From the author

Simulate Bluetooth system-level networks using the Bluetooth Toolbox. Use this skill for any Bluetooth topology: BLE ACL (Asynchronous Connection-Less) data connections, CIS (Connected Isochronous Stream) and LE Audio for stereo speakers or hearing aids, BLE GAP (Generic Access Profile) connection establishment with advertising and scanning, Classic BR/EDR piconets with ACL data and SCO (Synchronous Connection-Oriented) voice links, and BLE+BR/EDR coexistence with adaptive frequency hopping. Covers bluetoothLENode, bluetoothNode, bluetoothLEConnectionConfig, bluetoothLECISConfig, bluetoothLEGAPConfig, bluetoothConnectionConfig, configureConnection, kpi (), updateChannelList, and all Bluetooth statistics.
— the description by MathWorks

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

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/matlab/matlab-simulate-bluetooth-network/download
  2. Unzip 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-network instead)

  • 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

ScenarioReference
BLE realistic connection setup (advertising, scanning, GAP)references/ble-gap-connection.md
BLE point-to-point data, star network, ACL connectionsreferences/ble-connection.md
LE Audio unicast (stereo speakers, hearing aids, CIS/CIG)references/ble-cis.md
Classic Bluetooth earbuds, SCO voice, ACL datareferences/bluetooth-bredr.md
BLE + BR/EDR coexistence, adaptive frequency hoppingreferences/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=peer required. CIS also needs CISConfig=cfgCISOut.

  • BR/EDR SCO: No traffic call — implicit via SCOPacketType in connection config.

kpi() Availability

Topology"throughput""latency""PLR" / "PDR"Layer
BLE ACLLL onlyApp onlyBoth LL and App"LL" or "App"
BLE CISLL onlyApp onlyBoth LL and App"LL" or "App"
BR/EDRBaseband—Baseband"Baseband"

Connection/Configuration Setup

TopologyConfig ObjectFunctionNotes
BLE ACLbluetoothLEConnectionConfigconfigureConnection(cfg, central, peripheral)Per-peripheral in loop; unique AccessAddress per connection
BLE CISbluetoothLEConnectionConfig + bluetoothLECISConfig[~, cfgCISOut] = configureConnection(cfg, central, peripheral, CISConfig=cfgCIS)Pass cfgCISOut to addTrafficSource(..., CISConfig=cfgCISOut)
BR/EDRbluetoothConnectionConfigconfigureConnection(cfg, central, peripherals)Single call with vector of peripherals

Common Mistakes

  • bluetoothNode for BLE (or vice versa): BR/EDR = bluetoothNode, BLE = bluetoothLENode

  • Wrong kpi Layer: BLE throughput → "LL", BLE latency → "App", BR/EDR → "Baseband" only

  • Properties locked after run(): Node/connection properties cannot change mid-sim. Use updateChannelList for mid-sim channel updates.

  • configureConnection with peripheral vector for BLE: Must call per-peripheral in loop (BR/EDR accepts vector)

  • Unique AccessAddress per connection: Each BLE connection on same central needs different AccessAddress

  • DataRate in Kbps: DataRate=100 means 100 Kbps, not 100 bps

  • GeneratePacket=true is not valid: Not applicable for network-level simulation. Use OnTime=Inf for continuous traffic.

<!-- Copyright 2026 The MathWorks, Inc. -->

Files

references/ble-gap-connection.md

BLE GAP Connection Establishment

Simulate realistic BLE connection setup: Central and Peripherals discover each other via advertising/scanning, then enter the connection state for data exchange.

When to Use

  • Realistic connection establishment (advertising → scanning → connection)

  • bluetoothLEGAPConfig or GAPConfig property

  • Directed/undirected connectable advertising

  • Limiting simultaneous connections with MaxConnections

  • Measuring connection establishment time

Two Modes

ModeUse whenconfigureConnection?
GAP-onlyDon't need PHYMode/ActivePeriod controlNo — auto-scheduled
GAP + configureConnectionNeed PHYMode, ActivePeriod, offsetsYes — extra constraints apply

Default to GAP-only unless you need explicit connection parameter control.

GAP-Only (Automatic Scheduling)

sim = wirelessNetworkSimulator.init;

central = bluetoothLENode("central", Position=[0 0 0], Name="Central");
peripherals = bluetoothLENode("peripheral", ...
    Position=[5 0 0; 0 5 0; -5 0 0], Name=["P1","P2","P3"]);

centralGAP = bluetoothLEGAPConfig(GAPProcedure="connection establishment", ...
    MaxConnections=3, ScanInterval=0.06, ScanWindow=0.04);
central.GAPConfig = centralGAP;

peripheralGAP = bluetoothLEGAPConfig(GAPProcedure="connection establishment", ...
    AdvertisingInterval=0.03);
for i = 1:numel(peripherals)
    peripherals(i).GAPConfig = peripheralGAP;
end

traffic = networkTrafficOnOff(DataRate=100, PacketSize=50, OnTime=Inf);
addTrafficSource(central, traffic, DestinationNode=peripherals);

addNodes(sim, [central; peripherals(:)]);
run(sim, 2);

GAP + configureConnection (Explicit Scheduling)

sim = wirelessNetworkSimulator.init;

central = bluetoothLENode("central", Position=[0 0 0], Name="Central");
peripherals = bluetoothLENode("peripheral", ...
    Position=[5 0 0; 0 5 0; -5 0 0], Name=["P1","P2","P3"]);

centralGAP = bluetoothLEGAPConfig(GAPProcedure="connection establishment", ...
    ScanInterval=0.1, ScanWindow=0.04);
central.GAPConfig = centralGAP;

peripheralGAP = bluetoothLEGAPConfig(GAPProcedure="connection establishment", ...
    AdvertisingInterval=0.03, AdvertisingEventType="connectable directed low duty cycle", ...
    TargetNode=central);
for i = 1:numel(peripherals)
    peripherals(i).GAPConfig = peripheralGAP;
end

numPeripherals = numel(peripherals);
activePeriod = 0.01;
for i = 1:numPeripherals
    cfg = bluetoothLEConnectionConfig;
    cfg.ConnectionInterval = 0.1;  % MUST equal ScanInterval
    cfg.ActivePeriod = activePeriod;
    cfg.ConnectionOffset = (i-1) * (activePeriod + 0.005);
    cfg.AccessAddress = sprintf("5DA4427%d", i-1);
    cfg.PHYMode = "LE2M";
    configureConnection(cfg, central, peripherals(i));
end

traffic = networkTrafficOnOff(DataRate=100, PacketSize=50, OnTime=Inf);
addTrafficSource(central, traffic, DestinationNode=peripherals);

addNodes(sim, [central; peripherals(:)]);
run(sim, 2);

Measuring Connection Establishment Time

Use a TransmissionStarted event callback on each peripheral. When the access address changes from the advertising address to the connection's unique address, the connection is established.

% connTimingCallback.m
function connTimingCallback(eventData)
persistent connTimes;
if isempty(connTimes)
    connTimes = containers.Map();
end
advAccessAddr = "8E89BED6";  % BLE advertising access address
pktData = eventData.EventData;
if pktData.AccessAddress ~= advAccessAddr
    nodeName = eventData.NodeName;
    if ~isKey(connTimes, nodeName)
        sim = wirelessNetworkSimulator.getInstance();
        connTimes(nodeName) = sim.CurrentTime;
    end
end
assignin("base", "connEstTimes", connTimes);
end

Usage:

for i = 1:numel(peripherals)
    registerEventCallback(peripherals(i), "TransmissionStarted", @connTimingCallback);
end
run(sim, 2);
pNames = keys(connEstTimes);
for i = 1:numel(pNames)
    fprintf('%s: %.4f s\n', pNames{i}, connEstTimes(pNames{i}));
end

Key points:

  • Event-driven (no polling) — detects exact connection moment

  • Advertising access address is always "8E89BED6"

  • Once AccessAddress changes, the peripheral is transmitting on the connection

  • Must be external .m file on path (not local function, not anonymous with side effects)

  • wirelessNetworkSimulator.getInstance().CurrentTime gives simulation time inside callback

  • assignin("base", varName, value) exports data from callback to base workspace

bluetoothLEGAPConfig Properties

PropertyDefaultNotes
GAPProcedure"none"Only "none" or "connection establishment"
MaxConnections7[1, 32] — excess peripherals stay in advertising
AdvertisingEventType"connectable and scannable undirected"Directed types require TargetNode
TargetNode[]Required for directed advertising
AdvertisingInterval0.03[0.02, 10485.76] seconds
RandomAdvertisingfalseAdds 0–10 ms jitter
ScanInterval0.05[0.0025, 40.96] seconds
ScanWindow0.03[0.0025, ScanInterval]
AdvertisingEventType Values
ValueTargetNode?Use Case
"connectable and scannable undirected"NoGeneral discovery
"connectable directed low duty cycle"YesFast reconnection to known central
"connectable directed high duty cycle"YesFastest reconnection

Critical Constraints

Both modes:

  • Both central AND peripherals need GAPProcedure = "connection establishment"

  • GAP is set via property: node.GAPConfig = config (NO configureGAP() function)

GAP + configureConnection only:

  • ConnectionInterval MUST equal ScanInterval

  • ScanInterval >= ScanWindow + sum(all ActivePeriods)

  • Standard configureConnection rules apply (unique AccessAddress, staggered offsets)

Common Mistakes

MistakeCorrect Approach
configureGAP(node, config)node.GAPConfig = config
GAPProcedure = "advertising"Only "none" or "connection establishment"
GAP on Central onlyBoth sides need it
ConnectionInterval ≠ ScanIntervalMust be equal (GAP+configureConnection mode)
Directed advertising without TargetNodeSet TargetNode = centralNode

<!-- 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 or MathWorks.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-simulate-bluetooth-network.zip