Skip to main content
ClaudeWave
EN, English
Skill1.2k repo starsupdated 6d ago

matlab-assemble-pcb-layout

This skill assembles custom PCB structures using shape primitives, Boolean operations, and multi-layer stackups when non-catalog geometries are needed. Use it to build defected ground structures, stripline configurations, custom feed placements, and complex metal patterns on individual layers before proceeding to electromagnetic analysis or design optimization.

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

SKILL.md

# Assembling Custom PCB Components

## When to Use

- Building custom PCB structures that aren't covered by catalog objects (microstripLine, coupledMicrostripLine, etc.)
- Constructing multi-layer stackups with custom metal shapes on each layer
- Combining shape primitives with Boolean operations (union, subtract, intersect)
- Creating defected ground structures (DGS) by etching patterns into ground planes
- Placing feed ports, vias, or using advanced FeedDefinitions (coaxial, edge, delta-gap)
- Assembling stripline or shielded enclosure structures

## When NOT to Use

- Designing standard transmission lines — use `matlab-design-pcb-txline`
- Importing layouts from Gerber, ODB++, or Allegro — use `matlab-read-pcb-layout`
- Defining dielectric or metal materials — use `matlab-manage-pcb-material`
- Running EM analysis after assembly — use `matlab-analyze-em`
- Cascading or connecting multiple pcbComponents — use `matlab-integrate-pcb-circuit`

## Typical Workflow

1. **Before:** `matlab-manage-pcb-material` — set up substrate and conductor
2. **This skill:** Build the custom PCB structure using pcbComponent, shapes, and feeds
3. **After:** `matlab-analyze-em` — validate S-parameters → `matlab-optimize-pcb-design` — tune dimensions → `matlab-write-pcb-layout` — export Gerber

## Quick Reference

| Task | Code |
|------|------|
| Create pcbComponent | `pcb = pcbComponent` |
| Assign layers | `pcb.Layers = {signal, substrate, ground}` |
| Set board shape | `pcb.BoardShape = ground` |
| Set thickness | `pcb.BoardThickness = 1.6e-3` |
| Place feeds | `pcb.FeedLocations = [x1 y1 1 3; x2 y2 1 3]` |
| Feed diameter | `pcb.FeedDiameter = W/2` |
| Set conductor | `pcb.Conductor = metal("Copper")` |
| Add vias | `pcb.ViaLocations = [x y topLayer botLayer]` |
| Visualize | `show(pcb)` |
| Layout view | `layout(pcb)` |
| Boolean union | `shape = s1 + s2` |
| Boolean subtract | `shape = s1 - s2` |
| Boolean intersect | `shape = s1 & s2` |

## pcbComponent Anatomy

`pcbComponent` is the universal container for custom RF PCB structures.

### Minimal 2-Layer Microstrip

```matlab
pcb = pcbComponent;
substrate = dielectric("FR4");
substrate.Thickness = 1.6e-3;

signal = traceRectangular(Length=20e-3, Width=3e-3);
ground = traceRectangular(Length=30e-3, Width=20e-3);

pcb.Layers = {signal, substrate, ground};
pcb.BoardShape = ground;
pcb.BoardThickness = substrate.Thickness;
pcb.Conductor = metal("Copper");
pcb.FeedDiameter = 1.5e-3;
pcb.FeedLocations = [-10e-3 0 1 3; 10e-3 0 1 3];
show(pcb);
```

### 5-Layer Stripline Structure

```matlab
pcb = pcbComponent;
sub = dielectric(Name="FR4", EpsilonR=4.4, LossTangent=0.02, Thickness=0.8e-3);

topGnd = traceRectangular(Length=40e-3, Width=20e-3);
signal = traceRectangular(Length=30e-3, Width=2e-3);
botGnd = traceRectangular(Length=40e-3, Width=20e-3);

pcb.BoardThickness = 2 * sub.Thickness;          % Set BEFORE Layers
pcb.Layers = {topGnd, sub, signal, sub, botGnd};
pcb.BoardShape = topGnd;
pcb.Conductor = metal("Copper");
pcb.FeedLocations = [-15e-3 0 3 1; 15e-3 0 3 5];
pcb.FeedDiameter = 1e-3;
show(pcb);
```

### Key Properties

| Property | Format | Description |
|----------|--------|-------------|
| `Layers` | Cell array | Alternating: metal shape, dielectric, metal shape, ... |
| `BoardShape` | Shape object | Outer boundary of the PCB |
| `BoardThickness` | Scalar (m) | Must equal sum of dielectric thicknesses |
| `FeedLocations` | N×4 matrix | `[x, y, signalLayer, groundLayer]` per port |
| `FeedDiameter` | Scalar (m) | Diameter of feed via/probe |
| `ViaLocations` | M×4 matrix | `[x, y, topLayer, bottomLayer]` per via |
| `ViaDiameter` | Scalar (m) | Via barrel diameter |
| `FeedViaModel` | String | `'strip'`, `'square'`, `'octagon'`, `'hexagon'` |
| `Conductor` | metal object | Conductor for all metal layers |
| `SolverType` | String | `'MoM'` or `'FEM'` |

## Shape Primitives

### Rectangular Traces

```matlab
rect = traceRectangular(Length=20e-3, Width=5e-3, Center=[0 0]);
```

### Line Traces (multi-segment with bends)

```matlab
tl = traceLine;
tl.Length = [10 5*sqrt(2) 10]*1e-3;
tl.Angle = [0 45 0];
tl.Width = 3e-3;
tl.Corner = 1;          % 1 = Miter, 2 = Smooth (default: Sharp)
show(tl);
```

