Generated banner for Matlab Model Rf
Generated logo for Matlab Model Rf

Matlab Model Rf

MathWorksOfficialCreated by MathWorks

  • Skill
  • Guidelines
  • Science and research
  • BSD-2-Clause
  • No issues found

From the author

RF Toolbox and RF Blockset in MATLAB -- S-parameter I/O, network conversions (S/Z/Y/ABCD/T/H/G, mixed-mode), cascade/de-embedding, rfbudget analysis, circuit composition, matching networks, amplifier stability, mixer spurs, rational fitting, SI channels, baseband processing, Circuit Envelope simulation. Trigger: sparameters, Touchstone, .s2p, .s4p, rfplot, smithplot, rfparam, rfwrite, zparameters, yparameters, abcdparameters, s2sdd, cascadesparams, deembedsparams, rfbudget, noise figure, OIP3, IIP3, amplifier, modulator, nport, rffilter, attenuator, seriesRLC, shuntRLC, lcladder, txline, circuit, setports, clone, matchingnetwork, stabilityk, stabilitymu, powergain, gammams, gammaml, mixerIMT, OpenIF, rational, rationalfit, stepresp, txlineWRLGC, rf.Amplifier, rf.Mixer, rf.Filter, rf.Sparameter, rfsystem, RF Blockset.
— the description by MathWorks

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to utilizing MATLAB's RF Toolbox and RF Blockset for end-to-end RF system development. It covers workflows ranging from measured S-parameter data validation and network conversions to complex circuit-level design, amplifier stability analysis, and time-domain Circuit Envelope simulation. The documentation emphasizes best practices for script-based workflows, proper element handling, and avoiding common pitfalls in RF parameter manipulation and system modeling.

What it does

  • Validates and processes measured S-parameter data from Touchstone files.
  • Performs network parameter conversions and mixed-mode analysis.
  • Enables RF signal chain design and cascaded budget analysis.
  • Supports circuit-level composition and impedance matching network design.
  • Facilitates amplifier stability analysis and mixer intermodulation planning.
  • Provides tools for rational fitting and time-domain system simulation.

When to use it

  • When working with measured S-parameter data for validation or de-embedding.
  • When designing RF signal chains and performing cascaded budget analysis.
  • When composing arbitrary RF circuits using node-based netlists.
  • When analyzing amplifier stability or mixer spur performance.
  • When performing time-domain signal integrity or Circuit Envelope simulations.

Advantages

  • Unified workflow for both passive and active RF device characterization.
  • Strict adherence to MATLAB identifier and object handling rules prevents silent errors.
  • Comprehensive support for modern visualization tools like tiledlayout and smithplot.
  • Clear separation between script-based design workflows and interactive analysis.
  • Detailed guidance on avoiding common errors in port ordering and parameter units.

Usage examples

“How do I load an S-parameter file and plot it on a Smith chart?”
The agent will guide you to use sparameters() to load the file, followed by smithplot() for visualization, ensuring you handle reference impedance correctly via newref() if needed.
“Calculate the cascaded gain and noise figure for my RF chain.”
The agent will help you define elements using rfbudget, ensuring you set the SignalBandwidth and use clone() for reused elements, then run the budget analysis.
“How do I analyze the stability of an amplifier?”
The agent will instruct you to use stabilityk and stabilitymu, and calculate power gain using powergain with the correct linear-to-dB conversion.
“I need to export my S-parameters to a new file.”
The agent will provide the rfwrite command, specifically reminding you to include 'ForceOverwrite', true to avoid interactive dialogs.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/matlab/matlab-model-rf/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip matlab-model-rf.zip -d .agents/skills

Documentation by MathWorks

RF Toolbox and RF Blockset

Design, analyze, and simulate RF systems in MATLAB -- from measured S-parameter data through full time-domain Circuit Envelope simulation. One unified workflow covering passive networks, active device characterization, system cascade budgets, and behavioral time-domain modeling.

When to Use

Measured data workflows

  • Loading Touchstone files (.s1p through .snp), validating quality (passivity, causality, IEEE P370)

  • Plotting on Smith charts and rectangular plots, interpolating, re-referencing impedance

  • Converting between S, Z, Y, ABCD, T, H, G parameters; computing mixed-mode differential

  • Cascading and de-embedding S-parameter networks; fixture removal

