Skip to content

Sparamix/octave-rf

octave-rf

octave-rf

release license Octave BIST

26 functions · 100 BIST tests · 144/144 validation pass · BSD-3 · Win/macOS/Linux

Free, open-source S-parameter network utilities for GNU Octave, so IEEE P370 de-embedding code can run independently end-to-end on Windows, macOS, or Linux, with the same function names you already know from MATLAB RF Toolbox.

Current release: v0.1.0 (2026-04-17). See Releases for the signed tarball, or install from the Octave Packages index.

Who is this for?

  • University labs and classrooms running SI/RF coursework on Octave
  • Independent SI consultants wanting end-to-end open-source workflows they can ship to clients on any OS
  • Open-source tool authors building on top of S-parameter math
  • IEEE P370 users who hit MATLAB-RF-Toolbox–only function errors in Octave (sparameters, round(x, n), ifft(x, 'symmetric'), etc.)

If you fit one of these and something doesn't work, please open an issue. That's how the package gets better.

Install

% Install from gnu-octave/packages 
pkg install -forge rf
pkg load rf

% OR install directly from the v0.1.0 GitHub release
pkg install 'https://github.com/Sparamix/octave-rf/releases/download/v0.1.0/rf-0.1.0.tar.gz'
pkg load rf

Or run straight from a repository clone without installing. Download archive, extract, then:

addpath ('inst');

Examples

1) Load and plot an S-parameter file

pkg load rf                                            % (or addpath('inst'))

s   = sparameters ('examples/case_01_2xThru.s2p');     % read Touchstone
f   = s.Frequencies;                                   % Hz, column vector
S21 = rfparam (s, 2, 1);                               % extract S21 as complex vector
                                                       % equivalent: squeeze(s.Parameters(2,1,:))

figure;
subplot (2, 1, 1);
  plot (f/1e9, 20*log10(abs(S21)), 'LineWidth', 1.2);
  grid on; ylabel ('|S_{21}| (dB)');
  title ('case\_01\_2xThru: insertion loss');
subplot (2, 1, 2);
  plot (f/1e9, unwrap(angle(S21))*180/pi);             % unwrap avoids 180° jumps
  grid on; xlabel ('Frequency (GHz)'); ylabel ('\angle S_{21} (deg)');

2) S ↔ T conversion (chain scattering)

T-parameters cascade by matrix multiplication, which is why de-embedding routines convert S → T, multiply/invert, then convert back. The round-trip is exact to floating-point precision:

pkg load rf

s = sparameters ('examples/case_01_2xThru.s2p');

T = s2t (s.Parameters);                                % S -> T  (MATLAB element ordering)
S = t2s (T);                                           % T -> S  (round-trip)

err = max (abs (s.Parameters(:) - S(:)));
printf ('S -> T -> S round-trip max|err| = %.2e\n', err);
                                                       % -> ~5e-16  (machine precision)

% Cascade two identical networks via T-matrix multiplication
P2 = cascadesparams (s.Parameters, s.Parameters);      % raw N-D arrays in/out

See examples/ for runnable demos covering de-embedding, mixed-mode conversion, and more.

Requirements

GNU Octave >= 6.0.0. No additional dependencies.

Documentation

Citing and Acknowledging octave-rf

Using octave-rf in a paper, talk, or downstream tool? We'd love to hear about it!

Drop a note in Discussions or open an issue.

See doc/CITING.md for the citation formats, or click "Cite this repository" in the GitHub sidebar (it reads CITATION.cff automatically).

Functions (26)

Category Functions
S-parameter object sparameters, rfparam
T-parameters s2t, t2s
Z / Y / ABCD / H / G s2z, z2s, s2y, y2s, s2abcd, abcd2s, s2h, h2s, s2g, g2s
Cascade / de-embed cascadesparams, deembedsparams, embedsparams
Mixed-mode s2smm, smm2s, s2sdd, s2scc
Port reorder / renorm snp2smp, renormsparams
I/O fromtouchn (Touchstone reader), also via sparameters(filename)
Compatibility shims ifft_symmetric, round(x,n)

MATLAB compatibility

Function signatures match MATLAB RF Toolbox; the same user code runs in both environments. See the MATLAB Compatibility Guide for the full function-by-function comparison.

Validation

Cross-validated against three reference implementations: 144/144 pair-wise tests pass to floating-point precision.

Comparison Tests Report
MATLAB R2025b vs octave-rf 36/36 report
scikit-rf 1.11.0 vs octave-rf 36/36 3-way report
MATLAB R2025b vs scikit-rf 36/36 3-way report
MATLAB R2020b vs octave-rf (backwards-compat) 36/36 report

Tests

100 built-in self-tests, 0 failures:

addpath ('inst');
pkg test rf          % if installed as a package
% or: test ('s2t'); test ('s2z'); ...   % individual functions

Contributing

Contributions are very welcome: bug reports, test cases, new functions, performance improvements, typo hunts. The short version: fork → branch → push → PR against main; keep BIST green, include validation proof against MATLAB or scikit-rf for new math, and cite a textbook for any new formula.

See CONTRIBUTING.md for the full guide: how to file a useful bug report, the six PR merge requirements, validation tolerance tiers, coding style, and the pre-PR checklist.

For questions or design discussion before coding, open an issue or post on the Octave Discourse.

⚠️ AI-Assisted Development Disclosure

This project was developed with the assistance of Anthropic Claude Opus 4.6. We believe in full transparency about AI involvement in engineering work.

We practice responsible vibe-coding. AI accelerates development, but every function in this package goes through a rigorous verification and validation protocol before it ships:

  1. Equation verification against textbooks: every formula was checked against the physical books (Pozar, Pupalaikis, Hall & Heck) with exact page and equation numbers recorded in the source code and in doc/REFERENCES.md. This process caught and corrected several wrong citations that existed in the original documentation.

  2. Cross-validation to floating-point precision: every function is validated against MATLAB RF Toolbox (R2025b and R2020b) and scikit-rf independently. 144/144 pair-wise comparisons pass. This process caught a T-parameter convention mismatch that was fixed before release; proof that the validation protocol works.

  3. 100 built-in self-tests (BIST): every function has inline tests that run on pkg test rf. Tests cover known-answer values, round-trip identities, edge cases, and error paths.

  4. Clean-room implementation: all code was written from published mathematical definitions in academic textbooks. No proprietary MATLAB source code was referenced or reverse-engineered.

  5. Open to community scrutiny: all validation reports, textbook references, and test infrastructure are included in the repository. We welcome independent verification, bug reports, and feedback via GitHub Issues.

The AI assisted with code generation, documentation, and the systematic verification workflow. The human author (a signal integrity engineer) directed the architecture, reviewed every output, and made all engineering decisions. Every commit was reviewed before merging.

License

BSD-3-Clause; see COPYING.


Note: This tool is intended for educational, not mission-critical use. While we strive for accuracy, please always validate critical results with established professional tools.

Made with ❤️ for the Signal Integrity Community

About

RF and microwave network parameter utilities for GNU Octave - a first(?) RF/microwave package for GNU Octave

Resources

License

BSD-3-Clause, BSD-3-Clause licenses found

Licenses found

BSD-3-Clause
LICENSE
BSD-3-Clause
COPYING

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors