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://mp-staging.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/baseband-processing.md

RF Component System Objects (Complex Baseband)

Process complex baseband RF signals through standalone System Objects -- amplifiers, mixers, filters, S-parameter models, and power amplifiers with memory. All objects follow the standard System Object lifecycle (step/reset/release) and process data entirely in MATLAB with no Simulink dependency.

Requires R2024b+ (rf.PAmemory: R2024a+).

System Object Lifecycle

All rf.* System Objects share this pattern:

obj = rf.Amplifier(Gain=15, OIP3=35);   % Create
out = obj(in);                            % Step (process one frame)
reset(obj);                               % Reset internal state
out2 = obj(in2);                          % Step again
release(obj);                             % Release (allows property changes)
obj.Gain = 20;                            % Modify properties
out3 = obj(in3);                          % Re-setup on next step

Properties are locked between first step and release. Attempting to change a Nontunable property without calling release first errors. Tunable properties (like Gain) can be changed between step calls.

rf.Amplifier -- Nonlinear Amplifier Models

Construction
amp = rf.Amplifier;                                    % All defaults
amp = rf.Amplifier(Gain=15, OIP3=35);                 % Polynomial (default)
amp = rf.Amplifier(Model='ampm', Table=ampmData);     % AM/PM table
amp = rf.Amplifier(Model='modified-rapp', MagnitudeGainDB=15, Vsat=1.5);
amp = rf.Amplifier(Model='saleh', InputScaleDB=-10);
Nonlinear Models
ModelDescriptionKey Properties
'poly' (default)Higher-order polynomial from multiple compression paramsGain, OIP3/IIP3, IP1dB/OP1dB, IPsat/OPsat (uses all that are set)
'cubic'3rd-order polynomial from ONE compression paramGain, Nonlinearity (selects which param), OIP3/IIP3/IP1dB/OP1dB/IPsat/OPsat
'ampm'AM/AM and AM/PM lookup tableTable (M-by-3: [Pin_dBm, Pout_dBm, Phase_deg])
'modified-rapp'Modified Rapp modelMagnitudeGainDB, Vsat, MagnitudeSmooth, PhaseGainRadian, PhaseSaturation, PhaseSmooth
'saleh'Saleh modelInputScaleDB, AmAmParameters, AmPmParameters, OutputScaleDB

Matching P1dB across models: Only poly/cubic accept OP1dB directly. For modified-rapp and saleh, find P1dB by sweeping input power. See reference/amplifier-nonlinear-models.md for the numeric sweep recipe, AM/AM comparison across model types, poly-vs-cubic details, compression I/O conventions, and Nonlinearity property gotchas.

Noise
amp = rf.Amplifier(Gain=15, OIP3=35, ...
    IncludeNoise=true, NoiseType='NF', NF=2, ...
    SampleRate=10e6);
PropertyDefaultDescription
IncludeNoisefalseEnable thermal noise injection
NoiseType'noise-temperature''noise-temperature', 'NF', or 'noise-factor'
NoiseTemperature290Noise temperature (K)
NF~3.01Noise figure (dB)
NoiseFactor2Noise factor (linear)
SeedSource'auto''auto' or 'user' for RNG seed
Seed67987RNG seed (when SeedSource='user')
SampleRate1e6Sample rate (Hz) -- only set when IncludeNoise=true; emits "not relevant" warning otherwise
Visualization
amp = rf.Amplifier(Gain=15, OIP3=35);
visualize(amp);   % Plots AM/AM and AM/PM curves
Example: 16-QAM Through Nonlinear Amplifier
amp = rf.Amplifier(Gain=15, OIP3=35);

% Generate 16-QAM signal
rng(42);
data = randi([0 15], 1000, 1);
modSig = qammod(data, 16, UnitAveragePower=true);

% Scale to desired input power level (1-ohm normalized: Vin = sqrt(Pin_W))
Pin_dBm = -20;
Pin_W = 10^((Pin_dBm - 30) / 10);
Vin = sqrt(Pin_W);
inSig = Vin * modSig;

% Amplify
outSig = amp(inSig);

% Measure (1-ohm: Pout = |Vout|^2)
Pout = 10*log10(mean(abs(outSig).^2)) + 30;
gain = 10*log10(mean(abs(outSig).^2) / mean(abs(inSig).^2));
fprintf('Gain: %.2f dB, Pout: %.2f dBm\n', gain, Pout);

release(amp);

rf.Mixer -- Modulator/Demodulator with Impairments

Construction
mix = rf.Mixer;                                       % All defaults (modulator)
mix = rf.Mixer(Model='demod', Gain=-6, RF=2.4e9, LO=2.1e9);
mix = rf.Mixer(Model='iqmod', Gain=-8);               % No RF or PhaseOffset needed
mix = rf.Mixer(Model='iqdemod', Gain=-6, RF=2.4e9);  % RF relevant; no LO or PhaseOffset
Models
ModelDescriptionInputOutput
'mod' (default)RF modulator (up-convert)Real basebandComplex RF
'demod'RF demodulator (down-convert)Complex RFReal baseband
'iqmod'IQ modulator (up-convert)Complex baseband (I+jQ)Complex RF
'iqdemod'IQ demodulator (down-convert)Complex RFComplex baseband (I+jQ)
Properties
PropertyDefaultDescription
Model'mod'Mixer type
Sideband'upper''upper' or 'lower' sideband selection
Gain0Conversion gain (dB)
RF1e9RF carrier frequency (Hz)
LO1e8Local oscillator frequency (Hz)
Impairments
mix = rf.Mixer(Model='iqdemod', Gain=-6, RF=2.4e9, ...
    GainImbalance=0.5, ...     % I/Q gain imbalance (dB)
    PhaseImbalance=2);         % I/Q phase imbalance (degrees)
% Note: LO and PhaseOffset are not relevant for iqmod/iqdemod -- omit them
Nonlinearity
mix = rf.Mixer(Model='demod', Gain=-6, RF=2.4e9, LO=2.1e9, ...
    Nonlinearity='IIP3', IIP3=10);

Same compression options as rf.Amplifier: IIP3, OIP3, IP1dB, OP1dB, IPsat, OPsat.

Phase Noise
mix = rf.Mixer(Model='demod', Gain=-6, RF=2.4e9, LO=2.1e9, ...
    IncludePhaseNoise=true, ...
    PhaseNoiseLevel=[-80 -100 -120], ...           % dBc/Hz at offsets
    PhaseNoiseFrequencyOffset=[1e3 10e3 100e3], ... % Hz offsets
    SampleRate=10e6);   % SampleRate only relevant when noise/phase-noise enabled
Visualization
visualizePower(mix);       % Plot power characteristics
visualizePhaseNoise(mix);  % Plot phase noise spectrum

Gotcha: For 'iqmod', RF and PhaseOffset are irrelevant (emit "not relevant" warnings). LO does not warn and does not affect frequency conversion, but it scales phase noise when IncludePhaseNoise=true -- set it to the intended carrier frequency only if modeling phase noise. For 'iqdemod', RF IS relevant (no warning), but LO and PhaseOffset are not relevant and emit warnings. This asymmetry is because iqdemod needs the carrier reference for demodulation while iqmod operates purely at baseband (no frequency conversion).

Example: IQ Demodulation
mix = rf.Mixer(Model='iqdemod', Gain=-6, RF=2.4e9, ...
    GainImbalance=0.3, PhaseImbalance=1.5);

% Simulate received RF signal (complex)
t = (0:999)' / 10e6;
rfSig = exp(1j * 2*pi * 5e6 * t);   % 5 MHz tone at carrier

bbOut = mix(rfSig);                   % Complex baseband output with impairments
release(mix);

rf.Filter -- Complex Baseband Filter

Construction
filt = rf.Filter;
filt = rf.Filter(DesignMethod='Butterworth', ResponseType='Bandpass', ...
    PassFreq_bp=[2.395e9 2.405e9], RF=2.4e9, SampleRate=100e6);
Frequency Convention (Critical)