System design and analysis

  • Building RF signal chains from behavioral elements (amplifier, modulator, rffilter, nport, etc.)

  • Computing cascaded gain, noise figure, IP3, SNR, output power with rfbudget

  • Comparing Friis vs Harmonic Balance solver accuracy

  • Exporting to RF Blockset Simulink models, Communications Toolbox, or MATLAB scripts

Circuit-level design

  • Composing arbitrary RF circuits with node wiring (SPICE-like netlist)

  • Designing impedance matching networks (L, Pi, Tee topologies, Richards stubs)

  • Analyzing amplifier stability (K-factor, mu), power gain, and matching conditions

  • Mixer intermodulation analysis and spur-free IF frequency planning

Time-domain and signal integrity

  • Fitting S-parameters to rational models; computing TDR, impulse, step responses

  • Exporting broadband circuit models to SPICE or Verilog-A

  • Building SI channel models from nport blocks, lossy transmission lines, and parasitics

  • Processing complex baseband signals through rf.Amplifier, rf.Mixer, rf.Filter System Objects

  • Full Circuit Envelope time-domain simulation via rfsystem (no Simulink knowledge required)

When NOT to Use

  • Antenna design and radiation patterns -- use Antenna Toolbox

  • RF propagation modeling (path loss, fading, ray tracing) -- use Communications Toolbox or Phased Array System Toolbox

  • SerDes/high-speed serial link equalization (FFE, CTLE, DFE, IBIS-AMI) -- use SerDes Toolbox

  • Radar waveform design or phased arrays -- use Phased Array System Toolbox

Must-Follow Rules

These apply across ALL RF Toolbox workflows. Violating them produces silent errors or blocks execution.

Universal
  1. rfwrite blocks on existing files -- Always pass 'ForceOverwrite', true. Without it, MATLAB opens an interactive overwrite dialog that halts unattended execution.

  2. Elements cannot be reused -- The same element object cannot appear twice in an rfbudget or circuit. Use clone(element) for independent copies.

  3. Element Name must be a valid MATLAB identifier -- No spaces, no special characters. Use 'IFAmp' not 'IF Amp'.

  4. Use tiledlayout/nexttile -- Not subplot. For all multi-panel figures.

  5. rfparam returns complex, not dB -- Always use 20*log10(abs(rfparam(...))) for dB magnitude.

S-Parameters and Network Parameters
  1. sparameters(filename, Z0) is invalid -- Cannot pass reference impedance at load time. Load first, then newref(s, Z0).

  2. rfinterp1 interpolates real/imag independently -- Not magnitude and angle. Can produce artifacts near sharp resonances.

  3. Frequency alignment required for cascade/de-embed -- cascadesparams and deembedsparams require identical frequency vectors. Always rfinterp1 to a common grid first.

  4. deembedsparams always requires 3 arguments -- (sMeasured, sFixture1, sFixture2). For one-sided, pass an ideal thru for the unused side.

  5. Mixed-mode port ordering is the #1 error source -- s2sdd option 1 (default) treats ports 1,2 as positive and 3,4 as negative. Verify which option matches your VNA port numbering.

  6. snp2smp argument order: ports before impedance -- snp2smp(s, portList, Z0), not snp2smp(s, Z0, portList).

rfbudget and Elements
  1. SignalBandwidth is required -- The 4th positional arg to rfbudget. Without it, NF/IP3/SNR remain empty.

  2. Passive NF equals loss -- For rfelement, NF should equal abs(Gain). Prefer attenuator which handles this automatically.

  3. nport Name is positional -- nport('file.s2p', 'MyName'), not name-value syntax.

  4. rffilter: ResponseType is shape, FilterType is algorithm -- rffilter('FilterType', 'Bandpass') errors. Use rffilter('ResponseType', 'Bandpass').

  5. show(b) opens a GUI -- Produces no command-window output. Use properties (b.TransducerGain, b.NF) for programmatic access.

Circuit Composition
  1. setports/setterminals can only be called once -- Plan topology before defining terminals.

  2. 2-port RF elements use 4-node mapping -- add(ckt, [in out inRef outRef], elem) for amplifier, modulator, nport, all txline types. Primitive 2-terminal elements (resistor, capacitor, inductor) use 2-node mapping.

  3. Primitive constructors are positional -- resistor(100, 'R1'), not resistor('Resistance', 100).

  4. setterminals takes a node vector -- setterminals(ckt, [1 2]), not setterminals(ckt, 1, 2).

  5. All txline constructors use name-value pairs only -- No positional arguments.

Amplifier Analysis
  1. powergain gain type string must be last -- powergain(s, 50, 50, 'Gt'), not powergain(s, 'Gt', 50, 50).

  2. powergain returns linear, not dB -- Convert with 10*log10(g) (power gain uses 10x, not 20x).

  3. Gmag returns NaN when conditionally stable -- Use Gmsg at frequencies where K < 1.

Rational Fitting
  1. rational vs rationalfit -- Use rational for new code (AAA). Use rationalfit only for delay extraction.

  2. Single-param fit returns plain vectors; multi-port returns cell arrays -- Always check with iscell(result).

  3. freqresp takes Hz -- Not rad/s. Pass s.Frequencies directly.

System Objects (rf.*)
  1. rf.Amplifier/rf.Mixer use 1-ohm power -- Vin = sqrt(Pin_W). This differs from rfsystem which uses 50-ohm.

  2. rf.Filter frequencies are ABSOLUTE RF -- PassFreq_bp=[2.395e9 2.405e9] means absolute GHz. Not baseband offsets.

  3. Properties locked during use -- Call release(obj) before modifying Nontunable properties.

rfsystem
  1. Requires rfbudget -- rfsystem takes an rfbudget, not raw elements.

  2. close_system needs save flag -- Use close_system(rfs, 0) to discard changes.

  3. IdealizedBaseband only supports amplifier/modulator/rffilter/nport -- Other elements require CircuitEnvelope.

Workflow Quick Reference

TaskEntry PointDetails
Load/plot S-parameterssparameters, rfplot, smithplotreference/sparameters-io.md
Convert S/Z/Y/ABCD, mixed-modezparameters, s2sdd, snp2smpreference/network-conversions.md
Cascade or de-embed networkscascadesparams, deembedsparamsreference/cascade-deembed.md
Create rfbudget elementsamplifier, modulator, rffilter, etc.reference/rfbudget-elements.md
Run cascade budget analysisrfbudget, rfplot(b, 'Pout')reference/rfbudget-analysis.md
Compose RF circuitscircuit, add, setportsreference/circuit-composition.md
Design matching networksmatchingnetwork, richardsreference/matching-networks.md
Analyze amplifier stability/gainstabilityk, powergain, gammamsreference/amplifier-analysis.md
Mixer spurs and IF planningmixerIMT, OpenIFreference/mixer-analysis.md
Fit rational models, TDRrational, stepresp, generateSPICEreference/rational-fitting.md
Build SI channel modelsnport + txlineWRLGC + circuitreference/si-channel-modeling.md
Process complex basebandrf.Amplifier, rf.Mixer, rf.Filterreference/baseband-processing.md
Time-domain system simulationrfsystem, Circuit Envelopereference/system-simulation.md

Conventions

Code Style
  • Use tiledlayout/nexttile for multi-panel figures (not subplot)

  • Always label axes with units (GHz, dB, ns, dBm) and include figure titles

  • Name elements descriptively for readable topology ('LNA', 'DCBlock', 'PCBTrace')

  • Use clone() liberally for element reuse

Script-First Workflow

For design, analysis, or sweep tasks -- write code to .m files on disk, not inline snippets. For quick one-off checks, inline evaluate_matlab_code is fine.

Modern APIs
  • tiledlayout/nexttile instead of subplot

  • datetime instead of datenum

  • rational instead of rationalfit (unless delay extraction needed)

  • smithplot instead of smith

  • rfplot for S-parameter visualization (handles dB conversion automatically)

References

