Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/wireless-communications/matlab-simulate-wireless-network

matlab-simulate-wireless-network

Verified

Set up and run wireless network simulations using the Wireless Network Toolbox. Use this skill when creating system-level simulations with wirelessNetworkSimulator, adding traffic sources (networkTrafficOnOff, networkTrafficFTP, networkTrafficVoIP, networkTrafficVideoConference), configuring node mobility, logging events or IQ samples, visualizing traffic, scheduling actions during simulation, running parametric sweeps, writing PCAP files with pcapWriter or technology-specific PCAP writers, registering event callbacks on wireless nodes, accessing event data fields, or combining multiple capture/visualization tools in a simulation.

references/parametric-sweep-pattern.md

View on GitHub
# Parametric Sweep Pattern

## Core Rule

The `wirelessNetworkSimulator` is a singleton. You MUST call `.init` at the top of every loop iteration to reset state. Without this, nodes, connections, and traffic from prior iterations persist.

## Basic Sweep

```matlab
params = [10, 20, 30];
results = zeros(1, numel(params));

for idx = 1:numel(params)
    sim = wirelessNetworkSimulator.init;  % Reset simulator each iteration

    % Create nodes (technology-specific)
    % Configure connections (technology-specific)
    % Add traffic
    % addNodes(sim, nodes)

    run(sim, 0.5);

    % Extract results (technology-specific KPI or statistics)
    results(idx) = extractMetric(nodes);
end
```

## Multi-Dimensional Sweep

For sweeps over 2+ parameters, use nested loops with `.init` in the innermost:

```matlab
paramA = [0.01, 0.02];
paramB = [0, 5, 10];
results = zeros(numel(paramA), numel(paramB));

for i = 1:numel(paramA)
    for j = 1:numel(paramB)
        sim = wirelessNetworkSimulator.init;

        % Create and configure nodes using paramA(i) and paramB(j)
        % Add traffic
        % addNodes(sim, nodes)

        run(sim, 0.3);

        results(i,j) = extractMetric(nodes);
    end
end
```

## Parallel Sweeps with parfor

For independent iterations, use `parfor` to parallelize:

```matlab
params = [0.0075, 0.01, 0.015, 0.02, 0.03, 0.04];
results = zeros(1, numel(params));

parfor idx = 1:numel(params)
    sim = wirelessNetworkSimulator.init;

    % Full setup inside parfor body — each worker independent
    % Create nodes, configure, add traffic, addNodes

    run(sim, 0.5);

    results(idx) = extractMetric(nodes);
end
```

Requirements for `parfor`:
- Each iteration must be fully independent
- Parallel Computing Toolbox required
- Simulator reinit is mandatory (each worker gets its own singleton)
- Visualization tools (`wirelessTrafficViewer`) cannot be used inside `parfor`

## Key Rules

- `.init` must be **first** inside the loop (before node creation)
- Each iteration must recreate all nodes/connections (singleton resets everything)
- `parfor` cannot use visualization tools (`wirelessTrafficViewer`)

<!-- Copyright 2026 The MathWorks, Inc. -->
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 319kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 319kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 319kUpdated Claude CodeCodexVerifiedInstall