RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • damp
    • db
    • dcgain
    • feedback
    • impulse
    • isstable
    • lqr
    • nyquist
    • pole
    • pzmap
    • rlocus
    • ss
    • step
    • stepinfo
    • tf
    • zero

rlocus — Compute or plot root loci of SISO transfer-function or state-space models.

rlocus(sys, ...) plots or returns closed-loop pole locations for supported SISO tf and ss models. Roots are computed from the characteristic polynomial den(sys) + k*num(sys) for each gain value.

Syntax

r = rlocus(sys)
r = rlocus(sys, k)
[r,k] = rlocus(sys)
[r,k] = rlocus(sys, k)

Inputs

NameTypeRequiredDefaultDescription
sysAnyYes—SISO tf or ss model.
kNumericArrayNo—Finite nonnegative gain vector.

Returns

NameTypeDescription
rAnyClosed-loop pole locations as a branches-by-gains matrix.
kNumericArrayGain vector used to compute the root locus.

Returned values from rlocus depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:rlocus:InvalidArgumentInputs do not match supported rlocus invocation forms.rlocus: invalid argument
RunMat:rlocus:InvalidModelInput system is not a valid SISO tf or ss object.rlocus: invalid model
RunMat:rlocus:UnsupportedModelModel form is not supported by the current implementation.rlocus: unsupported model
RunMat:rlocus:PlotFailedStatement-form plotting failed for reasons other than known nonfatal setup conditions.rlocus: plotting failed
RunMat:rlocus:InternalRoot-locus computation or output construction failed.rlocus: internal error

How rlocus works

  • Supports SISO tf objects with real or complex coefficients.
  • Supports SISO ss objects by converting state-space metadata to equivalent numerator and denominator polynomials.
  • Accepts an explicit finite nonnegative gain vector k.
  • A native typed-integer gain vector is a declared RunMat extension and must be exactly representable at the root-locus double boundary; MATLAB compatibility mode rejects it before gathering model or gain data.
  • Chooses a deterministic logarithmic gain grid when k is omitted and adds samples around real positive breakaway candidates.
  • Returns r as a branches-by-gains matrix, using complex output when any branch has a nonzero imaginary component.
  • Returns [r, k] for two-output calls, where k is a row vector.
  • Plots branch trajectories for no-output calls and marks open-loop poles and zeros.
  • Supports continuous-time and discrete-time tf models.
  • Input/output delays raise clear unsupported-model diagnostics.

GPU memory and residency

rlocus returns host-resident root and gain tensors.

Examples

Return roots for explicit gains

H = tf(1, [1 1]);
[r, k] = rlocus(H, [0 1 3]);
fprintf("%.0f %.0f %.0f %.0f\n", r(1,1), r(1,2), r(1,3), k(3));

Expected output:

-1 -2 -4 3

Plot a root locus

s = tf('s');
H = (s + 2) / (s^2 + 3*s + 4);
rlocus(H);
fprintf("ok\n");

Expected output:

ok

Use a discrete-time transfer function

H = tf(1, [1 -0.5], 0.1);
r = rlocus(H, 0.5);
fprintf("%.1f\n", r(1));

Expected output:

0.0

How RunMat validates rlocus

rlocus validates object class, delay properties, gain-vector type/shape/range, output shapes, continuous and discrete characteristic polynomials, complex roots, plotting smoke, and VM dispatch.

  • Implementation: `crates/runmat-runtime/src/builtins/control/rlocus.rs`

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

Using rlocus with coding agents

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

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

FAQ

What equation does rlocus solve?⌄

For each gain k, it computes roots of den(sys) + k*num(sys), matching unity negative-feedback root-locus convention.

Does rlocus support state-space or MIMO models?⌄

rlocus supports SISO ss models. MIMO model arrays remain unsupported by the current RunMat control-model path.

Does rlocus run on the GPU?⌄

No. It is a model-analysis operation and returns host-resident tensors.

Related Control functions

damp · db · dcgain · feedback · impulse · isstable · lqr · nyquist · pole · pzmap · ss · step · stepinfo · tf · zero

Open-source implementation

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

  • View the source for rlocus in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

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.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How rlocus works
  • GPU memory and residency
  • Examples
  • Return roots for explicit gains
  • Plot a root locus
  • Use a discrete-time transfer function
  • How RunMat validates rlocus
  • Using rlocus with coding agents
  • FAQ
  • Related Control functions
  • Open-source implementation
  • About RunMat