Skip to content

matlab/matlab-agentic-toolkit / skills-catalog/radar/matlab-design-radar-waveform

matlab-design-radar-waveform

Verified

Design, select, and analyze waveforms for radar, sonar, and active sensing using the Phased Array System Toolbox. Covers LFM, NLFM, FMCW, phase-coded, CW, stepped FM, custom IQ, ambiguity functions, sidelobe reduction, and Doppler tolerance. Key objects: phased.LinearFMWaveform, phased.NonlinearFMWaveform, phased.CustomFMWaveform, phased.PhaseCodedWaveform, phased.FMCWWaveform, phased.SteppedFMWaveform, phased.MFSKWaveform, phased.RectangularWaveform, nlfmspec2freq, shapespectrum, ambgfun, pambgfun, sidelobelevel, legendreseq, mlseq, radarWaveformGenerator.

references/analysis-functions.md

View on GitHub
# Analysis Functions Reference

## Ambiguity Function

### ambgfun — Standard Ambiguity Function

Use for any waveform: single pulses, pulse trains, or arbitrary signals.

```matlab
[afmag, delay, doppler] = ambgfun(sig, fs, prf);
[afmag, delay, doppler] = ambgfun(sig, fs, prf, 'Cut', 'Doppler');
[afmag, delay, doppler] = ambgfun(sig, fs, prf, 'Cut', 'Delay');
```

**Inputs:**
- `sig` — waveform samples (complex vector)
- `fs` — sample rate (Hz)
- `prf` — pulse repetition frequency (Hz)

**Cut options:**
- `'2D'` — full delay-Doppler surface (default)
- `'Doppler'` — zero-delay cut (shows Doppler tolerance)
- `'Delay'` — zero-Doppler cut (shows range resolution and sidelobes)

Works with pulse trains: pass the full multi-pulse signal.

**Doppler tolerance check** — use `'Cut', 'Doppler'` with `'CutValue'` to measure
true SNR loss at a specific Doppler shift. This compares the peak of the range
response at that Doppler to the peak at zero Doppler — the target is still
detectable regardless of which range cell it lands in:

```matlab
% Measure true SNR loss at max target velocity
[cut0, ~] = ambgfun(sig, fs, prf, 'Cut', 'Doppler', 'CutValue', 0);
[cutFd, ~] = ambgfun(sig, fs, prf, 'Cut', 'Doppler', 'CutValue', fdMax);
dopplerLoss = mag2db(max(cutFd) / max(cut0));
```

Do NOT use the zero-delay cut (`'Cut','Delay','CutValue',0`) for this — it
conflates range-Doppler coupling (peak shifting to a different range cell) with
actual SNR degradation.

### pambgfun — Periodic Ambiguity Function

Use for CW and periodic waveforms. Exploits signal periodicity to improve
Doppler resolution by factor 1/NT (N periods, T period duration).

```matlab
[paf, delay, doppler] = pambgfun(sig, fs, numPeriods);
[paf, delay, doppler] = pambgfun(sig, fs, numPeriods, 'Cut', '2D');
[paf, delay, doppler] = pambgfun(sig, fs, numPeriods, 'Cut', 'Delay');
[paf, delay, doppler] = pambgfun(sig, fs, numPeriods, 'Cut', 'Doppler');
```

**Inputs:**
- `sig` — one period of the waveform (complex vector)
- `fs` — sample rate (Hz)
- `numPeriods` — number of periods to analyze

**When to use pambgfun vs ambgfun:**

| Waveform | Use | Reason |
|----------|-----|--------|
| Single pulse | `ambgfun` | Non-periodic signal |
| Pulse train | `ambgfun` | Pass full signal; standard analysis |
| FMCW | `pambgfun` | Periodic — exploits periodicity for better Doppler resolution |
| Phase-coded CW (duty cycle = 1) | `pambgfun` | Periodic CW signal |
| Any waveform where periodicity is key | `pambgfun` | Improved Doppler resolution |

```matlab
% Periodic ambiguity function for FMCW
wav = phased.FMCWWaveform('SweepBandwidth', 150e6, 'SweepTime', 7e-6);
sig = wav();
[paf, delay, doppler] = pambgfun(sig, wav.SampleRate, 10, 'Cut', '2D');
```

## Sidelobe Measurement

### sidelobelevel (R2024b)

Measure peak sidelobe level (PSL) and integrated sidelobe level (ISL).

```matlab
psl = sidelobelevel(sig_dB);
[psl, isl] = sidelobelevel(sig_dB);
```

**Input must be in dB.** Convert matched filter output to dB before passing.
Always use this function instead of computing sidelobes manually.

```matlab
wav = phased.LinearFMWaveform('PulseWidth', 10e-6, 'SweepBandwidth', 5e6);
mfCoeffs = getMatchedFilter(wav);
mf = phased.MatchedFilter('Coefficients', mfCoeffs);
sig = wav();
mfOut = mf(sig);
psl = sidelobelevel(mag2db(abs(mfOut)));
fprintf('Peak sidelobe level: %.1f dB\n', psl);
```

## Spectral Shaping

### shapespectrum (R2024b)

**Purpose: Spectral notching and mask application to avoid interference.**

This function is NOT for sidelobe reduction. It modifies a waveform's spectrum
to meet spectral mask requirements (e.g., avoiding interference with other
systems).

```matlab
[y, info] = shapespectrum(desiredSpectrum, x);
[y, info] = shapespectrum(ds, x, 'MaxIterations', 1000, ...
    'SpectrumRMSEThreshold', 0.01);
```

**Inputs:**
- `desiredSpectrum` — target spectrum shape in dB (N-by-1 or N-by-2 for bounds)
- `x` — initial waveform (complex vector, same length as desiredSpectrum)

**Key parameters:**
- `MaxIterations` — maximum iterations (default 500)
- `SpectrumRMSEThreshold` — convergence tolerance (default 0)
- `Magnitude` — time-domain magnitude constraint
- `DesiredSpectrumRange` — 'twosided' or 'centered'

**Use cases:**
- Spectral notching to avoid GPS, communications bands
- Applying regulatory spectral masks
- Shaping spectrum to reduce out-of-band emissions

**NOT for:** Sidelobe reduction in pulse compression. Use windowed matched
filter or NLFM design instead.

----

Copyright 2026 The MathWorks, Inc.

----
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 197kUpdated Claude CodeCodexVerifiedInstall