RunMat
GitHub

nyquist — Compute or plot Nyquist frequency responses of SISO transfer-function models.

nyquist(sys) plots Nyquist responses for supported SISO tf models, and output forms return real, imaginary, and frequency vectors. It follows MATLAB-compatible call signatures for default or explicit frequency grids.

Syntax

nyquist(sys)
nyquist(sys, w)
re = nyquist(sys, w)
[re, im] = nyquist(sys, w)
[re, im, wout] = nyquist(sys)
[re, im, wout] = nyquist(sys, w)
  • sys must currently be a SISO tf object.
  • w must be a real vector of finite non-negative frequencies.
  • re, im, and wout are returned as N x 1 column vectors.

How nyquist works

  • Supports SISO tf objects created by tf(num, den) or tf(num, den, Ts).
  • Continuous-time models are evaluated as H(j*w).
  • Discrete-time models are evaluated on the unit circle as H(exp(j*w*Ts)).
  • When w is omitted, continuous-time models use a deterministic logarithmic frequency grid based on transfer-function poles and zeros.
  • When w is omitted, discrete-time models use a deterministic grid from zero to the Nyquist frequency pi/Ts.
  • [re, im] = nyquist(sys, w) returns real and imaginary response column vectors.
  • [re, im, wout] = nyquist(sys, w) returns three same-length column vectors.
  • No-output calls plot the positive-frequency curve and mirror the negative-frequency curve for real-coefficient systems.
  • Input/output delays and non-tf model classes raise clear diagnostics in this implementation.

GPU memory and residency

nyquist returns host-resident response vectors. It does not preserve gpuArray residency.

Examples

Compute response data at explicit frequencies

H = tf(1, [1 1]);
w = [0 1 2];
[re, im, wout] = nyquist(H, w);
fprintf("%.1f %.1f %.1f %.1f\n", re(1), re(2), im(2), wout(3));

Expected output:

1.0 0.5 -0.5 2.0

Plot a Nyquist diagram

H = tf(1, [1 2 1]);
nyquist(H);
fprintf("ok\n");

Expected output:

ok

Discrete-time frequency response

H = tf(1, [1 -0.5], 0.1);
[re, im] = nyquist(H, 0:0.5:5);
fprintf("%.1f %.1f\n", re(1), im(1));

Expected output:

2.0 0.0

How RunMat validates nyquist

nyquist validates object class, coefficient type and shape, delay properties, sample time, denominator singularities, and frequency-vector inputs before evaluating the transfer-function response. Tests cover continuous and discrete responses, multi-output shapes, plotting smoke, complex coefficients, VM dispatch, and representative diagnostics.

See Correctness & Trust for the full methodology and coverage table.

Using nyquist with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how nyquist changes the result.

Run a small nyquist example, explain the result, then change one input and compare the output.

FAQ

Does nyquist support MIMO systems?

Not yet. The current implementation supports SISO transfer-function objects.

Does nyquist support state-space models?

Not yet. ss, zpk, frd, model arrays, and identified-system families are outside this first implementation.

Does nyquist run on the GPU?

The frequency-response calculation runs on the host from model metadata. The builtin is registered with GPU/fusion metadata as a residency sink so GPU-backed coefficient inputs are gathered predictably before evaluation.

db · impulse · ss · step · tf

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how nyquist is executed, line by line, in Rust.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.