All PassFreq_* and StopFreq_* properties specify absolute RF frequencies (not baseband offsets). The RF property defines the carrier center, and the filter internally translates to baseband representation.

% CORRECT: 10 MHz channel filter centered at 2.4 GHz
filt = rf.Filter(ResponseType='Bandpass', ...
    PassFreq_bp=[2.395e9 2.405e9], ...   % Absolute: carrier +/- 5 MHz
    RF=2.4e9, SampleRate=100e6);

% WRONG: This creates a filter passing 0-5 MHz absolute (2.4 GHz away from carrier)
filt = rf.Filter(ResponseType='Lowpass', ...
    PassFreq_lp=5e6, RF=2.4e9, SampleRate=100e6);  % Near-zero output!

For a lowpass channel filter of bandwidth B around carrier fc, use ResponseType='Bandpass' with PassFreq_bp=[fc-B/2, fc+B/2] and RF=fc.

Gotcha: RF must be positive -- RF=0 errors with "Value must be positive."

UseFilterOrder

By default (UseFilterOrder=false), filter order is computed automatically from passband/stopband attenuation specs. When UseFilterOrder=true, specify FilterOrder directly and StopFreq_*/StopAtten properties are ignored (warnings emitted if set).

% Auto-order from specs (UseFilterOrder=false, the default)
filt = rf.Filter(ResponseType='Bandpass', ...
    PassFreq_bp=[2.395e9 2.405e9], StopFreq_bp=[2.39e9 2.41e9], ...
    StopAtten=40, RF=2.4e9, SampleRate=100e6);

% Fixed order (UseFilterOrder=true) -- StopFreq/StopAtten ignored
filt = rf.Filter(ResponseType='Bandpass', UseFilterOrder=true, FilterOrder=5, ...
    PassFreq_bp=[2.395e9 2.405e9], RF=2.4e9, SampleRate=100e6);
Properties
PropertyDefaultDescription
DesignMethod'Butterworth''Butterworth', 'Chebyshev', 'InverseChebyshev'
ResponseType'Lowpass''Lowpass', 'Highpass', 'Bandpass', 'Bandstop'
UseFilterOrderfalseIf true, specify order directly instead of stopband
FilterOrder3Filter order (when UseFilterOrder=true)
PassFreq_lp1e9Lowpass passband frequency
PassFreq_bp[2e9 3e9]Bandpass passband frequencies
StopFreq_lp2e9Lowpass stopband frequency
StopFreq_bp[1.5e9 3.5e9]Bandpass stopband frequencies
PassAtten~3.01Passband attenuation (dB)
StopAtten40Stopband attenuation (dB)
RF1e9Carrier frequency (Hz)
SampleRate1e6Sample rate (Hz)

Gotcha: Passband/stopband frequency properties change name based on ResponseType: PassFreq_lp, PassFreq_hp, PassFreq_bp, PassFreq_bs. Setting the wrong suffix for the current ResponseType has no effect.

Visualization
visualize(filt);   % Plot filter frequency response

rf.Sparameter -- S-Parameter System Model

Process complex baseband signals through S-parameter data using rational fitting:

Construction
% From Touchstone file (default)
sp = rf.Sparameter(FileName='passive.s2p', CarrierFrequency=2.4e9, SampleRate=10e6);

% From sparameters object
sObj = sparameters('device.s2p');
sp = rf.Sparameter(DataSource='sparameters', SParametersObject=sObj, ...
    CarrierFrequency=2.4e9, SampleRate=10e6);

% From rational fit object
fitObj = rational(sparameters('device.s2p'));
sp = rf.Sparameter(DataSource='rational', RationalObject=fitObj, ...
    CarrierFrequency=2.4e9, SampleRate=10e6);
