Skip to main content
ClaudeWave
ES, Spanish
Skill1.2k estrellas del repoactualizado 6d ago

matlab-analyze-rf-amplifier

This skill analyzes RF amplifier characteristics from S-parameter data, computing stability metrics like the Rollett K-factor and mu parameter, calculating gain figures including maximum available gain and transducer gain, and evaluating input/output matching conditions. Use it when assessing whether an active device is unconditionally stable, determining appropriate gain metrics for circuit design, analyzing impedance matching requirements, or validating S-parameter data quality through passivity and causality checks.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/matlab/matlab-agentic-toolkit /tmp/matlab-analyze-rf-amplifier && cp -r /tmp/matlab-analyze-rf-amplifier/skills-catalog/rf-and-mixed-signal/matlab-analyze-rf-amplifier ~/.claude/skills/matlab-analyze-rf-amplifier
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# RF Amplifier Analysis

Evaluate stability, power gain, matching, and quality of active RF devices using S-parameter data.

## When to Use

- Evaluating unconditional stability via Rollett K-factor or Edwards-Sinsky mu
- Computing maximum available gain (Gmag), maximum stable gain (Gmsg), or transducer gain
- Computing input/output reflection coefficients for matching design
- Checking passivity and causality of S-parameter data
- Simultaneous conjugate match analysis with gammams/gammaml

## When NOT to Use

- Loading or plotting S-parameter data -- use `matlab-manage-sparameters`
- Fitting rational models or computing TDR -- use `matlab-fit-rational-model`
- Designing impedance matching networks -- use `matlab-design-matching-network`
- Defining amplifier elements for rfbudget -- use `matlab-create-rfbudget-elements`

## Workflow

1. **Load device data** — Load amplifier S-parameters (see `matlab-manage-sparameters` skill)
2. **Check passivity/causality** — Confirm data quality; active devices are expected to be non-passive
3. **Evaluate stability** — Compute K-factor and/or mu across frequency
4. **Compute gain** — Select appropriate gain metric based on stability and application
5. **Analyze matching** — Compute reflection coefficients for impedance matching design

## Passivity and Causality

### Passivity

A passive network cannot produce energy. Active devices (amplifiers) are expected to fail passivity — that is normal.

```matlab
[isPass, idxNonPass] = ispassive(s);
if ~isPass
    fprintf('Non-passive at %d of %d frequencies\n', numel(idxNonPass), numel(s.Frequencies));
    sFixed = makepassive(s);            % Enforce passivity
end
```

**Gotcha:** `makepassive(sparametersObj)` directly modifies S-parameter data point-by-point to force passivity — it does not optimize. This is different from `makepassive(fitObj)` on a rational fit, which performs an optimization over the fit residues (see `matlab-fit-rational-model` skill). Only use `makepassive` on S-parameter data for small numerical violations (e.g., measurement noise on passive devices). It is NOT appropriate for active devices — the result will not represent the original network.

### Causality

```matlab
if iscausal(s)
    disp('S-parameters are causal');
end
```

## Stability Analysis

### Rollett Stability Factor (K)

The classic two-condition test for unconditional stability:

```matlab
[k, b1, b2, delta] = stabilityk(s);
% Unconditionally stable when K > 1 AND |delta| < 1
isUnconditional = (k > 1) & (abs(delta) < 1);

fprintf('K range: %.3f to %.3f\n', min(k), max(k));
fprintf('Unconditionally stable at %d of %d frequencies\n', ...
    sum(isUnconditional), numel(k));
```

**Output meanings:**
- `k` — Rollett stability factor (unconditionally stable when K > 1)
- `b1` — Auxiliary stability measure: `1 - |S11|^2 - |S22|^2 + |delta|^2`. Sign of `b1` indicates which stability circle (source or load) contains the Smith chart center. Positive `b1` means the stable region for the source includes the center.
- `b2` — Same as `b1` but for the load plane: `1 - |S22|^2 - |S11|^2 + |delta|^2` (symmetric formula)
- `delta` — Determinant of the S-matrix: `S11*S22 - S12*S21`. Unconditional stability requires `|delta| < 1` in addition to K > 1.

### Edwards-Sinsky Stability Factor (mu)

Single-condition test — preferred because one parameter suffices:

```matlab
mu = stabilitymu(s);
% Unconditionally stable when mu > 1

figure;
plot(s.Frequencies/1e9, mu, 'LineWidth', 1.5);
yline(1, 'r--', 'Stability Boundary');
xlabel('Frequency (GHz)'); ylabel('\mu');
title('Edwards-Sinsky Stability Factor'); grid on;
```

## Power Gain

### Gain Metrics

| Function Call | Metric | Description |
|--------------|--------|-------------|
| `powergain(s, 'Gmag')` | Maximum available gain | Valid only when unconditionally stable (K > 1) |
| `powergain(s, 'Gmsg')` | Maximum stable gain | Use when conditionally stable (K < 1) |
| `powergain(s, Zs, Zl, 'Gt')` | Transducer gain | Actual gain with specific source/load impedances |
| `powergain(s, Zs, 'Ga')` | Available gain | With specific source impedance |
| `powergain(s, Zl, 'Gp')` | Operating power gain | With specific load impedance |

