Matlab Model Rf
MathWorksOfficialCreated by MathWorks
- Skill
- Guidelines
- Science and research
- BSD-2-Clause
- No issues found
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
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/matlab/matlab-model-rf/downloadUnzip 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
rfwriteblocks on existing files -- Always pass'ForceOverwrite', true. Without it, MATLAB opens an interactive overwrite dialog that halts unattended execution.Elements cannot be reused -- The same element object cannot appear twice in an rfbudget or circuit. Use
clone(element)for independent copies.Element Name must be a valid MATLAB identifier -- No spaces, no special characters. Use
'IFAmp'not'IF Amp'.Use
tiledlayout/nexttile-- Notsubplot. For all multi-panel figures.rfparamreturns complex, not dB -- Always use20*log10(abs(rfparam(...)))for dB magnitude.
S-Parameters and Network Parameters
sparameters(filename, Z0)is invalid -- Cannot pass reference impedance at load time. Load first, thennewref(s, Z0).rfinterp1interpolates real/imag independently -- Not magnitude and angle. Can produce artifacts near sharp resonances.Frequency alignment required for cascade/de-embed --
cascadesparamsanddeembedsparamsrequire identical frequency vectors. Alwaysrfinterp1to a common grid first.deembedsparamsalways requires 3 arguments --(sMeasured, sFixture1, sFixture2). For one-sided, pass an ideal thru for the unused side.Mixed-mode port ordering is the #1 error source --
s2sddoption 1 (default) treats ports 1,2 as positive and 3,4 as negative. Verify which option matches your VNA port numbering.snp2smpargument order: ports before impedance --snp2smp(s, portList, Z0), notsnp2smp(s, Z0, portList).
rfbudget and Elements
SignalBandwidthis required -- The 4th positional arg torfbudget. Without it, NF/IP3/SNR remain empty.Passive NF equals loss -- For
rfelement, NF should equalabs(Gain). Preferattenuatorwhich handles this automatically.nportName is positional --nport('file.s2p', 'MyName'), not name-value syntax.rffilter:
ResponseTypeis shape,FilterTypeis algorithm --rffilter('FilterType', 'Bandpass')errors. Userffilter('ResponseType', 'Bandpass').show(b)opens a GUI -- Produces no command-window output. Use properties (b.TransducerGain,b.NF) for programmatic access.
Circuit Composition
setports/setterminalscan only be called once -- Plan topology before defining terminals.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.Primitive constructors are positional --
resistor(100, 'R1'), notresistor('Resistance', 100).setterminalstakes a node vector --setterminals(ckt, [1 2]), notsetterminals(ckt, 1, 2).All txline constructors use name-value pairs only -- No positional arguments.
Amplifier Analysis
powergaingain type string must be last --powergain(s, 50, 50, 'Gt'), notpowergain(s, 'Gt', 50, 50).powergainreturns linear, not dB -- Convert with10*log10(g)(power gain uses 10x, not 20x).Gmagreturns NaN when conditionally stable -- UseGmsgat frequencies where K < 1.
Rational Fitting
rationalvsrationalfit-- Userationalfor new code (AAA). Userationalfitonly for delay extraction.Single-param fit returns plain vectors; multi-port returns cell arrays -- Always check with
iscell(result).freqresptakes Hz -- Not rad/s. Passs.Frequenciesdirectly.
System Objects (rf.*)
rf.Amplifier/rf.Mixer use 1-ohm power --
Vin = sqrt(Pin_W). This differs from rfsystem which uses 50-ohm.rf.Filter frequencies are ABSOLUTE RF --
PassFreq_bp=[2.395e9 2.405e9]means absolute GHz. Not baseband offsets.Properties locked during use -- Call
release(obj)before modifying Nontunable properties.
rfsystem
Requires rfbudget --
rfsystemtakes an rfbudget, not raw elements.close_systemneeds save flag -- Useclose_system(rfs, 0)to discard changes.IdealizedBaseband only supports amplifier/modulator/rffilter/nport -- Other elements require CircuitEnvelope.
Workflow Quick Reference
| Task | Entry Point | Details |
|---|---|---|
| Load/plot S-parameters | sparameters, rfplot, smithplot | reference/sparameters-io.md |
| Convert S/Z/Y/ABCD, mixed-mode | zparameters, s2sdd, snp2smp | reference/network-conversions.md |
| Cascade or de-embed networks | cascadesparams, deembedsparams | reference/cascade-deembed.md |
| Create rfbudget elements | amplifier, modulator, rffilter, etc. | reference/rfbudget-elements.md |
| Run cascade budget analysis | rfbudget, rfplot(b, 'Pout') | reference/rfbudget-analysis.md |
| Compose RF circuits | circuit, add, setports | reference/circuit-composition.md |
| Design matching networks | matchingnetwork, richards | reference/matching-networks.md |
| Analyze amplifier stability/gain | stabilityk, powergain, gammams | reference/amplifier-analysis.md |
| Mixer spurs and IF planning | mixerIMT, OpenIF | reference/mixer-analysis.md |
| Fit rational models, TDR | rational, stepresp, generateSPICE | reference/rational-fitting.md |
| Build SI channel models | nport + txlineWRLGC + circuit | reference/si-channel-modeling.md |
| Process complex baseband | rf.Amplifier, rf.Mixer, rf.Filter | reference/baseband-processing.md |
| Time-domain system simulation | rfsystem, Circuit Envelope | reference/system-simulation.md |
Conventions
Code Style
Use
tiledlayout/nexttilefor multi-panel figures (notsubplot)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/nexttileinstead ofsubplotdatetimeinstead ofdatenumrationalinstead ofrationalfit(unless delay extraction needed)smithplotinstead ofsmithrfplotfor 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
- ATTRIBUTION.mdAdded by AutoGineer1.0 KiB
- LICENSELicence file added by AutoGineer1.4 KiB
- SKILL.md9.8 KiB
- manifest.yaml536 B
- reference/amplifier-analysis.md9.3 KiB
- reference/amplifier-models.md2.8 KiB
- reference/amplifier-nonlinear-models.md6.2 KiB
- reference/baseband-processing.md18.5 KiB
- reference/cascade-deembed.md9.0 KiB
- reference/circle-computations.md7.3 KiB
- reference/circuit-composition.md14.1 KiB
- reference/ifft-step-response.md16.8 KiB
- reference/lumped-to-distributed.md2.7 KiB
- reference/matching-networks.md10.8 KiB
- reference/mixer-analysis.md11.0 KiB
- reference/network-conversions.md9.6 KiB
- reference/rational-fitting.md19.8 KiB
- reference/rfbudget-analysis.md8.4 KiB
- reference/rfbudget-elements.md16.8 KiB
- reference/rffilter-synthesis.md2.8 KiB
- reference/si-channel-modeling.md17.8 KiB
- reference/sparameters-io.md12.0 KiB
- reference/system-simulation.md12.9 KiB
- reference/time-domain-analysis.md3.0 KiB
- reference/transmission-lines.md2.8 KiB
reference/rfbudget-elements.md
rfbudget Element Objects
Create and configure all rfbudget-compatible elements -- active components (amplifier, modulator, attenuator, phaseshift) and passive networks (seriesRLC, shuntRLC, lcladder, rffilter, nport, transmission lines). These are the building blocks for rfbudget cascade analysis and circuit composition.
Element Hierarchy
Active Elements
| Object | Represents | Key Properties |
|---|---|---|
amplifier | Active gain stage (LNA, PA) | Gain, NF, OIP3, Model ('poly'/'cubic'/'ampm'/'sparam') |
modulator | Frequency converter (mixer) | Gain, NF, OIP3, LO, ConverterType ('Down'/'Up') |
rfelement | Generic 2-port (cable, coupler) | Gain, NF, OIP3 |
attenuator | Matched attenuator pad | Attenuation, Zin, Zout |
phaseshift | Lossless phase shifter | PhaseShift (degrees) |
Passive / Data-Driven Elements
| Object | Represents | Key Properties |
|---|---|---|
nport | Component from S-parameter data | Touchstone file or sparameters object |
rffilter | Synthesized LC filter | ResponseType, FilterType, FilterOrder |
rfantenna | Antenna in link budget | Type, Gain, TxEIRP, PathLoss |
seriesRLC | Series R+L+C in signal path | R, L, C |
shuntRLC | Shunt R+L+C to ground | R, L, C |
lcladder | LC ladder filter | Topology, L, C values |
Transmission Lines
All are rfbudget-compatible 2-port: txlineDelayLossless, txlineDelayLossy, txlineMicrostrip, txlineCoaxial, txlineCPW, txlineStripline, txlineRLCGLine, txlineWRLGC, txlineWtable, txlineParallelPlate, txlineTwoWire.
Not rfbudget-compatible: resistor, capacitor, inductor, circuit -- primitive elements for circuit composition only.
amplifier
lna = amplifier('Gain', 15, 'NF', 2, 'OIP3', 35, 'Name', 'LNA');
ampFromFile = amplifier('FileName', 'default.s2p', 'Name', 'LNAMeasured');Properties
| Property | Default | Description |
|---|---|---|
Gain | 0 | Small-signal gain (dB) |
NF | 0 | Noise figure (dB) |
OIP3 / IIP3 | Inf | Third-order intercept (dBm) -- OIP3 = IIP3 + Gain |
OIP2 | Inf | Output second-order intercept (dBm) |
OP1dB / IP1dB | Inf | 1-dB compression (dBm) -- OP1dB = IP1dB + Gain - 1 |
OPsat / IPsat | Inf | Saturation power (dBm) -- independent of each other |
Model | 'poly' | 'poly', 'cubic', 'ampm', 'sparam' |
Zin / Zout | 50 | Impedance (Ohm) |
Name | '' | Element name (must be valid MATLAB identifier) |
Conventions: Amplifiers use output-referred (OIP3, OP1dB, OPsat). Mixers/modulators use input-referred (IIP3, IP1dB, IPsat).
'poly' vs 'cubic': 'poly' (default) uses ALL set compression params to fit a higher-order polynomial. 'cubic' uses only ONE param selected by Nonlinearity. Prefer 'poly'. See reference/amplifier-models.md for detailed compression parameter conventions.
modulator
downMixer = modulator('Gain', -6, 'NF', 10, 'OIP3', 20, ...
'LO', 2.1e9, 'ConverterType', 'Down', 'Name', 'Mixer');
upMixer = modulator('Gain', -8, 'NF', 12, 'OIP3', 18, ...
'LO', 1.5e9, 'ConverterType', 'Up', 'Name', 'UpConv');Properties
| Property | Default | Description |
|---|---|---|
LO | 0 | Local oscillator frequency (Hz) |
ConverterType | 'Down' | 'Down' or 'Up' conversion |
Gain | 0 | Conversion gain/loss (dB) |
NF | 0 | Noise figure (dB) |
OIP3 | Inf | Output IP3 (dBm) |
ImageReject | true | Reject image frequency |
ChannelSelect | true | Select desired channel |
Frequency Behavior
After a modulator, the signal frequency changes. In an rfbudget, subsequent stages operate at the converted frequency. For a down-converter: fOut = fIn - LO (or LO - fIn depending on sideband). For an up-converter: fOut = fIn + LO. Read b.OutputFrequency to see the frequency at each stage output.
rfelement
Use for cables, couplers, or any passive/active component defined by scalar specs:
atten = rfelement('Gain', -10, 'NF', 10, 'Name', 'Atten');
cable = rfelement('Gain', -1.5, 'NF', 1.5, 'Name', 'Cable');Properties
| Property | Default | Description |
|---|---|---|
Gain | 0 | Gain (dB) -- negative for loss |
NF | 0 | Noise figure (dB) |
OIP3 | Inf | Output IP3 (dBm) |
OIP2 | Inf | Output IP2 (dBm) |
Zin | 50 | Input impedance (Ohm) |
Zout | 50 | Output impedance (Ohm) |
Name | '' | Element name |
Gotcha: For passive, NF must equal abs(Gain). A -3 dB attenuator has NF = 3 dB. Setting inconsistent values (e.g., Gain=-3, NF=0) produces incorrect budget results. Prefer attenuator which handles this automatically.
rfantenna
Models a transmit or receive antenna in an rfbudget chain, computing EIRP and received power from TxEIRP, PathLoss, and antenna Gain.
tx = rfantenna('Type', 'Transmitter', 'Gain', 6, 'Name', 'TxAnt');
rx = rfantenna('Type', 'Receiver', 'Gain', 3, 'TxEIRP', 30, ...
'PathLoss', 60, 'Name', 'RxAnt');Properties
| Property | Default | Description |
|---|---|---|
Type | 'Transmitter' | 'Transmitter', 'Receiver', or 'TransmitReceive' |
Gain | 0 | Antenna gain (dB) -- scalar for Tx/Rx, 1x2 [TxGain RxGain] for TransmitReceive |
Z | 50 | Impedance (Ohm) -- scalar or 1x2 for TransmitReceive |
TxEIRP | -30 | Transmitter EIRP (dBm) -- used by Receiver to compute input power |
PathLoss | 0 | Path loss between Tx and Rx (dB) |
Behavior in rfbudget
Transmitter: Placed at end of chain. Adds antenna
GaintoTransducerGainandOutputPower. EIRP = OutputPower at the antenna stage.Receiver: Placed at start of chain. Computes received power as
TxEIRP - PathLoss + Gain. Adds 0 dB toTransducerGain. TheAvailableInputPowerargument torfbudgetis ignored (warning issued). The received power property isRxP.TransmitReceive: Can go anywhere in the chain.
Gainmust be 1x2 vector[TxGain RxGain].
% Receiver link budget: Rx computes its own input power
rx = rfantenna('Type', 'Receiver', 'Gain', 3, 'TxEIRP', 30, ...
'PathLoss', 60, 'Name', 'RxAnt');
lna = amplifier('Gain', 15, 'NF', 2, 'OIP3', 35, 'Name', 'LNA');
b = rfbudget([rx lna], 2.4e9, -30, 10e6);
% Input power = TxEIRP - PathLoss + Gain = 30 - 60 + 3 = -27 dBmGotcha: Only one rfantenna element is allowed per rfbudget chain.
Gotcha: rfantenna is a 1-port element (2 terminals: p1+, p1-). In a circuit, use add(ckt, [1 0], ant) with 2 nodes, not 4.
Gotcha: You cannot call sparameters() directly on an rfbudget object. To extract S-parameters from a budget, first convert to a circuit: sp = sparameters(circuit(b), freq).
attenuator
A dedicated attenuator element that automatically handles NF derivation and impedance matching.
pad = attenuator('Attenuation', 6, 'Name', 'Pad6dB');
pad50to75 = attenuator('Attenuation', 10, 'Zin', 50, 'Zout', 75, 'Name', 'MatchPad');Properties
| Property | Default | Description |
|---|---|---|
Attenuation | 3 | Attenuation in dB (positive value) |
Zin | 50 | Input impedance (Ohm) |
Zout | 50 | Output impedance (Ohm) |
In rfbudget, NF equals Attenuation automatically -- no manual NF setting needed.
Gotcha: When Zin != Zout, there is a minimum attenuation requirement. For example, Zin=50, Zout=75 requires Attenuation > 5.72 dB. MATLAB reports the exact threshold in the error message. Matched impedances (Zin == Zout) have no minimum.
phaseshift
Adds a frequency-independent phase shift with zero insertion loss.
ps = phaseshift('PhaseShift', 90, 'Name', 'PS90');Properties
| Property | Default | Description |
|---|---|---|
PhaseShift | 90 | Phase shift in degrees |
In rfbudget: Gain = 0 dB, NF = 0 dB (lossless). In S-parameters: |S21| = 1, angle(S21) = PhaseShift.
Gotcha: The PhaseShift value maps directly to the S21 phase angle (positive = phase lead, negative = phase lag). PhaseShift=45 gives angle(S21) = +45 deg.
nport
Use when you have measured or simulated S-parameter data. Accepts .s1p through any .snp Touchstone file:
filter = nport('passive.s2p', 'BPFilter'); % Name is positional (2nd arg)
% Or from a sparameters object
s = sparameters(data, freq, 50);
comp = nport(s, 'CustomComp');Accepts
.s1pthrough.snp(1-port works in circuit, not rfbudget).ampfiles NOT supportedFor multi-port: set
InputandOutputproperties for rfbudget port selection
Multi-Port Selection
For components with more than 2 ports, specify which ports to use:
n = nport('default.s4p');
n.Input = 1; % Input port number
n.Output = 3; % Output port number
n.Termination = 50; % Terminate unused portsCreating nport from Synthetic Data
% Build a 4-port sparameters object (e.g., through-path on ports 1->3)
data = zeros(4, 4, 10);
data(3,1,:) = 0.8; data(1,3,:) = 0.8; % S31=S13 (reciprocal through)
data(4,2,:) = 0.8; data(2,4,:) = 0.8; % S42=S24 (second pair)
s4 = sparameters(data, linspace(1e9, 3e9, 10), 50);
comp = nport(s4, 'MyComp');
comp.Input = 1;
comp.Output = 3;rffilter
bpf = rffilter('ResponseType', 'Bandpass', 'FilterType', 'Butterworth', ...
'FilterOrder', 5, 'PassbandFrequency', [2.3e9 2.5e9], 'Name', 'BPF');Key properties: ResponseType (Lowpass/Highpass/Bandpass/Bandstop), FilterType (Butterworth/Chebyshev/InverseChebyshev), FilterOrder, PassbandFrequency (scalar for LP/HP, 2-vector for BP/BS). See reference/rffilter-synthesis.md for full design options.
Gotcha: ResponseType is shape (Lowpass/Bandpass/etc.), FilterType is algorithm (Butterworth/Chebyshev). Using rffilter('FilterType', 'Bandpass') errors.
seriesRLC and shuntRLC
Series Elements (In-Line with Signal Path)
L1 = seriesRLC('L', 2.7e-9, 'Name', 'Lseries'); % Inductor only
C1 = seriesRLC('C', 1.2e-12, 'Name', 'DCBlock'); % DC blocking cap
R1 = seriesRLC('R', 50, 'Name', 'Rpad'); % Resistor only
rlc = seriesRLC('R', 10, 'L', 1e-9, 'C', 0.5e-12, 'Name', 'RLC1');Shunt Elements (To Ground)
Cbypass = shuntRLC('C', 100e-12, 'Name', 'Cbypass'); % Bypass cap
Lchoke = shuntRLC('L', 100e-9, 'Name', 'Lchoke'); % RF choke
Rterm = shuntRLC('R', 50, 'Name', 'Rterm'); % TerminationOmitted values default to "absent": seriesRLC uses R=0, L=0, C=Inf (wire-through); shuntRLC uses R=Inf, L=Inf, C=0 (open-circuit).
rfbudget vs circuit Topology Difference
In rfbudget, shuntRLC is modeled as a 2-port inline element (computing insertion loss from its shunt impedance to ground). In a circuit object, add(ckt, [node 0], shuntRLC(...)) wires the element literally between a signal node and ground -- this is a different topology. For example, a bias-tee inductor (shuntRLC('L', 100e-9)) shows near-zero insertion loss in rfbudget at RF frequencies, but if wired as add(ckt, [2 0], ...) in a circuit it appears as a shunt path to ground and dominates the S21 response. Use rfbudget for cascade analysis of bias tees; use circuit only when modeling the full node-level topology.
Common Building Blocks
| Block | Implementation |
|---|---|
| DC block | seriesRLC('C', 100e-12, 'Name', 'DCBlk') |
| Bias tee inductor | shuntRLC('L', 100e-9, 'Name', 'Lbias') |
| Pad attenuator | seriesRLC('R', Rseries) + shuntRLC('R', Rshunt) |
| Termination | shuntRLC('R', 50, 'Name', 'Term') |
lcladder
LC ladder filter networks. Created from a topology string, inductor values, and capacitor values.
lc = lcladder('lowpasspi', [10e-9 10e-9], [1e-12 1e-12 1e-12], 'LPF');
lc = lcladder(rffilterObj, 'BPF');Topologies
| Topology String | Description |
|---|---|
'lowpasspi' | Low-pass pi |
'lowpasstee' | Low-pass tee |
'highpasspi' | High-pass pi |
'highpasstee' | High-pass tee |
'bandpasspi' | Band-pass pi |
'bandpasstee' | Band-pass tee |
'bandstoppi' | Band-stop pi |
'bandstoptee' | Band-stop tee |
Gotcha: lcladder constructor is positional -- lcladder(topology, L, C, name), not name-value pairs.
Gotcha: Topology strings are all lowercase ('lowpasspi', 'bandpasstee'). Using mixed-case like 'LowpassPi' or abbreviations like 'CLC' errors with "not a valid LC Ladder topology."
Transmission Lines
All transmission line objects are 2-port and rfbudget-compatible. Use LineLength for physical length (not Length). See reference/transmission-lines.md for all types and properties.
tl = txlineDelayLossless('Z0', 50, 'TimeDelay', 33e-12, 'Name', 'TL1');
rlcg = txlineRLCGLine('R', 0.5, 'L', 250e-9, 'C', 100e-12, 'G', 0, 'LineLength', 0.05);
tw = txlineWRLGC('Lo', 350e-9, 'Co', 130e-12, 'Ro', 2, 'Rs', 5e-4, 'Gd', 1e-11, ...
'LineLength', 0.1, 'Name', 'WLine');All use
LineLengthfor physical length (notLength)All constructors are name-value only (no positional)
txlineWRLGCproperties areRo,Lo,Co,Go,Gd-- short formsR,Lare ambiguous and error
Using in rfbudget
All elements plug directly into rfbudget's element array:
lna = amplifier('Name', 'LNA', 'Gain', 15, 'NF', 1.5, 'OIP3', 20);
dcblk = seriesRLC('C', 100e-12, 'Name', 'DCBlock');
bpf = lcladder(rffilter('ResponseType', 'Bandpass', 'FilterOrder', 3, ...
'PassbandFrequency', [2.3e9 2.5e9]), 'BPF');
% Positional form: rfbudget(elements, freq, inputPower, signalBW)
b = rfbudget([dcblk lna bpf], 2.4e9, -30, 10e6);
% Name-value form (equivalent):
% b = rfbudget('Elements', [dcblk lna bpf], 'InputFrequency', 2.4e9, ...
% 'AvailableInputPower', -30, 'SignalBandwidth', 10e6);
show(b); % Opens GUI table; no command-window outputCritical: SignalBandwidth (4th positional arg) is required for NF, IP3, and SNR computation. Without it, those fields remain empty.
Element Reuse Requires clone()
An element object cannot appear more than once in the same chain or across separate budgets. Use clone() every time you need a second instance:
% ERROR: same object used twice
% b = rfbudget([lna filter lna], 2.4e9, -30, 10e6);
% CORRECT: clone for the second use
b = rfbudget([lna filter clone(lna)], 2.4e9, -30, 10e6);
% CORRECT: reuse across two budgets
b1 = rfbudget(lna, 2.4e9, -30, 10e6);
b2 = rfbudget(clone(lna), 5.8e9, -30, 10e6);circuit Objects Are NOT rfbudget-Compatible
A circuit object cannot be added to rfbudget directly. Workaround -- convert to nport via Touchstone:
% Build circuit
ckt = circuit('MyNetwork');
add(ckt, [1 2], seriesRLC('L', 10e-9, 'Name', 'L1'));
add(ckt, [2 0], shuntRLC('C', 1e-12, 'Name', 'C1'));
setports(ckt, [1 0], [2 0]);
% Convert to nport for rfbudget
s = sparameters(ckt, linspace(1e9, 6e9, 500));
outFile = 'mynetwork.s2p';
rfwrite(s, outFile, 'ForceOverwrite', true);
np = nport(outFile, 'MyNetwork');
% np works in rfbudgetStandalone S-Parameter Analysis
Any element can compute S-parameters directly without wrapping in a circuit:
freq = linspace(1e9, 10e9, 500);
s = sparameters(mstrip, freq);
figure;
tiledlayout(1, 2);
nexttile; rfplot(s, 2, 1); title('S21 -- Insertion Loss');
nexttile; rfplot(s, 1, 1); title('S11 -- Return Loss');Gotchas
Name must be valid MATLAB identifier -- no spaces
Elements are handle objects -- modifying an element after adding it to a budget changes the budget; use
clonefor independent copiesPassive NF equals loss -- prefer
attenuatornport uses ports 1 (input) and 2 (output) by default -- for multi-port files, set
InputandOutputexplicitlynport Name is positional --
nport('file.s2p', 'MyName'), not NV syntax;nport('file.s2p', 'Name', 'X')sets Name to literal'Name'rffilter is ideal -- no parasitic effects
rfantenna is 1-port -- one per chain; in circuit use
add(ckt, [1 0], ant)with 2 nodesattenuator minimum for mismatched Z --
Zin=50, Zout=75requiresAttenuation > 5.72 dB; error message gives threshold'poly'vs'cubic'--'poly'uses all params,'cubic'uses one selected by Nonlinearitylcladder constructor is positional --
lcladder(topology, L, C, name), not name-value pairslcladder topology strings all lowercase --
'lowpasspi'not'LowpassPi'circuit objects don't work in rfbudget -- convert via nport + Touchstone
rfwriteblocks on existing files -- Always'ForceOverwrite', truephaseshift sign convention -- positive
PhaseShift= positive S21 phase angle (phase lead)Cannot call sparameters() on rfbudget -- convert to circuit first:
sparameters(circuit(b), freq)
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.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-model-rf.zip