DataSourceInput PropertyDescription
'file' (default)FileName2-port Touchstone file
'sparameters'SParametersObjectsparameters object
'rational'RationalObjectrational fit object
Example: Process Signal Through Synthetic S-Parameters
freq = linspace(1e9, 4e9, 101)';
s21 = 0.8 * exp(-1j*2*pi*freq*1e-9);  % ~-2 dB, linear phase
sData = zeros(2,2,numel(freq));
sData(1,1,:) = 0.1; sData(2,1,:) = s21;
sData(1,2,:) = s21; sData(2,2,:) = 0.1;
sObj = sparameters(sData, freq);
sp = rf.Sparameter(DataSource='sparameters', SParametersObject=sObj, ...
    CarrierFrequency=2.4e9, SampleRate=10e6);
outSig = sp(randn(1000,1) + 1j*randn(1000,1));
release(sp);
Visualization
visualize(sp);   % Plot S-parameter frequency response

rf.PAmemory -- Power Amplifier with Memory

Model nonlinear power amplifiers with memory effects using Volterra series:

pa = rf.PAmemory;
pa = rf.PAmemory(Model='Memory polynomial', CoefficientMatrix=coeffs);
pa = rf.PAmemory(Model='Cross-term memory', CoefficientMatrix=coeffs);
PropertyDefaultDescription
Model'Memory polynomial''Memory polynomial' or 'Cross-term memory'
CoefficientMatrix1+0iComplex coefficient matrix
UnitDelay1e-6Sample time of measured input-output data (s)

The coefficient matrix dimensions encode the nonlinear order and memory depth. See the ComputePACoefficientMatrixExample for extracting coefficients from measured data.

rf.MismatchLoss -- Impedance Mismatch

Model frequency-dependent impedance mismatch loss:

ml = rf.MismatchLoss;
ml.MismatchLossData = lossValues;           % dB loss values
ml.MismatchLossFrequency = freqPoints;      % Hz

Inherits from rf.Sparameter. Typically used in idealized baseband simulation chains to model inter-stage mismatch.

Common Patterns

Power Measurement (1-Ohm Convention)
% rf.Amplifier/rf.Mixer use 1-ohm normalized power: P = |V|^2
Vin = sqrt(Pin_W);                     % NOT sqrt(2*50*Pin_W)
Pout_dBm = 10*log10(mean(abs(out).^2)) + 30;

% rfsystem uses 50-ohm: P = |V|^2 / (2*50) -- see reference/system-simulation.md

This differs from rfsystem which uses 50-ohm scaling. Using 50-ohm scaling with rf.Amplifier gives wrong P1dB values (compression 20 dB too early). The 1-ohm convention ensures OIP3/OP1dB specs match the measured compression point.

EVM Measurement
% After amplifier
outNorm = out / mean(abs(out)) * mean(abs(inSig));
evmPct = 100 * rms(outNorm - inSig) / rms(inSig);
Cascading Multiple System Objects
fc = 2.4e9; fs = 100e6;
amp = rf.Amplifier(Gain=15, OIP3=35);
filt = rf.Filter(DesignMethod='Butterworth', ResponseType='Bandpass', ...
    PassFreq_bp=[fc-5e6, fc+5e6], RF=fc, SampleRate=fs);
out1 = amp(inSig);
out2 = filt(out1);

When cascading, ensure SampleRate is consistent across all objects that use it (rf.Filter, rf.Sparameter, and rf.Amplifier/rf.Mixer when noise is enabled). The RF property on rf.Filter must match the carrier frequency of the signal being processed.

For full-system cascaded simulation with automatic Simulink model generation, use rfsystem instead (see reference/system-simulation.md).

Clone for Independent Copies
amp1 = rf.Amplifier(Gain=15, OIP3=35);
amp2 = clone(amp1);   % Independent copy
amp2.Gain = 20;       % Does not affect amp1

Relationship to rfbudget Elements

rf.* System Objectrfbudget ElementKey Difference
rf.Amplifieramplifierrf.Amplifier adds modified-rapp, saleh models; processes baseband signals
rf.Mixermodulatorrf.Mixer adds I/Q imbalance, phase noise; 4 model types
rf.Filterrffilterrf.Filter processes time-domain signals; rffilter is for frequency-domain LC synthesis
rf.Sparameternportrf.Sparameter processes baseband signals through S-param data

