RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.2, Nov 26, 2026 ·

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
    • ss
    • tf
    • tf.ldivide
    • tf.minus
    • tf.mldivide
    • tf.mpower
    • tf.mrdivide
    • tf.mtimes
    • tf.plus
    • tf.power
    • tf.rdivide
    • tf.times
    • tf.uminus
    • tf.uplus

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

ss(A,B,C,D) constructs a host ss object. A must be square; B has the same row count as A; C has the same column count as A; and D has C's row count and B's column count. Inputs must be finite real numeric scalars or dense matrices.

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

A
Type
NumericArray
Required
Yes
Description
State matrix with shape n-by-n.
B
Type
NumericArray
Required
Yes
Description
Input matrix with shape n-by-nu.
C
Type
NumericArray
Required
Yes
Description
Output matrix with shape ny-by-n.
D
Type
NumericArray
Required
Yes
Description
Feedthrough matrix with shape ny-by-nu.
Ts
Type
NumericScalar
Required
No
Default
0.0
Description
Sample time (0 for continuous-time model).
name
Type
StringScalar
Required
Variadic
Description
Option name ('Ts' or 'SampleTime').
value
Type
Any
Required
Variadic
Description
Option value.
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

sys
Type
Any
Description
State-space model object.
NameTypeDescription
sysAnyState-space model object.

Errors

RunMat:ss:InvalidArgument
When
Arguments do not match supported ss invocation forms.
Message
ss: invalid argument
RunMat:ss:InvalidOption
When
A name/value option token is unsupported or malformed.
Message
ss: invalid option
RunMat:ss:InvalidSampleTime
When
Sample time is not a finite non-negative scalar, or an integer sample time cannot be represented exactly as double.
Message
ss: sample time must be a finite non-negative scalar
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, or an integer sample time cannot be represented exactly as double.ss: sample time must be a finite non-negative scalar
RunMat:ss:InvalidMatrixAn integer matrix value cannot cross the double-valued state-space boundary exactly.ss: invalid state-space matrix value
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

Forms and stored model

A scalar is treated as a 1-by-1 matrix. The returned object retains each input matrix's orientation after normalization to double. It stores A, B, C, D, Ts, zero InputDelay and OutputDelay vectors, and empty StateName, InputName and OutputName cell arrays. Without Ts it is continuous-time with Ts = 0.

ss(A,B,C,D,Ts) and the Ts or SampleTime name/value forms accept a finite nonnegative scalar sample time. Option names are case-insensitive. Complex, sparse, descriptor-form, uncertain, identified, and generalized models are outside this implementation.

Typed-integer matrices and sample times are RunMat-only extensions. Values must cross the binary64 model boundary exactly. An inexact matrix reports RunMat:ss:InvalidMatrix; an inexact sample time reports RunMat:ss:InvalidSampleTime. Explicit gpuArray input is a separate RunMat-only extension; ordinary automatically resident inputs may gather in either mode.

Execution and placement

Extension admission precedes provider access. Supported resident matrices and sample times then gather through their owning provider and are checked for exact integer conversion at the host model boundary. Construction validates dimensions and returns a new value-semantic host object. Host tensor storage may be shared until copy-on-write mutation. There is no GPU kernel or fusion; provider access may suspend.

Examples

Read stored matrices in column-major order

G = ss([0 1; -2 -3], [0; 1], [1 0], 0);

Continuous state-space model

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

Discrete sample time

G = ss(0.5,1,1,0,0.1);

Named sample time

G = ss(0.5,1,1,0,'SampleTime',0.2);

Integer matrix extension

G = ss(int16(1),int16(2),int16(3),int16(4));

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

How are matrix dimensions validated?⌄

A must be n-by-n, B n-by-nu, C ny-by-n, and D ny-by-nu. Their stored orientations are preserved.

Does ss simulate a response?⌄

No. It constructs a model; step and impulse perform response calculations.

Are complex and sparse matrices supported?⌄

No. This constructor currently requires finite real dense matrices.

Is the result GPU-resident?⌄

No. Accepted resident inputs are gathered and the model owns host-side double matrices.

Related Control functions

Response

bode · evalfr · freqresp · impulse · nyquist · step

Analysis

care · ctrb · damp · db · dcgain · dlqr · feedback · isstable · lqr · minreal · pade · pole · pzmap · rlocus · stepinfo · zero

Models

series · ss2tf · tfdata

Control

tf · tf.ldivide · tf.minus · tf.mldivide · tf.mpower · tf.mrdivide · tf.mtimes · tf.plus · tf.power · tf.rdivide · tf.times · tf.uminus · tf.uplus

Source you can read

Every RunMat function's source is public. 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 a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/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
  • Forms and stored model
  • Execution and placement
  • Examples
  • Read stored matrices in column-major order
  • Continuous state-space model
  • Discrete sample time
  • Named sample time
  • Integer matrix extension
  • Using ss with coding agents
  • FAQ
  • Related Control functions
  • Response
  • Analysis
  • Models
  • Control
  • Source you can read
  • About RunMat