Skip to main content
ClaudeWave
Skill618 estrellas del repoactualizado 8d 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-train-networkSkill

>

matlab-driving-data-importerSkill

Import recorded driving sensor data (GPS, camera, lidar, actor tracks, lanes) into scenariobuilder.* objects (GPSData, CameraData, LidarData, ActorTrackData, Trajectory, laneData) and run preprocessing — synchronize, offset correction, crop, normalizeTimestamps, convertTimestamps. Also: compute actor tracks from lidar when no annotations exist, attach camera/lidar mounting + intrinsics, export to MAT/workspace/timetable/script. Use for raw driving dataset files (KITTI, nuScenes, Waymo, Pandaset, ROS/ROS2 bags, .mat, .csv, .mp4) or driving/vehicle/sensor logs that need wrapping. drivingLogAnalyzer (DLA) is OPT-IN ONLY — invoke only on explicit user request ('DLA', 'open in DLA', 'inspect/explore/analyze the recording') or reported sensor problem (sync drift, timestamp mismatch, overlay misalignment). NEVER auto-launch DLA after wrapping (Rule 0). For 'build scenario / export to RoadRunner / drivingScenario / OpenSCENARIO / Unreal / simulate', hand off to matlab-scenario-builder.

matlab-scenario-builderSkill

Generate driving scenes, scenarios, road surfaces, and 3D content from already-wrapped scenariobuilder.* sensor data (GPS, camera, lidar, actor tracks) using Scenario Builder for Automated Driving Toolbox. Use to BUILD, EXPORT, or AUGMENT a virtual scenario/scene/map: ego or actor trajectories, trajectory smoothing, OpenCRG road-surface extraction, 3D asset generation, static-object placement, point-cloud georeferencing + elevation, lane-based ego localization, sensor-fusion tracking, scenario-event extraction (cut-ins, hard brakes, near-misses, ADAS disengagements), or export to RoadRunner, drivingScenario, OpenDRIVE, OpenCRG, OpenSCENARIO, or Unreal Engine. Also: log-to-scenario, scenario harvesting, accident/near-miss reconstruction, SOTIF (ISO 21448) and ISO 26262 scenario coverage, USGS-aerial-lidar scene augmentation, traffic-sign placement from camera+lidar logs. NOT for raw-data import or multi-sensor sync/crop/offset/timestamp normalization — route those to matlab-driving-data-importer.

roadrunner-asset-mappingSkill

>

roadrunner-convert-lanelet2-to-rrhdSkill

>

roadrunner-import-sceneSkill

>

roadrunner-rrhd-authoringSkill

>

matlab-build-simbiology-modelSkill

Build, modify, and diagram SimBiology models — API reference, helper functions, and layout patterns. Use when constructing or editing models programmatically or visually.