The rf.* objects process complex baseband signals frame-by-frame. The rfbudget elements define frequency-domain specifications for cascade analysis. Use rfsystem to bridge between them (see reference/system-simulation.md).

Gotchas

  1. R2024b minimum -- rf.Amplifier, rf.Mixer, rf.Filter, rf.Sparameter require R2024b+. rf.PAmemory requires R2024a+.

  2. No Simulink required -- Unlike rfsystem, the rf.* objects run entirely in MATLAB.

  3. SampleRate relevance varies by object -- For rf.Amplifier, only set SampleRate when IncludeNoise=true (emits "not relevant" warning otherwise). For rf.Mixer, only when IncludePhaseNoise=true. But rf.Filter and rf.Sparameter always require SampleRate -- it is a core property for those objects.

  4. rf.Filter frequency properties are ABSOLUTE RF frequencies -- PassFreq_bp=[2.395e9 2.405e9] means the passband is 2.395-2.405 GHz absolute. The RF property defines the carrier center for internal baseband conversion. Do NOT use baseband offsets (e.g., PassFreq_lp=5e6 with RF=2.4e9 produces near-zero output). For a channel filter of bandwidth B at carrier fc, use ResponseType='Bandpass' with PassFreq_bp=[fc-B/2, fc+B/2].

  5. rf.Filter frequency properties are ResponseType-dependent -- PassFreq_lp for lowpass, PassFreq_bp for bandpass, etc. Wrong suffix emits "not relevant" warning and is silently ignored (defaults remain).

  6. rf.Filter RF must be positive -- RF=0 errors with "Value must be positive."

  7. rf.Filter UseFilterOrder and stopband specs -- When UseFilterOrder=true (or when it defaults to true), StopFreq_* and StopAtten are "not relevant" and emit warnings. Set UseFilterOrder=false explicitly if you need to specify stopband attenuation goals.

  8. Nonlinearity is only for Model='cubic' -- For the default Model='poly', do NOT set Nonlinearity (it emits "not relevant" warning). Poly uses all compression params you provide (e.g., OIP3, OP1dB, OPsat for amplifiers) to fit the polynomial. For Model='cubic', Nonlinearity selects which ONE param shapes the 3rd-order curve. Silent misuse: rf.Amplifier(Gain=15, Model='cubic', OPsat=30) without Nonlinearity='OPsat' applies no compression (Nonlinearity defaults to OIP3 with OIP3=Inf).

  9. rf.Mixer Model is not the same as modulator ConverterType -- rf.Mixer uses 'mod'/'demod'/'iqmod'/'iqdemod'. The rfbudget modulator uses ConverterType='Up'/'Down'.

  10. rf.Mixer IQ model property relevance is asymmetric -- 'iqmod': RF and PhaseOffset are irrelevant (emit warnings). LO does not warn and does not affect frequency conversion, but scales phase noise when IncludePhaseNoise=true. 'iqdemod': RF is relevant, but LO and PhaseOffset are not. Setting irrelevant properties emits "not relevant" warnings.

  11. Properties locked during use -- Nontunable properties cannot be changed between step calls. Call release(obj) before modifying.

  12. Input must be column vectors or matrices -- Row vectors error. Each column is an independent channel.

  13. rf.Sparameter default file is unitygain.s2p -- This is a built-in identity file. Always set FileName or SParametersObject explicitly.

  14. rf.Amplifier/rf.Mixer use 1-ohm normalized power -- Vin = sqrt(Pin_W) and Pout = |Vout|^2. This differs from rfsystem which uses 50-ohm (Vin = sqrt(2*50*Pin_W)). Using 50-ohm scaling with rf.Amplifier gives wrong P1dB values (compression 20 dB too early). The 1-ohm convention ensures OIP3/OP1dB specs match the measured compression point.

Conventions

  • Use tiledlayout/nexttile for multi-panel signal analysis plots

  • Always label axes with units (dBm, MHz, degrees) and include figure titles

  • Call release(obj) before modifying Nontunable properties

  • Use visualize() or visualizePower()/visualizePhaseNoise() to inspect component behavior before simulation


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