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

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact
  • License
  • Privacy

Learn

  • Docs
  • Blog
  • Benchmarks
  • RunMat vs MATLAB Online

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.

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

ss — Create continuous-time state-space model objects from A, B, C, and D matrices.

ss(A, B, C, D) creates a state-space model object from numeric system matrices. It follows MATLAB-compatible matrix-shape validation for state, input, output, and direct-feedthrough terms.

Syntax

sys = ss(A, B, C, D)
sys = ss(A, B, C, D, Ts)
sys = ss(A, B, C, D, "Ts", Ts)
sys = ss(A, B, C, D, name, value, ...)

Inputs

NameTypeRequiredDefaultDescription
ANumericArrayYes—State matrix with shape n-by-n.
BNumericArrayYes—Input matrix with shape n-by-nu.
CNumericArrayYes—Output matrix with shape ny-by-n.
DNumericArrayYes—Feedthrough matrix with shape ny-by-nu.
TsNumericScalarNo0.0Sample time (0 for continuous-time model).
nameStringScalarVariadic—Option name ('Ts' or 'SampleTime').
valueAnyVariadic—Option value.

Returns

NameTypeDescription
sysAnyState-space model object.

Errors

IdentifierWhenMessage
RunMat:ss:InvalidArgumentArguments do not match supported ss invocation forms.ss: invalid argument
RunMat:ss:InvalidOptionA name/value option token is unsupported or malformed.ss: invalid option
RunMat:ss:InvalidSampleTimeSample time is not a finite non-negative scalar.ss: sample time must be a finite non-negative scalar
RunMat:ss:InvalidDimensionsA, B, C, and D dimensions do not define a consistent state-space model.ss: invalid state-space matrix dimensions
RunMat:ss:UnsupportedInputAn input is complex, sparse, logical, or another unsupported model form.ss: unsupported input
RunMat:ss:InternalInternal tensor/object construction failed.ss: internal error

How ss works

  • Returns an object whose class name is ss.
  • Stores A, B, C, D, Ts, InputDelay, OutputDelay, StateName, InputName, and OutputName properties.
  • Preserves the input matrix orientations on the returned object.
  • Uses continuous-time defaults with Ts equal to 0.
  • ss(A, B, C, D, Ts) stores a finite non-negative sample time.
  • ss(A, B, C, D, 'Ts', Ts) and ss(A, B, C, D, 'SampleTime', Ts) store a finite non-negative sample time.
  • Numeric scalar inputs are treated as 1-by-1 matrices and are accepted only when the resulting dimensions are consistent.
  • Typed integer matrices and sample times are RunMat-only extensions because the compatibility target does not enumerate their storage classes. Each value must be exactly representable as double before the state-space object stores binary64 matrix or sample-time metadata.
  • Automatically resident inputs may gather transparently for host object construction; an explicit gpuArray input is a separately gated RunMat extension.
  • Complex, sparse, descriptor-form, uncertain, identified, and generalized models are not supported in this initial implementation.

GPU memory and residency

ss is a host-side object constructor. gpuArray matrix inputs are gathered before object construction, and the returned state-space object does not live on the GPU.

Examples

Creating a continuous-time state-space model

A = [0 1; -2 -3];
B = [0; 1];
C = [1 0];
D = 0;
G = ss(A, B, C, D);
class(G)

Expected output:

ans = "ss"

Reading stored state-space matrices

G = ss([0 1; -2 -3], [0; 1], [1 0], 0);
fprintf("%.0f %.0f %.0f %.0f %.0f %.0f\n", G.A(1), G.A(2), G.A(3), G.A(4), G.B(1), G.B(2));

Expected output:

0 -2 1 -3 0 1

Creating a discrete-time model

G = ss(0.5, 1, 1, 0, 0.1);
fprintf("%.1f\n", G.Ts);

Expected output:

0.1

Specifying sample time with a name-value pair

G = ss(0.5, 1, 1, 0, 'SampleTime', 0.2);
fprintf("%.1f\n", G.Ts);

Expected output:

0.2

How RunMat validates ss

ss validates finite real matrix inputs, state-space dimension consistency, supported name-value options, and sample-time constraints before constructing the host-side object. Unit and integration tests cover continuous and discrete constructors, property access, invalid dimensions, invalid sample times, descriptor signatures, and gpuArray gathering.

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

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

Using ss with coding agents

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

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

FAQ

Does ss simulate step or impulse responses?⌄

No. This builtin constructs a state-space object. Response functions can add ss parsing separately.

Does ss accept complex or sparse matrices?⌄

Not yet. Inputs must be finite real numeric scalars or dense matrices.

How are dimensions validated?⌄

A must be n-by-n, B must be n-by-nu, C must be ny-by-n, and D must be ny-by-nu.

Will ss(gpuArray(A), B, C, D) return a gpuArray-backed object?⌄

No. ss gathers gpuArray inputs and stores host tensors on the returned object.

Related Control functions

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

Open-source implementation

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

  • View the source for ss 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 ss works
  • GPU memory and residency
  • Examples
  • Creating a continuous-time state-space model
  • Reading stored state-space matrices
  • Creating a discrete-time model
  • Specifying sample time with a name-value pair
  • How RunMat validates ss
  • Using ss with coding agents
  • FAQ
  • Related Control functions
  • Open-source implementation
  • About RunMat