Load the relevant reference file before writing code for a specific workflow. Each reference contains correct calling conventions, constructor arguments, property names, gotchas, and executable code patterns.


Copyright 2026 The MathWorks, Inc.


Files

reference/circuit-composition.md

General-Purpose RF Circuit Composition

Build RF circuits from primitive R/L/C elements, active components (amplifier, modulator, mixerIMT), and nport S-parameter blocks -- all wired between nodes in a SPICE-like netlist. Extract S-parameters, embed subcircuits hierarchically, and convert lumped designs to distributed implementations.

Workflow

  1. Create circuit -- circuit('Name')

  2. Add elements -- Wire to nodes with add

  3. Define ports -- setports for S-parameter extraction or setterminals for subcircuit embedding

  4. Analyze -- sparameters(ckt, freq)

Primitive Elements (2-Terminal)

Each has terminals p (positive) and n (negative). Connect to any two circuit nodes.

r = resistor(100, 'R1');          % positional: value, name
c = capacitor(1e-12, 'C1');
l = inductor(10e-9, 'L1');

Gotcha: Positional constructor ONLY. resistor('Resistance', 100) errors.

Properties: Resistance, Capacitance, Inductance, Name, Terminals.

Handle semantics: Changing a property (e.g., r.Resistance = 200) after adding to a circuit immediately affects the circuit -- no need to re-add.

mutualInductor (4-Terminal, R2023a+)
mi = mutualInductor('Name', 'Xfmr', 'Inductance1', 10e-9, ...
    'Inductance2', 10e-9, 'CouplingCoefficient', 0.95);

Terminals: p1+, p2+, p1-, p2-. Name-value only. Coupling parameter is CouplingCoefficient, NOT MutualInductance.

rfdivider (6-Terminal / 3-Port, R2023a+)

Wilkinson power divider (built-in element):

d = rfdivider('Name', 'Split1', 'Impedance', 50);

Terminals: p1+, p2+, p3+, p1-, p2-, p3-. Add to a circuit with 6 nodes.

Alternatively, build a Wilkinson from primitives -- use resistor() for the isolation resistor (not seriesRLC which is an rfbudget element):

ckt = circuit('Wilkinson');
tl1 = txlineDelayLossless('Z0', 70.7, 'TimeDelay', 104e-12, 'Name', 'TL1');
add(ckt, [1 2 0 0], tl1);                        % input -> output1
add(ckt, [1 3 0 0], clone(tl1));                  % input -> output2
add(ckt, [2 3], resistor(100, 'Riso'));           % isolation resistor between outputs
setports(ckt, [1 0], [2 0], [3 0]);              % 3-port

Active Elements in Circuit

amplifier, modulator, and mixerIMT are 2-port (4-terminal) elements that work in circuit via add(). This lets you build complete RF front-end topologies with active and passive elements in a single netlist.

amplifier in Circuit
lna = amplifier('Gain', 15, 'NF', 2, 'OIP3', 35, 'Name', 'LNA');

ckt = circuit('RxFrontEnd');
add(ckt, [1 2], capacitor(1e-12, 'DCBlk'));   % DC block
add(ckt, [2 3 0 0], lna);                      % LNA: 4-node mapping
add(ckt, [3 4], inductor(2.7e-9, 'Lmatch'));   % matching inductor
setports(ckt, [1 0], [4 0]);

freq = linspace(1e9, 6e9, 500);
s = sparameters(ckt, freq);
modulator in Circuit
mix = modulator('Gain', -6, 'NF', 10, 'OIP3', 20, ...
    'LO', 2.1e9, 'ConverterType', 'Down', 'Name', 'Mixer');

ckt = circuit('DownConv');
add(ckt, [1 2 0 0], mix);
add(ckt, [2 3], resistor(50, 'Rload'));
setports(ckt, [1 0], [3 0]);
mixerIMT in Circuit
m = mixerIMT('LO', 2.1e9, 'ConverterType', 'Down', 'NF', 10, ...
    'ReferenceInputPower', -10, 'NominalOutputPower', -16, 'Name', 'Mixer');

