Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/wireless-communications/matlab-detect-capture-usrp

matlab-detect-capture-usrp

Verified

Smart triggered RF capture on NI USRP radios with Wireless Testbench — record only when a signal of interest appears, not continuously (triggered spectrum sensing). Use energy detection to capture when signal power rises above the noise floor, or preamble detection to cross-correlate against a known sequence (WLAN L-LTF, 5G NR PSS/SSS, LTE PSS, Zadoff-Chu, custom protocols) and capture only when that protocol's preamble is detected. Use when implementing triggered (wake-on-signal) capture or spectrum sensing, capturing protocol-based signals via cross-correlation, calibrating detection thresholds (plotDetectionSignals / plotThreshold), scanning frequency bands for activity, or building transmit-then-detect workflows.

FileKindSize
SKILL.mdskill md15.8 KB
manifest.yamlconfig699 B
references/api.mdmarkdown6.3 KB
references/overview.mdmarkdown4.1 KB
references/patterns.mdmarkdown18.7 KB
references/threshold-calibration.mdmarkdown13.8 KB

references/overview.md

View on GitHub
# Detect and Capture RF Signals - Overview

## Architecture

Wireless Testbench provides two detection application objects for triggered capture:

| Object | Trigger Mechanism | Use When |
|--------|-------------------|----------|
| `energyDetector` | Signal power exceeds threshold | The user gives an **explicit** energy/power cue ("energy", "power rise", "above the noise floor") |
| `preambleDetector` | Correlation with known sequence | Known preamble (Zadoff-Chu, L-LTF, PSS, etc.) |

The absence of a preamble is **not** a cue for energy detection. If the request names no energy/power
cue, no preamble, and no threshold parameters, ask first — see the Ask First guardrail in `SKILL.md`.

Both objects require exclusive access to radio hardware. Only one application object per radio can exist at a time.

## Detection Workflow

1. **Create** - Instantiate detector with radio config name
2. **Configure** - Set CenterFrequency, SampleRate, threshold parameters
3. **Calibrate** - Use `plotDetectionSignals` (energy) or `plotThreshold` (preamble) to tune
4. **Capture** - Call `capture(detector, length, timeout)` to wait for detection
5. **Cleanup** - Call `stopTransmission()` if transmitting; clear object

## Energy Detection

The energy detector integrates signal power over a sliding window and triggers when:
- **Adaptive mode**: Energy exceeds `MinimumEnergy` AND energy ratio between adjacent windows exceeds `EnergyDeltaThreshold` (in dB)
- **Fixed mode**: Integrated energy exceeds `FixedThreshold`

Key concept: EnergyDeltaThreshold is a ratio in dB between current and previous window energy. 3 dB = 2x power increase, 20 dB = 100x increase.

## Preamble Detection

The preamble detector correlates the received signal with a known sequence using a programmable FIR filter and triggers when:
- **Adaptive mode**: Correlator output power exceeds `AdaptiveThresholdGain * avgPower + AdaptiveThresholdOffset`
- **Fixed mode**: Correlator output power exceeds `FixedThreshold`

The preamble must have good autocorrelation properties. Zadoff-Chu sequences are ideal.

## Adaptive vs Fixed Thresholds

| Aspect | Adaptive | Fixed |
|--------|----------|-------|
| Best for | Varying noise environments | Known SNR conditions |
| Adjusts to | Channel noise floor | Does not adjust |
| Risk | Missed detections in high noise | False triggers in noise |
| Calibration | Tune gain/offset/delta params | Set single value |

## Threshold Tuning Symptoms

When a detector fires unreliably (timeouts on a real signal, false positives on noise, saturated
or baseline captures), the full symptom -> cause -> fix table and the step-by-step plot ->
diagnose -> tune procedure live in `threshold-calibration.md`. Load that file for calibration.
First diagnostic for any preamble threshold issue is `plotThreshold(pd, milliseconds(1))` while
TX is running; for energy threshold issues use `plotDetectionSignals(ed, milliseconds(2))`.

## Multi-Capture Mode (Since R2024a)

Use `"NumCaptures"` name-value argument with `capture()` to capture N consecutive signals in one call. Set `TimestampUnit="sample-clock-cycle"` to get relative timestamps between captures.

## Transmit-Then-Detect

Both detector objects support `transmit(detector, waveform, "continuous")` to send a test waveform while simultaneously detecting. This enables self-test and loopback verification without a separate basebandTransmitter.

## Frequency Scanning

To scan multiple channels (e.g., WLAN bands):
1. Create one detector object
2. Loop over center frequencies, updating `CenterFrequency` each iteration
3. Call `capture()` with a short timeout per channel
4. Collect results from channels where detection succeeds

Note: Changing `CenterFrequency` adds a few seconds delay to the next function call.

## Key Constraints

1. Objects require exclusive radio access - clear previous objects first
2. Preamble max length: 1024 samples (elements in [-1, 1])
3. WindowLength max: 4095 samples
4. First function call after object creation takes extra seconds (FPGA load)
5. Changing SampleRate or ThresholdMethod requires stopping transmission first
6. Onboard buffer shared between transmit and capture/plot data

----

Copyright 2026 The MathWorks, Inc.

----
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall