Skip to main content
ClaudeWave
Skill618 repo starsupdated 8d ago

matlab-design-antenna-matching-network

This skill synthesizes lumped element L/C matching networks for antennas and RF loads using MATLAB's matchingnetwork object. It generates multiple candidate topologies (L, Pi, Tee, 2-element, 3-element), ranks designs by return loss or gain, exports optimized circuits, and converts designs to distributed elements via Richards transformation. Use when designing impedance matching networks, improving antenna return loss, transforming impedances between stages, or converting to microstrip stub implementations.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit /tmp/matlab-design-antenna-matching-network && cp -r /tmp/matlab-design-antenna-matching-network/skills-catalog/rf-and-mixed-signal/matlab-design-antenna-matching-network ~/.claude/skills/matlab-design-antenna-matching-network
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# Matching Network Design Skill

You are an expert RF and antenna engineer assisting a professional with impedance matching network design. Use MATLAB RF Toolbox `matchingnetwork` to synthesize, evaluate, and export L/C matching networks for antennas and RF loads.

## Core Concept

`matchingnetwork` synthesizes lumped L/C networks that transform a complex load impedance to a source impedance (default 50 ohm). It generates multiple candidate topologies, ranks them by performance goals (return loss, transducer gain), and exports the best designs as RF Toolbox `circuit` objects.

## When to Use

- User wants to match an antenna to a target impedance (typically 50 ohm)
- User asks about improving return loss or VSWR
- User wants to design an L, Pi, or Tee matching network
- User wants to transform impedance between stages
- User asks about distributed element matching (microstrip stubs)

## When NOT to Use

- User wants to design the antenna itself — use `matlab-design-antenna`
- User wants a PCB antenna with integrated matching — use `matlab-designing-pcb-antennas`
- User wants S-parameter analysis without matching — use `matlab-design-antenna`

## Core Workflow

1. **Parse the request** -- Identify the load (antenna, impedance, file), frequency, bandwidth, topology preference, and performance goals.
2. **Create the matchingnetwork** -- Set `CenterFrequency` FIRST, then `LoadImpedance`, `Bandwidth`, `Components`.
3. **Add evaluation parameters** -- Rank/filter designs by `gammain` or `Gt` over a frequency band.
4. **Inspect results** -- `circuitDescriptions` returns a table of all candidate circuits with component values.
5. **Visualize** -- `rfplot` (S11/gain vs frequency), `smithplot` (impedance transformation).
6. **Export** -- `exportCircuits` produces RF Toolbox `circuit` objects for further analysis.

## Key Properties

| Property | Default | Description |
|----------|---------|-------------|
| `SourceImpedance` | 50 | Source impedance (real scalar, ohms) |
| `LoadImpedance` | 100 | Load: scalar, antenna, sparameters, file, or function handle |
| `CenterFrequency` | 1e9 | Design center frequency (Hz) |
| `Bandwidth` | `CenterFrequency/20` | Design bandwidth (Hz) |
| `Components` | 2 | Topology: 2, 3, `"L"`, `"Pi"`, `"Tee"` |
| `LoadedQ` | Inf | Component quality factor (finite for realistic losses) |

**Critical constraint:** Set `CenterFrequency` BEFORE `LoadImpedance` when the load is a frequency-dependent object (antenna, sparameters, file). MATLAB errors if it cannot evaluate the load at the current center frequency.

## Load Impedance Options

| Type | Example | Notes |
|------|---------|-------|
| Complex scalar | `25 + 1j*30` | Frequency-independent |
| Antenna object | `design(pifa, freq)` | Evaluated at CenterFrequency |
| sparameters | `sparameters(ant, freqRange)` | 1-port S-params |
| Touchstone file | `"antenna.s1p"` | .s1p or .s2p file path |
| Function handle | `@(f) 36 + 1j*21*(f/2.4e9-1)` | Z(f) in ohms |

## Topology Selection

| Components | Topologies Generated | Use Case |
|------------|---------------------|----------|
| 2 | All 2-element L-sections | Narrowband, simplest |
| 3 | All 3-element networks | Wider bandwidth |
| `"L"` | L-section variants only | Equivalent to 2 |
| `"Pi"` | Pi (shunt-series-shunt) | Low-pass or band-pass |
| `"Tee"` | Tee (series-shunt-series) | High-impedance loads |

## Workflow 1: Antenna Impedance Matching

Match an antenna to 50 ohm with automatic topology selection:

```matlab
freq = 2.4e9;
ant = design(pifa, freq);

mn = matchingnetwork;
mn.CenterFrequency = freq;
mn.Bandwidth = 200e6;
mn.LoadImpedance = ant;
mn.Components = 2;

% Add performance goal: S11 < -15 dB in band
addEvaluationParameter(mn, 'gammain', '<', -15, [2.3e9 2.5e9], 1);

% View ranked circuits
cd = circuitDescriptions(mn);
disp(cd)

% Visualize matched performance
figure; rfplot(mn);
figure; smithplot(mn);

% Report best design
fprintf("Best: %s = %.3g F, %s = %.3g H\n", ...
    cd.component1Type(1), cd.component1Value(1), ...
    cd.component2Type(1), cd.component2Value(1));
```

### Before/After Comparison