ckt = circuit('MixerStage');
add(ckt, [1 2 0 0], m);    % 4-terminal: p1+->1, p2+->2, p1-->0, p2-->0
setports(ckt, [1 0], [2 0]);
Active Element Node Mapping

All 2-port RF elements have 4 terminals (p1+, p2+, p1-, p2-). This includes: amplifier, modulator, mixerIMT, nport, rffilter, attenuator, phaseshift, and all txline types (txlineDelayLossless, txlineMicrostrip, txlineCoaxial, txlineCPW, txlineStripline, txlineParallelPlate, txlineTwoWire, txlineWRLGC, txlineRLCGLine, txlineElectricalLength). Use 4-node mapping in add:

add(ckt, [nodeIn nodeOut nodeInRef nodeOutRef], element);

For grounded references, the shorthand add(ckt, [nodeIn nodeOut 0 0], element) is typical. Primitive 2-terminal elements (resistor, capacitor, inductor) use 2-node mapping: add(ckt, [nodeA nodeB], element).

Gotcha: Active elements are handle objects -- modifying properties after add immediately affects the circuit. Use clone() for independent copies.

nport Elements

2-port nport has 4 terminals; 4-port nport has 8 terminals:

np = nport('measured.s2p'); np.Name = 'Filter';
add(ckt, [1 2 0 0], np);                      % 2-port: 4 nodes

np4 = nport('device.s4p');
add(ckt, [1 2 3 4 0 0 0 0], np4);            % 4-port: 8 nodes
Identifying Through Paths

Before wiring a multi-port nport, determine which ports are inputs (near-end) and which are outputs (far-end). Look at the lowest-frequency S-parameter data: the off-diagonal elements with the largest magnitude identify the through connections.

s4 = sparameters('device.s4p');
S = s4.Parameters(:,:,1);     % Lowest frequency
disp(abs(S));                  % Largest off-diagonal = through paths
% If S(2,1) and S(4,3) are the largest, then ports 1,3 are inputs and 2,4 are outputs
nport in rfbudget (Port Selection)

For rfbudget use, set Input and Output properties on the nport directly:

np = nport('device.s4p');
np.Input = 1;      % default
np.Output = 3;     % select port 3 as output (default is 2)
b = rfbudget(np, 5e9, 0, 1e6);

Gotcha: nport.Input/Output are for rfbudget only -- in circuit, use node mapping and setports instead.

Cascading Two 4-Port Blocks
n1 = nport('section.s4p'); n2 = clone(n1);
ckt = circuit('Cascade');
add(ckt, [1 5 2 6 0 0 0 0], n1);
add(ckt, [5 3 6 4 0 0 0 0], n2);
setports(ckt, [1 0], [3 0], [2 0], [4 0]);
Adding Transmission Lines to Each Port
tl = txlineDelayLossless('Z0', 50, 'TimeDelay', 33e-12, 'Name', 'TL');
add(ckt, [5 1 0 0], tl);
add(ckt, [6 2 0 0], clone(tl));    % Must clone each

Building Circuits with add

The add method wires element terminals to circuit nodes -- like a SPICE netlist statement.

ckt = circuit('PiFilter');
add(ckt, [1 0], capacitor(1e-12, 'C1'));
add(ckt, [1 2], inductor(10e-9, 'L1'));
add(ckt, [2 0], capacitor(1e-12, 'C2'));
Node Mapping Rules
  • 2-terminal: add(ckt, [nodeA, nodeB], elem) -- maps p->nodeA, n->nodeB

  • 4-terminal: add(ckt, [n1, n2, n3, n4], elem) -- maps p1+->n1, p2+->n2, p1-->n3, p2-->n4

  • 8-terminal (4-port nport): add(ckt, [p1+ p2+ p3+ p4+ p1- p2- p3- p4-], elem)

  • Node 0 is conventionally ground but has no special meaning -- any node can be a reference

  • Nodes are created on-the-fly when first referenced

  • Optional terminal reordering: add(ckt, [3 4], c1, {'n', 'p'})

Key Constraints
  • Elements cannot be shared -- an element added to one circuit cannot be added to another. Use clone() first.

  • Duplicate names auto-suffix -- adding a second 'R1' creates 'R1_1'

  • No remove method -- elements cannot be removed once added. Rebuild the circuit to change topology.

