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/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 stepProperties 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
| Model | Description | Key Properties |
|---|---|---|
'poly' (default) | Higher-order polynomial from multiple compression params | Gain, OIP3/IIP3, IP1dB/OP1dB, IPsat/OPsat (uses all that are set) |
'cubic' | 3rd-order polynomial from ONE compression param | Gain, Nonlinearity (selects which param), OIP3/IIP3/IP1dB/OP1dB/IPsat/OPsat |
'ampm' | AM/AM and AM/PM lookup table | Table (M-by-3: [Pin_dBm, Pout_dBm, Phase_deg]) |
'modified-rapp' | Modified Rapp model | MagnitudeGainDB, Vsat, MagnitudeSmooth, PhaseGainRadian, PhaseSaturation, PhaseSmooth |
'saleh' | Saleh model | InputScaleDB, 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);| Property | Default | Description |
|---|---|---|
IncludeNoise | false | Enable thermal noise injection |
NoiseType | 'noise-temperature' | 'noise-temperature', 'NF', or 'noise-factor' |
NoiseTemperature | 290 | Noise temperature (K) |
NF | ~3.01 | Noise figure (dB) |
NoiseFactor | 2 | Noise factor (linear) |
SeedSource | 'auto' | 'auto' or 'user' for RNG seed |
Seed | 67987 | RNG seed (when SeedSource='user') |
SampleRate | 1e6 | Sample 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 curvesExample: 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 PhaseOffsetModels
| Model | Description | Input | Output |
|---|---|---|---|
'mod' (default) | RF modulator (up-convert) | Real baseband | Complex RF |
'demod' | RF demodulator (down-convert) | Complex RF | Real baseband |
'iqmod' | IQ modulator (up-convert) | Complex baseband (I+jQ) | Complex RF |
'iqdemod' | IQ demodulator (down-convert) | Complex RF | Complex baseband (I+jQ) |
Properties
| Property | Default | Description |
|---|---|---|
Model | 'mod' | Mixer type |
Sideband | 'upper' | 'upper' or 'lower' sideband selection |
Gain | 0 | Conversion gain (dB) |
RF | 1e9 | RF carrier frequency (Hz) |
LO | 1e8 | Local 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 themNonlinearity
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 enabledVisualization
visualizePower(mix); % Plot power characteristics
visualizePhaseNoise(mix); % Plot phase noise spectrumGotcha: 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
| Property | Default | Description |
|---|---|---|
DesignMethod | 'Butterworth' | 'Butterworth', 'Chebyshev', 'InverseChebyshev' |
ResponseType | 'Lowpass' | 'Lowpass', 'Highpass', 'Bandpass', 'Bandstop' |
UseFilterOrder | false | If true, specify order directly instead of stopband |
FilterOrder | 3 | Filter order (when UseFilterOrder=true) |
PassFreq_lp | 1e9 | Lowpass passband frequency |
PassFreq_bp | [2e9 3e9] | Bandpass passband frequencies |
StopFreq_lp | 2e9 | Lowpass stopband frequency |
StopFreq_bp | [1.5e9 3.5e9] | Bandpass stopband frequencies |
PassAtten | ~3.01 | Passband attenuation (dB) |
StopAtten | 40 | Stopband attenuation (dB) |
RF | 1e9 | Carrier frequency (Hz) |
SampleRate | 1e6 | Sample 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 responserf.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);| DataSource | Input Property | Description |
|---|---|---|
'file' (default) | FileName | 2-port Touchstone file |
'sparameters' | SParametersObject | sparameters object |
'rational' | RationalObject | rational 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 responserf.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);| Property | Default | Description |
|---|---|---|
Model | 'Memory polynomial' | 'Memory polynomial' or 'Cross-term memory' |
CoefficientMatrix | 1+0i | Complex coefficient matrix |
UnitDelay | 1e-6 | Sample 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; % HzInherits 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.mdThis 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 amp1Relationship to rfbudget Elements
| rf.* System Object | rfbudget Element | Key Difference |
|---|---|---|
rf.Amplifier | amplifier | rf.Amplifier adds modified-rapp, saleh models; processes baseband signals |
rf.Mixer | modulator | rf.Mixer adds I/Q imbalance, phase noise; 4 model types |
rf.Filter | rffilter | rf.Filter processes time-domain signals; rffilter is for frequency-domain LC synthesis |
rf.Sparameter | nport | rf.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
R2024b minimum -- rf.Amplifier, rf.Mixer, rf.Filter, rf.Sparameter require R2024b+. rf.PAmemory requires R2024a+.
No Simulink required -- Unlike
rfsystem, the rf.* objects run entirely in MATLAB.SampleRate relevance varies by object -- For
rf.Amplifier, only setSampleRatewhenIncludeNoise=true(emits "not relevant" warning otherwise). Forrf.Mixer, only whenIncludePhaseNoise=true. Butrf.Filterandrf.Sparameteralways requireSampleRate-- it is a core property for those objects.rf.Filter frequency properties are ABSOLUTE RF frequencies --
PassFreq_bp=[2.395e9 2.405e9]means the passband is 2.395-2.405 GHz absolute. TheRFproperty defines the carrier center for internal baseband conversion. Do NOT use baseband offsets (e.g.,PassFreq_lp=5e6withRF=2.4e9produces near-zero output). For a channel filter of bandwidth B at carrier fc, useResponseType='Bandpass'withPassFreq_bp=[fc-B/2, fc+B/2].rf.Filter frequency properties are ResponseType-dependent --
PassFreq_lpfor lowpass,PassFreq_bpfor bandpass, etc. Wrong suffix emits "not relevant" warning and is silently ignored (defaults remain).rf.Filter RF must be positive --
RF=0errors with "Value must be positive."rf.Filter UseFilterOrder and stopband specs -- When
UseFilterOrder=true(or when it defaults to true),StopFreq_*andStopAttenare "not relevant" and emit warnings. SetUseFilterOrder=falseexplicitly if you need to specify stopband attenuation goals.Nonlinearityis only forModel='cubic'-- For the defaultModel='poly', do NOT setNonlinearity(it emits "not relevant" warning). Poly uses all compression params you provide (e.g., OIP3, OP1dB, OPsat for amplifiers) to fit the polynomial. ForModel='cubic',Nonlinearityselects which ONE param shapes the 3rd-order curve. Silent misuse:rf.Amplifier(Gain=15, Model='cubic', OPsat=30)withoutNonlinearity='OPsat'applies no compression (Nonlinearity defaults to OIP3 with OIP3=Inf).rf.Mixer Model is not the same as modulator ConverterType -- rf.Mixer uses
'mod'/'demod'/'iqmod'/'iqdemod'. The rfbudgetmodulatorusesConverterType='Up'/'Down'.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 whenIncludePhaseNoise=true.'iqdemod': RF is relevant, but LO and PhaseOffset are not. Setting irrelevant properties emits "not relevant" warnings.Properties locked during use -- Nontunable properties cannot be changed between step calls. Call
release(obj)before modifying.Input must be column vectors or matrices -- Row vectors error. Each column is an independent channel.
rf.Sparameter default file is unitygain.s2p -- This is a built-in identity file. Always set
FileNameorSParametersObjectexplicitly.rf.Amplifier/rf.Mixer use 1-ohm normalized power --
Vin = sqrt(Pin_W)andPout = |Vout|^2. This differs fromrfsystemwhich 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/nexttilefor multi-panel signal analysis plotsAlways label axes with units (dBm, MHz, degrees) and include figure titles
Call
release(obj)before modifying Nontunable propertiesUse
visualize()orvisualizePower()/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