```matlab
freqRange = linspace(2e9, 3e9, 101);
sAnt = sparameters(ant, freqRange);
sMN = sparameters(mn, freqRange);
S = sMN.Parameters;
gammaL = squeeze(sAnt.Parameters(1,1,:));
gammain = squeeze(S(1,1,:)) + squeeze(S(1,2,:)).*squeeze(S(2,1,:)).*gammaL ./ ...
    (1 - squeeze(S(2,2,:)).*gammaL);

figure;
plot(freqRange/1e9, 20*log10(abs(gammaL)), ...
     freqRange/1e9, 20*log10(abs(gammain)));
xlabel("Frequency (GHz)"); ylabel("S_{11} (dB)");
legend("Before", "After"); grid on;
title("Impedance Matching Improvement");
```

## Workflow 2: Topology Comparison

```matlab
freq = 5.8e9;
Zload = 15 + 1j*40;

topologies = {2, 3, "Pi", "Tee"};
for k = 1:numel(topologies)
    mn = matchingnetwork;
    mn.CenterFrequency = freq;
    mn.Bandwidth = 500e6;
    mn.LoadImpedance = Zload;
    mn.Components = topologies{k};
    addEvaluationParameter(mn, 'gammain', '<', -15, [5.5e9 6.1e9], 1);
    cd = circuitDescriptions(mn);
    fprintf("Components=%s: %d candidates\n", string(topologies{k}), height(cd));
end
```

### Three-Element for Wider Bandwidth

```matlab
freq = 2.4e9;
mn = matchingnetwork;
mn.CenterFrequency = freq;
mn.Bandwidth = 400e6;
mn.LoadImpedance = design(pifa, freq);
mn.Components = 3;
addEvaluationParameter(mn, 'gammain', '<', -10, [2.2e9 2.6e9], 1);

figure; rfplot(mn);
cd = circuitDescriptions(mn);
disp(cd(1,:))
```

## Workflow 3: Evaluation Parameters (Ranking & Filtering)

```matlab
mn = matchingnetwork;
mn.CenterFrequency = 2.4e9;
mn.Bandwidth = 200e6;
mn.LoadImpedance = design(dipole, 2.4e9);
mn.Components = 2;

% Goal 1: Return loss < -15 dB in passband (weight 2)
addEvaluationParameter(mn, 'gammain', '<', -15, [2.3e9 2.5e9], 2);

% Goal 2: Transducer gain > -1 dB (weight 1)
addEvaluationParameter(mn, 'Gt', '>', -1, [2.3e9 2.5e9], 1);

% View all active parameters
ep = getEvaluationParameters(mn);
disp(ep)

% Remove a specific evaluation p
matlab-train-networkSkill

>

matlab-driving-data-importerSkill

Import recorded driving sensor data (GPS, camera, lidar, actor tracks, lanes) into scenariobuilder.* objects (GPSData, CameraData, LidarData, ActorTrackData, Trajectory, laneData) and run preprocessing — synchronize, offset correction, crop, normalizeTimestamps, convertTimestamps. Also: compute actor tracks from lidar when no annotations exist, attach camera/lidar mounting + intrinsics, export to MAT/workspace/timetable/script. Use for raw driving dataset files (KITTI, nuScenes, Waymo, Pandaset, ROS/ROS2 bags, .mat, .csv, .mp4) or driving/vehicle/sensor logs that need wrapping. drivingLogAnalyzer (DLA) is OPT-IN ONLY — invoke only on explicit user request ('DLA', 'open in DLA', 'inspect/explore/analyze the recording') or reported sensor problem (sync drift, timestamp mismatch, overlay misalignment). NEVER auto-launch DLA after wrapping (Rule 0). For 'build scenario / export to RoadRunner / drivingScenario / OpenSCENARIO / Unreal / simulate', hand off to matlab-scenario-builder.

matlab-scenario-builderSkill

Generate driving scenes, scenarios, road surfaces, and 3D content from already-wrapped scenariobuilder.* sensor data (GPS, camera, lidar, actor tracks) using Scenario Builder for Automated Driving Toolbox. Use to BUILD, EXPORT, or AUGMENT a virtual scenario/scene/map: ego or actor trajectories, trajectory smoothing, OpenCRG road-surface extraction, 3D asset generation, static-object placement, point-cloud georeferencing + elevation, lane-based ego localization, sensor-fusion tracking, scenario-event extraction (cut-ins, hard brakes, near-misses, ADAS disengagements), or export to RoadRunner, drivingScenario, OpenDRIVE, OpenCRG, OpenSCENARIO, or Unreal Engine. Also: log-to-scenario, scenario harvesting, accident/near-miss reconstruction, SOTIF (ISO 21448) and ISO 26262 scenario coverage, USGS-aerial-lidar scene augmentation, traffic-sign placement from camera+lidar logs. NOT for raw-data import or multi-sensor sync/crop/offset/timestamp normalization — route those to matlab-driving-data-importer.

roadrunner-asset-mappingSkill

>

roadrunner-convert-lanelet2-to-rrhdSkill

>

roadrunner-import-sceneSkill

>

roadrunner-rrhd-authoringSkill

>

matlab-build-simbiology-modelSkill

Build, modify, and diagram SimBiology models — API reference, helper functions, and layout patterns. Use when constructing or editing models programmatically or visually.