ss2tf — Convert real state-space matrices to transfer-function coefficients for a selected input.
[b,a] = ss2tf(A,B,C,D,ni) returns one numerator row for each output and one common denominator row. ni is one-based and defaults to 1. Matrix dimensions must form a valid state-space system.
Syntax
[b,a] = ss2tf(A,B,C,D)
[b,a] = ss2tf(A,B,C,D,ni)Inputs
A- Type
Any- Required
- Yes
- Default
- —
- Description
- State matrix.
B- Type
Any- Required
- Yes
- Default
- —
- Description
- Input matrix.
C- Type
Any- Required
- Yes
- Default
- —
- Description
- Output matrix.
D- Type
Any- Required
- Yes
- Default
- —
- Description
- Feedthrough matrix.
ni- Type
NumericScalar- Required
- Yes
- Default
- —
- Description
- One-based input channel index.
Returns
b- Type
Any- Description
- One numerator row per output channel.
a- Type
Any- Description
- Common denominator row.
Errors
RunMat:ss2tf:InvalidArgument- When
- Input index, class, or output form is invalid.
- Message
ss2tf: invalid argument
RunMat:ss2tf:InvalidModel- When
- State-space dimensions are incompatible.
- Message
ss2tf: invalid model
RunMat:ss2tf:UnsupportedModel- When
- A requested model form is unsupported.
- Message
ss2tf: unsupported model
RunMat:ss2tf:Internal- When
- Polynomial result construction fails.
- Message
ss2tf: internal error
Selected input
For A of order n and q output rows in C, b is q-by-(n+1) and a is 1-by-(n+1). Each b row preserves the characteristic-polynomial order, including leading zero coefficients. The selected column of B and D corresponds to ni; all q outputs are returned.
Inputs must be finite real Single or Double scalars or dense matrices. All-Single inputs produce Single coefficients; otherwise coefficients are Double. Explicit resident inputs are read through their owning provider and results are host values, not resident results.
Current boundaries
Complex, sparse, distributed and integer matrix inputs are not admitted by this matrix form. The conversion uses characteristic and Markov polynomial operations on the host; large synchronous numerical work and a managed finite allocation envelope remain qualification obligations.
Example
Choose one input of a two-input system
A = -2; B = [1 3]; C = [1; 2]; D = [0 1; 0 2]; [b,a] = ss2tf(A,B,C,D,2);Using ss2tf with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how ss2tf changes the result.
Run a small ss2tf example, explain the result, then change one input and compare the output.
FAQ
What does ni select?⌄
The one-based input channel of B and D. It defaults to channel 1.
Related Control functions
Source you can read
Every RunMat function's source is public. Read exactly how ss2tf is executed, line by line, in Rust.
- View the source for ss2tf 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.