setports vs setterminals

These define how the outside world connects to a circuit. Each can only be called once per circuit.

setports -- For S-Parameter Extraction

Defines port pairs (signal + reference node). Required before sparameters().

setports(ckt, [1 0], [2 0]);           % 2-port: port 1 at node 1, port 2 at node 2
setports(ckt, [1 0], [2 0], [3 0]);    % 3-port

Creates terminals p1+, p1-, p2+, p2-, etc.

setterminals -- For Subcircuit Embedding

Defines individual terminals mapped to nodes. Used when a circuit will be embedded inside another.

setterminals(ckt, [1 2 0], {'in', 'out', 'gnd'});

Gotcha: setterminals takes a single node vector, not separate node arguments. Use setterminals(ckt, [1 2]), not setterminals(ckt, 1, 2). The optional second argument is a cell array of terminal names.

Terminal count is arbitrary (not necessarily even). Nodes must already exist in the circuit.

GoalUse
Extract S-parameters from a standalone circuitsetports
Embed a circuit as a subcircuit in a parentsetterminals
Both (embed AND extract S-params from parent)setterminals on sub, setports on parent

Subcircuit Hierarchy

A circuit with terminals/ports defined can be embedded inside another circuit via add().

lMatch = circuit('LMatch');
add(lMatch, [1 2], inductor(10e-9, 'Ls'));
add(lMatch, [2 0], capacitor(5e-12, 'Cp'));
setterminals(lMatch, [1 2 0], {'in', 'out', 'gnd'});

top = circuit('Cascade');
add(top, [1 2 0], lMatch);
add(top, [2 3 0], clone(lMatch));    % Must clone for reuse
setports(top, [1 0], [3 0]);

freq = linspace(1e9, 6e9, 500);
s = sparameters(top, freq);

Gotcha: A circuit with setports can also be embedded -- its 2N terminals (p1+, p1-, ...) map to 2N parent nodes.

Multi-Port Networks

Pass multiple [signal ground] pairs as separate arguments to setports for N-port extraction:

setports(ckt, [1 0], [2 0], [3 0]);    % 3-port -> 3x3 S-parameter matrix

Gotcha: Each port is a separate [signal ref] pair argument -- do NOT concatenate into one vector. setports(ckt, [1 0 2 0 3 0]) is wrong.

3-Port Extraction Example (Directional Coupler)
ckt = circuit('Coupler');
add(ckt, [1 2], inductor(5e-9, 'L1'));        % input to through
add(ckt, [1 3], capacitor(2e-12, 'Ccoup'));   % input to coupled port
add(ckt, [2 0], resistor(50, 'Rthrough'));    % through port termination
add(ckt, [3 0], resistor(50, 'Rcoupled'));    % coupled port termination
setports(ckt, [1 0], [2 0], [3 0]);          % 3-port: input, through, coupled

freq = linspace(1e9, 6e9, 201);
s = sparameters(ckt, freq);                   % Returns 3x3 S-parameter matrix
rfplot(s, 2, 1); hold on; rfplot(s, 3, 1);   % S21 (through) and S31 (coupling)

Complete RF Front-End Example

Combine passive and active elements in a single circuit:

% Components
dcblk = capacitor(100e-12, 'DCBlock');
lna = amplifier('Gain', 15, 'NF', 2, 'OIP3', 35, 'Name', 'LNA');
bpf = nport('filter.s2p');  bpf.Name = 'BPF';
mix = modulator('Gain', -6, 'NF', 10, 'OIP3', 20, ...
    'LO', 2.1e9, 'ConverterType', 'Down', 'Name', 'Mixer');
ifMatch = circuit('IFMatch');
add(ifMatch, [1 2], inductor(10e-9, 'Ls'));
add(ifMatch, [2 0], capacitor(5e-12, 'Cp'));
setterminals(ifMatch, [1 2 0], {'in', 'out', 'gnd'});