### Point-Defined Traces

```matlab
tp = tracePoint;
tp.TracePoints = [0 0; 10e-3 0; 15e-3 5e-3; 25e-3 5e-3];
tp.Width = 2e-3;
tp.Corner = 2;          % 2 = Smooth
```

### Spiral Traces

```matlab
sp = traceSpiral;
sp.NumTurns = 3;
sp.InnerDiameter = 4e-3;
sp.Spacing = 0.5e-3;
sp.TraceWidth = 0.5e-3;
show(sp);
```

### Tapered Traces

```matlab
tt = traceTapered;
tt.Length = 10e-3;
tt.InputWidth = 1e-3;
tt.OutputWidth = 3e-3;
```

### Bends

Bend `Width` is a 2-element vector `[w1 w2]` for the two arms:

```matlab
bc = bendCurved;
bc.Width = [2e-3 2e-3];
bc.CurveRadius = 5e-3;

bm = bendMitered;
bm.Width = [2e-3 2e-3];

br = bendRightAngle;
br.Width = [2e-3 2e-3];
```

### U-Bends

U-bend `Width` is a 3-element vector `[arm1 bottom arm2]`:

```matlab
uc = ubendCurved;
uc.Width = [2e-3 2e-3 2e-3];
uc.CurveRadius = 3e-3;

um = ubendMitered;
um.Width = [2e-3 2e-3 2e-3];
```

### Other Shapes

```matlab
d = delta;
d.OuterRadius = 5e-3;                           % Triangle/delta

db = dumbbell;
db.SideLength = 6e-3;                           % Head size (square Type, default)
db.ArmLength = 10e-3;
db.ArmWidth = 0.5e-3;                           % Dumbbell (for DGS)
% Note: Type='Square' uses SideLength; Type='Circle' uses Diameter

rt = racetrack;
rt.Length = 15e-3;
rt.Width = 5e-3;                                % Racetrack

rd = radial;
rd.OuterRadius = 5e-3;
rd.Angle = 60;                                  % Radial sector

ar = ringAnnular;
ar.InnerRadius = 1e-3;
ar.Width = 4e-3;                                % Annular ring (InnerRadius must be > 0)

sr = splitRing;
sr.RingDiameter = 10e-3;
sr.TraceWidth = 0.5e-3;
sr.SplitGap = 0.5e-3;                           % Split ring resonator
```

## Boolean Operations

Combine shapes using operators to build comple
matlab-access-datafeedSkill

>

matlab-analyze-ams-waveformSkill

Analyze AMS waveform data using Mixed-Signal Blockset utilities: phase noise measurement, clock jitter, anti-aliased resampling, timing measurements, lock time, INL/DNL, ADC/DAC calibration, HSpice import. Use when analyzing time-domain voltage from PLL/VCO/clock simulations, measuring phase noise from variable-step solver output, computing jitter, or resampling non-uniform data.

matlab-analyze-dataSkill

Analyze data using MATLAB. Use when the task involves tables, timetables, time-series data, numeric arrays, sensor matrices, or gridded data — including but not limited to exploring, filtering, sorting, cleaning, transforming, aggregating, smoothing, padding, trimming, and answering questions about data. MATLAB provides extensive, easy-to-use built-in functions for these workflows with no additional products required.

matlab-analyze-dependenciesSkill

Analyze the effective toolbox file set to produce a Dependency Manifest — classify all transitive dependencies as included, product, add-on, or external-unresolved, then present resolution options with tradeoffs. Use after matlab-define-toolbox-api when the spec is approved.

matlab-analyze-emSkill

S-parameters, insertion loss, fields, currents, mesh control, and solver selection for RF PCB performance validation. TRIGGER: user asks to compute S-parameters, analyze insertion/return loss, extract fields or currents, compare MoM vs FEM, or control mesh for any RF PCB component. Invoke BEFORE writing sparameters() or solver code — API is non-obvious. SKIP: designing or creating components (use the specific matlab-design-pcb-* skill), material/stackup setup only (use matlab-manage-pcb-material), optimization sweeps (use matlab-optimize-pcb-design), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn).

matlab-analyze-installed-antennaSkill

Analyze antennas installed on electrically large conducting platforms using MATLAB Antenna Toolbox. Loads platform geometry from STL/STEP/IGES, installs antenna elements, selects electromagnetic solvers (MoM-PO, FMM, MoM), and computes patterns, impedance, coupling, and efficiency. Use when the user wants to model an antenna on a vehicle, aircraft, ship, satellite, or other large structure.

matlab-analyze-pcb-pdnSkill

PDN DC voltage/current analysis, IR drop, design rule checking, and multi-net batch analysis on imported PCB layouts. TRIGGER: user asks about power integrity, PDN analysis, IR drop, voltage distribution, current density, power nets, or design rule checking on a PCB. Invoke BEFORE writing code — the PDN API chain is specialized and non-obvious. SKIP: importing a PCB file (use matlab-read-pcb-layout), EM field/S-parameter extraction (use matlab-analyze-em), material/stackup setup only (use matlab-manage-pcb-material), transmission line design (use matlab-design-pcb-txline).

matlab-analyze-rcsSkill

Calculate and visualize monostatic and bistatic radar cross section (RCS) using MATLAB Antenna Toolbox. Computes RCS of platforms, antennas, and arrays with PO, MoM, and FMM solvers, supporting HH/VV/HV/VH polarization, GPU acceleration, and near-field observation. Use when the user wants to compute, plot, or analyze radar cross section.