Cascades RF PCB components, adds lumped R/L/C elements, exports Touchstone S-parameters, and bridges to eye diagram or antenna array workflows in MATLAB.
Ships in rf-and-mixed-signal. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
pcbcascadepcbElement for RF Toolboxrfwritematlab-assemble-pcb-layoutmatlab-analyze-emmatlab-manage-pcb-materialmatlab-design-pcb-filter, matlab-design-pcb-coupler, etc.) or matlab-analyze-em — create and validate individual componentsmatlab-write-pcb-layout — export final design to Gerber; or feed S-parameters into Signal Integrity Toolbox workflows| Task | Code |
|---|---|
| Cascade two components | out = pcbcascade(comp1, comp2) |
| Cascade with rectangular board | out = pcbcascade(comp1, comp2, 'RectangularBoard', true) |
| Interactive cascade | pcbcascade(comp1, comp2, 'Interactive', true) |
| Create circuit element | elem = pcbElement(comp) |
| Set analysis ports | elem.AnalysisPorts = {1, 2} |
| Attach lumped elements | elem.PortNumber = {3, 4}; elem.PortValue = {capacitor(2.2e-12), resistor(50)} |
| Add to RF circuit | add(ckt, [1 2 0 0], elem) |
| Export to Touchstone | rfwrite(sp, 'comp.s2p') |
| Export with options | rfwrite(sp, 'comp.s2p', FrequencyUnit='GHz', Format='DB') |
The pcbcascade function joins two RF PCB components port-to-port, producing a single pcbComponent for full-wave analysis.
HPF = filterStub;
HPF.StubShort = [1 1 1 1 1];
HPF.Height = 0.508e-3;
% ... set HPF properties ...
LPF = filterStepImpedanceLowPass;
LPF.Height = 0.508e-3;
LPF = design(LPF, 7e9);
BPF = pcbcascade(LPF, HPF, "RectangularBoard", true);
show(BPF);
freq = linspace(1e6, 12e9, 51);
sp = sparameters(BPF, freq, 'SweepOption', 'interp');
rfplot(sp);
| Value | Behavior |
|---|---|
true | Creates a rectangular dielectric board around the cascaded layout |
false (default) | Uses the natural board shape from the component geometries |
For visual port alignment:
pcbcascade(comp1, comp2, 'Interactive', true);
This launches a GUI that lets you visually connect ports and adjust spacing.
Chain more than two components by cascading sequentially:
stage1 = design(filterStepImpedanceLowPass, 5e9);
stage2 = design(microstripLine, 5e9);
stage3 = design(filterStepImpedanceLowPass, 5e9);
% Match substrates — design() defaults differ across object types
stage2.Substrate = stage1.Substrate;
stage2.Height = stage1.Height;
stage2.Conductor = stage1.Conductor;
stage3.Substrate = stage1.Substrate;
stage3.Height = stage1.Height;
stage3.Conductor = stage1.Conductor;
% Cascade stage1 + stage2, then result + stage3
intermediate = pcbcascade(stage1, stage2, 'RectangularBoard', true);
final = pcbcascade(intermediate, stage3, 'RectangularBoard', true);
show(final);
Height, Substrate)pcbElement wraps an RF PCB component as a circuit element usable in the RF Toolbox circuit framework. This enables hybrid distributed+lumped modeling.
comp = design(couplerBranchline, 5e9);
elem = pcbElement(pcbComponent(comp));
S = sparameters(elem, linspace(3e9, 7e9, 51), 'SweepOption', 'interp');
rfplot(S);
% Behavioral model (fast, uses analytic approximation)
elem = pcbElement(comp, 'Behavioral', true);
% Full-wave solve (accurate, uses MoM)
elem = pcbElement(comp, 'Behavioral', false);
Not all components support behavioral mode. If unsupported, a warning is issued and full-wave is used automatically.
ckt = circuit;
c1 = interdigitalCapacitor;
c2 = interdigitalCapacitor('NumFingers', 3);
p = pcbElement(c2, 'Behavioral', false);
add(ckt, [1 2 0 0], c1); % Default pcbElement created automatically
add(ckt, [2 3 0 0], p);
setports(ckt, [1 0], [3 0]);
S = sparameters(ckt, 8e9);
The most powerful use of pcbElement is connecting lumped components (capacitors, resistors, inductors) to internal ports on an EM structure. This models tunable filters with varactors, loaded resonators, and bias-T networks.
FeedLocations on the PCB as internal port pairspcbElementAnalysisPorts (external I/O ports for S-parameter extraction)PortNumber (internal port indices to load)PortValue (lumped elements connected at those ports)% Start with a 4-port coupler
comp = design(couplerRatrace, 5e9);
pcb = pcbComponent(comp);
% Create pcbElement
elem = pcbElement(pcb);
% Ports 1,2 are external I/O (for S-parameter extraction)
elem.AnalysisPorts = {1, 2};
% Ports 3,4 are loaded with lumped elements
elem.PortNumber = {3, 4};
elem.PortValue = {resistor(50), resistor(50)};
% Analyze the 2-port network with internal loads
S = sparameters(elem, linspace(3e9, 7e9, 51), 'SweepOption', 'interp');
rfplot(S);
% Design a filter with extra internal feed points for varactors
pcb = pcbComponent;
% ... build custom filter geometry with internal feed pads ...
% FeedLocations rows 1,2 = external I/O
% FeedLocations rows 3,4 and 5,6 = varactor pads (internal port pairs)
pcb.FeedLocations = [x1 y1 1 3; % Port 1: input
x2 y2 1 3; % Port 2: output
x3 y3 1 3; % Port 3: varactor pad A+
x4 y4 1 3; % Port 4: varactor pad A-
x5 y5 1 3; % Port 5: varactor pad B+
x6 y6 1 3]; % Port 6: varactor pad B-
elem = pcbElement(pcb);
elem.AnalysisPorts = {1, 2};
elem.PortNumber = {{3,4}, {5,6}};
elem.PortValue = {capacitor(2.2e-12), capacitor(2.2e-12)};
S = sparameters(elem, linspace(1e9, 10e9, 51), 'SweepOption', 'interp');
rfplot(S);
| Type | Example |
|---|---|
resistor | resistor(50) |
capacitor | capacitor(2.2e-12) |
inductor | inductor(1e-9) |
| S-parameter file | 'component.s2p' |
% Single-port loads (each port terminated individually)
elem.PortNumber = {3, 4};
elem.PortValue = {resistor(50), resistor(50)};
% Port-pair loads (2-port element connected across a pair)
elem.PortNumber = {{3,4}, {5,6}};
elem.PortValue = {capacitor(2.2e-12), nport('varactor.s2p')};
Integrate RF PCB feed networks with Antenna Toolbox arrays.
% Design corporate power divider
pdc = powerDividerCorporate;
pdc = design(pdc, 5e9);
pdc.NumOutputPorts = 4;
pdc.PortSpacing = physconst('lightspeed') / 5e9;
% Design patch antenna
ant = patchMicrostripInsetfed;
ant.Substrate = dielectric('Teflon');
ant = design(ant, 5e9);
% Convert to pcbStack for shape extraction
pcbant = pcbStack(ant);
TopLayer = pcbant.Layers{1};
% Create linear array of patches
for i = 2:4
a = copy(TopLayer);
a = translate(a, [0, pdc.PortSpacing*(i-1), 0]);
TopLayer = TopLayer + a;
end
% Merge divider and antenna array into single pcbStack
pcbcomp = pcbComponent(pdc);
pcbant1 = pcbStack;
pcbant1.BoardShape = pcbcomp.BoardShape;
pcbant1.BoardThickness = pcbcomp.BoardThickness;
pcbant1.Layers = pcbcomp.Layers;
pcbant1.FeedDiameter = pcbcomp.FeedDiameter;
pcbant1.FeedLocations = pcbcomp.FeedLocations(1,:); % Keep only input port
% Combine top layers
pcbant1.Layers{1} = pcbant1.Layers{1} + TopLayer;
show(pcbant1);
For pcb2D cross-section analysis, trace2D setup, RLGC extraction, slice(), and crosstalk with coupled traces, see matlab-design-pcb-transmission-line.
Use rfwrite to save computed S-parameters as Touchstone files for reuse in other tools or simulations.
sp = sparameters(pcbComponent, freq, 'SweepOption', 'interp');
rfwrite(sp, 'component.s2p');
| Option | Values | Description |
|---|---|---|
FrequencyUnit | 'Hz', 'kHz', 'MHz', 'GHz' | Unit for frequency column |
Parameter | 'S', 'Y', 'Z' | Network parameter type |
Format | 'MA', 'DB', 'RI' | Magnitude-Angle, dB-Angle, Real-Imaginary |
ReferenceResistance | scalar (default 50) | Reference impedance in ohms |
rfwrite(sp, 'filter_2p4GHz.s2p', FrequencyUnit='GHz', Format='DB');
n = nport('component.s2p');
% Use in any RF Toolbox circuit
add(ckt, [1 2], n);
The file extension (.s2p, .s4p, etc.) is selected automatically by rfwrite based on port count.
A Nolen matrix uses cascaded branchline couplers and phase shifters to create an N×N beam-forming network. Build by cascading individual RF PCB components:
coupler = design(couplerBranchline, fc);
ps = design(phaseShifter, fc, PhaseShift=90);
% Extract S-parameters for each, then cascade via circuit()
ckt = circuit;
add(ckt, [1 2 3 4], nport(sparameters(coupler, freq, 'SweepOption', 'interp')));
add(ckt, [3 5], nport(sparameters(ps, freq, 'SweepOption', 'interp')));
% ... build full N×N matrix
An X-band monopulse comparator uses four ratrace couplers to generate sum and difference beams:
rr = design(couplerRatrace, fc);
S_rr = sparameters(rr, freq, 'SweepOption', 'interp');
% Build 4-coupler comparator network using circuit()
Use microstrip tee junctions and stubs to create input/output matching networks, then cascade with amplifier S-parameters:
% Build matching network as pcbComponent
tee = traceTee(Length=[L1, L2], Width=[W1, W2]);
pcb = pcbComponent(tee);
pcb.Substrate = dielectric("FR4");
S_match = sparameters(pcb, freq, 'SweepOption', 'interp');
% Load amplifier S-parameters and cascade
amp = nport('amplifier.s2p');
ckt = circuit;
add(ckt, [1 2 0 0], nport(S_match)); % Input match
add(ckt, [2 3 0 0], amp); % Amplifier
add(ckt, [3 4 0 0], nport(S_match)); % Output match
setports(ckt, [1 0], [4 0]);
S_total = sparameters(ckt, freq);
Full-wave EM results from pcb2D can be exported to Signal Integrity Toolbox for system-level analysis:
cs = pcb2D;
% ... configure traces, substrate
[r, l, g, c] = rlgc(cs, freq);
% Export to Parallel Link Designer for eye diagram analysis
When searching for the optimal lumped element to bridge a gap or load an internal port, re-solving EM for every candidate value is prohibitively slow. Instead, extract the N-port S-matrix once and sweep element values analytically using S-parameter network math.
% 1. Build 4-port structure (2 external + 2 internal ports at the gap)
pcb = pcbComponent;
% ... set up geometry with 4 feeds ...
freq = linspace(9e9, 11e9, 101);
S4 = sparameters(pcb, freq, 50, 'SweepOption', 'interp'); % Solve once
% 2. Partition the 4-port S-matrix into external (1,2) and internal (3,4)
S = S4.Parameters;
S11 = S(1:2, 1:2, :); S12 = S(1:2, 3:4, :);
S21 = S(3:4, 1:2, :); S22 = S(3:4, 3:4, :);
% 3. Sweep element impedance analytically (no EM re-solve)
Z0 = 50;
Zvals = linspace(1, 500, 1000); % Candidate impedances
bestS11 = 0; bestZ = NaN;
for k = 1:numel(Zvals)
Gamma_L = (Zvals(k) - Z0) / (Zvals(k) + Z0);
GammaM = Gamma_L * eye(2);
% S-parameter connection: S_ext = S11 + S12*GammaM*inv(I - S22*GammaM)*S21
for fi = 1:size(S,3)
Sext = S11(:,:,fi) + S12(:,:,fi) * GammaM / ...
(eye(2) - S22(:,:,fi) * GammaM) * S21(:,:,fi);
s11_dB = 20*log10(abs(Sext(1,1)));
if s11_dB < bestS11
bestS11 = s11_dB; bestZ = Zvals(k);
end
end
end
| Scenario | Approach |
|---|---|
| Swept R/L/C value search | Extract N-port once, sweep analytically |
| Few discrete element options | pcbElement with PortValue (re-solves each time) |
| Final validation of optimal value | pcbElement with the chosen value for full-wave confirmation |
This technique is orders of magnitude faster than re-solving EM per iteration — Task 8 swept 1000 impedance values in seconds vs. hours of EM solves.
pcbcascade substrate match: Both components must have identical Substrate, Height, and Conductor. design() uses different defaults for different object types (e.g. filterStepImpedanceLowPass defaults to a custom dielectric while microstripLine defaults to Teflon). Always copy substrate properties from one component to the other before calling pcbcascade.
Port width matching: When cascading, the port line width of comp1's output port should match comp2's input port width. Mismatched widths cause impedance discontinuities that aren't physical.
pcbElement port ordering: AnalysisPorts indices must be a subset of the feed indices defined in FeedLocations. Port 1 in AnalysisPorts corresponds to the first row of FeedLocations.
PortNumber vs AnalysisPorts: Ports listed in PortNumber are loaded with lumped elements and NOT available as external analysis ports. Don't include the same port index in both AnalysisPorts and PortNumber.
Behavioral mode availability: Not all catalog objects support Behavioral=true. The behavioral model is a fast approximation — use Behavioral=false for final design validation.
Corporate divider + antenna assembly: When combining shapes with +, ensure they physically overlap or touch. Disjoint shapes create disconnected geometry that won't simulate correctly.
No design() for filterStub: filterStub does not support design(). Set stub dimensions manually.
pcbElement Behavioral default is true: When wrapping a catalog object, Behavioral defaults to true (fast analytic). Set Behavioral=false explicitly for full-wave accuracy.
Port renumbering after cascade: pcbcascade(comp1, comp2, portA, portB) connects comp1:portA to comp2:portB — those two ports disappear. Surviving ports are renumbered: comp1's remaining ports first (in original order, skipping portA), then comp2's remaining ports (skipping portB). Example: comp1 has ports [1,2], comp2 has ports [1,2,3]. pcbcascade(comp1, comp2, 2, 1) produces combined ports: [comp1:1, comp2:2, comp2:3]. Always verify with show(combined).
Ground plane continuity in antenna cascades: By default, pcbcascade does not merge ground planes. Use 'GroundFloodFill', true for a continuous ground plane, which is essential for microstrip-fed antennas: pcbcascade(feed, ant, 2, 1, 'GroundFloodFill', true).
SI frequency sampling: Use at least 400 frequency points for wideband SI channels. Too few points cause artifacts in time-domain conversion (eye diagrams).
pcbcascade does not accept lumped elements: pcbcascade only connects pcbComponent objects. To combine a PCB component with lumped resistor/capacitor/inductor elements, use the circuit() object: wrap the PCB component with pcbElement, then add() both the pcbElement and lumped elements to a circuit with node connections and setports(). Example:
pe = pcbElement(comp); pe.Name = 'txline';
C = capacitor(100e-12); C.Name = 'Cblock';
R = resistor(50); R.Name = 'Rterm';
ckt = circuit('modified');
add(ckt, [1 2], C); % Series DC block
add(ckt, [2 3], pe); % PCB element
add(ckt, [3 0], R); % Shunt termination
setports(ckt, [1 0], [3 0]);
S = sparameters(ckt, freq);
matlab-design-pcb-filter — Filter objects for cascadematlab-design-pcb-coupler — Coupler/splitter objects for cascadematlab-assemble-pcb-layout — Custom geometry with pcbComponentmatlab-analyze-em — S-parameter extraction and field analysisCopyright 2026 The MathWorks, Inc.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/rf-and-mixed-signal:matlab-integrate-pcb-circuitfrom rf-and-mixed-signal
npx claudepluginhub matlab/matlab-agentic-toolkit --plugin rf-and-mixed-signal21 skills in this plugin
/matlab-analyze-ams-waveformAnalyze 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-antenna-structuresDesign and analyze electrically large antenna structures using MATLAB Antenna Toolbox. Covers reflector antennas (parabolic, Cassegrain, Gregorian, offset, corner, cylindrical, spherical, custom STL), reflectarrays and reconfigurable intelligent surfaces (RIS), antennas installed on platforms (vehicles, aircraft, ships, satellites), and radar cross section (RCS) analysis. Includes solver selection (MoM-PO, PO, MoM, FMM), mesh control, and GPU acceleration. Use when the user wants to design a dish/reflector antenna, reflectarray, analyze an antenna on a platform, or compute RCS.
/matlab-analyze-emS-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).Other plugins' skills for the same job