**Gotcha:** The gain type string must be the **last** argument. `powergain(s, 'Gt', 50, 50)` errors — use `powergain(s, 50, 50, 'Gt')` instead.

```matlab
gmag = powergain(s, 'Gmag');           % Maximum available gain
gmsg = powergain(s, 'Gmsg');           % Maximum stable gain

gt = powergain(s, 50, 75, 'Gt');       % Transducer gain (Zs=50, Zl=75)
ga = powergain(s, 50, 'Ga');           % Available gain (Zs=50)
gp = powergain(s, 75, 'Gp');           % Operating power gain (Zl=75)
```

**Gotcha:** `powergain` returns linear gain, NOT dB. Convert with `10*log10(g)` (power gain uses 10×, not 20×).

**Gotcha:** `Gmag` returns `NaN` at frequencies where the device is conditionally stable (K < 1). Use `Gmsg` at those frequencies.

**Gotcha:** `Gmsg` returns `Inf` when S12 approaches zero (unilateral device). Guard with `isfinite(gmsg)` before converting to dB.

### Combined Gain Plot Pattern

```matlab
gmag = powergain(s, 'Gmag');
gmsg = powergain(s, 'Gmsg');

figure;
plot(s.Frequencies/1e9, 10*log10(gmag), ...
     s.Frequencies/1e9, 10*log10(gmsg), '--', 'LineWidth', 1.5);
xlabel('Frequency (GHz)'); ylabel('Gain (dB)');
title('Maximum Available / Stable Gain');
legend('Gmag', 'Gmsg'); grid on;
```

## Reflection Coefficients

For impedance matching design — compute the reflection coefficients needed for simultaneous conjugate match or for given termination impedances.

```matlab
gin  = gammain(s, zl);                 % Input reflection coefficient (given load Zl)
gout = gammaout(s, zs);                % Output reflection coefficient (given source Zs)
gms  = gammams(s);                     % Source match for simultaneous conjugate match
gml  = gammaml(s);                     % Load match for simultaneous conjugate match
```

### Converting Gamma to Impedance

To convert a
matlab-access-datafeedSkill

>

matlab-analyze-ams-waveformSkill

Analyze AMS waveform data using Mixed-Signal Blockset utilities: phase noise measurement, clock jitter, anti-aliased resampling, timing measurements, lock time, INL/DNL, ADC/DAC calibration, HSpice import. Use when analyzing time-domain voltage from PLL/VCO/clock simulations, measuring phase noise from variable-step solver output, computing jitter, or resampling non-uniform data.

matlab-analyze-dataSkill

Analyze data using MATLAB. Use when the task involves tables, timetables, time-series data, numeric arrays, sensor matrices, or gridded data — including but not limited to exploring, filtering, sorting, cleaning, transforming, aggregating, smoothing, padding, trimming, and answering questions about data. MATLAB provides extensive, easy-to-use built-in functions for these workflows with no additional products required.

matlab-analyze-dependenciesSkill

Analyze the effective toolbox file set to produce a Dependency Manifest — classify all transitive dependencies as included, product, add-on, or external-unresolved, then present resolution options with tradeoffs. Use after matlab-define-toolbox-api when the spec is approved.

matlab-analyze-emSkill

S-parameters, insertion loss, fields, currents, mesh control, and solver selection for RF PCB performance validation. TRIGGER: user asks to compute S-parameters, analyze insertion/return loss, extract fields or currents, compare MoM vs FEM, or control mesh for any RF PCB component. Invoke BEFORE writing sparameters() or solver code — API is non-obvious. SKIP: designing or creating components (use the specific matlab-design-pcb-* skill), material/stackup setup only (use matlab-manage-pcb-material), optimization sweeps (use matlab-optimize-pcb-design), PDN/IR-drop analysis (use matlab-analyze-pcb-pdn).

matlab-analyze-installed-antennaSkill

Analyze antennas installed on electrically large conducting platforms using MATLAB Antenna Toolbox. Loads platform geometry from STL/STEP/IGES, installs antenna elements, selects electromagnetic solvers (MoM-PO, FMM, MoM), and computes patterns, impedance, coupling, and efficiency. Use when the user wants to model an antenna on a vehicle, aircraft, ship, satellite, or other large structure.

matlab-analyze-pcb-pdnSkill

PDN DC voltage/current analysis, IR drop, design rule checking, and multi-net batch analysis on imported PCB layouts. TRIGGER: user asks about power integrity, PDN analysis, IR drop, voltage distribution, current density, power nets, or design rule checking on a PCB. Invoke BEFORE writing code — the PDN API chain is specialized and non-obvious. SKIP: importing a PCB file (use matlab-read-pcb-layout), EM field/S-parameter extraction (use matlab-analyze-em), material/stackup setup only (use matlab-manage-pcb-material), transmission line design (use matlab-design-pcb-txline).

matlab-analyze-rcsSkill

Calculate and visualize monostatic and bistatic radar cross section (RCS) using MATLAB Antenna Toolbox. Computes RCS of platforms, antennas, and arrays with PO, MoM, and FMM solvers, supporting HH/VV/HV/VH polarization, GPU acceleration, and near-field observation. Use when the user wants to compute, plot, or analyze radar cross section.