% Assemble
rxCkt = circuit('Receiver');
add(rxCkt, [1 2], dcblk);
add(rxCkt, [2 3 0 0], lna);
add(rxCkt, [3 4 0 0], bpf);
add(rxCkt, [4 5 0 0], mix);
add(rxCkt, [5 6 0], ifMatch);
setports(rxCkt, [1 0], [6 0]);

freq = linspace(0.5e9, 4e9, 500);
s = sparameters(rxCkt, freq);

figure; tiledlayout(1, 2);
nexttile; rfplot(s, 2, 1); title('S21 -- Insertion/Gain');
nexttile; rfplot(s, 1, 1); title('S11 -- Return Loss');

Lumped-to-Distributed (Richards/Kuroda)

richards(ckt, opFreq)                    % L/C -> distributed stubs
kuroda(ckt, el1, el2)                    % Kuroda identity
insertUnitElement(ckt, el, port, freq, Z0)
realize(ckt, txTemplate)                 % Electrical-length -> physical

Circuit Methods

MethodPurpose
add(ckt, nodes, elem)Wire element to nodes
setports(ckt, ...)Define ports for S-param extraction
setterminals(ckt, nodes, names)Define terminals for embedding
sparameters(ckt, freq)Compute S-parameters
sparameters(ckt, freq, Z0)Compute with custom reference impedance
groupdelay(ckt, freq)Compute group delay
clone(ckt)Deep copy circuit and all elements
richards(ckt, opFreq)Convert lumped L/C to distributed stubs
kuroda(ckt, el1, el2)Apply Kuroda identity on txline pairs
insertUnitElement(ckt, el, port, freq, Z0)Insert quarter-wave unit element
realize(ckt, txTemplate)Convert electrical-length lines to physical

Circuit Properties (Read-Only Except Name)

PropertyDescription
ElementsArray of all elements
ElementNamesCell array of element names
NodesInteger vector of all nodes
TerminalsTerminal names (empty until set)
PortsPort names (empty until setports)
ParentPathPath when embedded as subcircuit
ParentNodesParent nodes when embedded

Gotchas

  1. setports/setterminals once only -- calling either a second time errors with "The terminals for this circuit are already set." Plan topology first.

  2. Elements cannot be shared -- always clone() before reuse in a second circuit.

  3. No element removal -- rebuild circuit to change topology.

  4. Node 0 is not special -- it is conventionally used as ground but has no built-in ground behavior. Any node can serve as a port reference.

  5. setterminals requires existing nodes -- all nodes in the node vector must already exist in the circuit (created by prior add calls). setports creates nodes on the fly.

  6. Element Name must be a valid MATLAB identifier -- no spaces, no leading digits. amplifier('Name', 'My LNA') errors.

  7. Active elements use 4-node mapping -- add(ckt, [in out inRef outRef], elem) for amplifier, modulator, mixerIMT, nport. Using only 2 nodes errors for these elements.

  8. nport.Input/Output are for rfbudget only -- in circuit, use node mapping and setports.

  9. All txline constructors are name-value only -- txlineDelayLossless('TL1', 50, 5e-9) errors. Use txlineDelayLossless('Name', 'TL1', 'Z0', 50, 'TimeDelay', 5e-9). Same applies to all txline types.

  10. txlineWRLGC uses Ro, Lo, Co, Go, Gd -- short forms error (e.g., 'L' matches both 'Lo' and 'LineLength'). Always use full property names.

  11. rfwrite blocks on existing files -- Always 'ForceOverwrite', true.

  12. mutualInductor uses name-value pairs only -- no positional constructor arguments. mutualInductor(10e-9, 10e-9, 0.8) errors.

  13. Primitive constructors are positional -- resistor(100), capacitor(1e-12), inductor(10e-9) take a value and optional name string. Name-value syntax errors.

  14. setterminals takes a node vector -- setterminals(ckt, [1 2]), not setterminals(ckt, 1, 2). Separate scalar arguments error.


Copyright 2026 The MathWorks, Inc.


Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
MathWorks
Publisher
MathWorks (Official)
Source
matlab/matlab-agentic-toolkit · skills-catalog/rf-and-mixed-signal/matlab-model-rf · commit 2a7f215
Licence
BSD 2-Clause License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by MathWorks or MathWorks.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-model-rf.zip