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

tf — Create and combine SISO transfer-function model objects.

tf('s') creates a continuous-time transfer-function variable, and tf(num, den) creates scalar-input scalar-output transfer-function objects from numeric coefficient vectors. Coefficients are ordered from the highest power to the constant term.

Syntax

s = tf('s')
z = tf('z', Ts)
sys = tf(numerator, denominator)
sys = tf(numerator, denominator, Ts)
sys = tf(numerator, denominator, "Variable", variableName)
sys = tf(numerator, denominator, name, value, ...)

Inputs

NameTypeRequiredDefaultDescription
variableStringScalarYes—Transfer-function indeterminate ('s', 'p', 'z', 'q', 'z^-1', or 'q^-1').
TsNumericScalarNo0.0Sample time (0 for continuous-time model).
numeratorAnyYes—Numerator coefficient vector.
denominatorAnyYes—Denominator coefficient vector.
nameStringScalarVariadic—Option name ('Variable' or 'Ts').
valueAnyVariadic—Option value.

Returns

NameTypeDescription
sysAnySISO transfer-function object.

Errors

IdentifierWhenMessage
RunMat:tf:InvalidArgumentArguments do not match supported tf invocation forms.tf: invalid argument
RunMat:tf:InvalidOptionA name/value option token is unsupported or malformed.tf: invalid option
RunMat:tf:InvalidSampleTimeSample time is not a finite non-negative scalar.tf: sample time must be a finite non-negative scalar
RunMat:tf:InvalidVariableVariable option is not a supported control variable name.tf: invalid Variable option
RunMat:tf:InvalidCoefficientsNumerator/denominator coefficients are not valid finite vectors.tf: invalid coefficients
RunMat:tf:DenominatorInvalidDenominator coefficient vector is empty or all zeros.tf: invalid denominator coefficients
RunMat:tf:InternalInternal tensor/object construction failed.tf: internal error

How tf works

  • tf('s') creates a continuous-time transfer-function variable with numerator [1 0], denominator [1], and Ts = 0.
  • tf('z',Ts) creates a discrete-time variable with a positive sample time or Ts = -1 for an unspecified sample time.
  • Accepts numeric scalar, row-vector, or column-vector numerator coefficients.
  • Accepts numeric scalar, row-vector, or column-vector denominator coefficients.
  • Normalizes stored numerator and denominator coefficients to row vectors on the returned tf object.
  • Returns a lightweight object whose class name is tf.
  • Stores Numerator, Denominator, Variable, Ts, InputDelay, and OutputDelay properties on the object.
  • Uses continuous-time defaults: Variable is 's' and Ts is 0.
  • tf(num,den,Ts) stores 0 for continuous time, a positive discrete sample time, or -1 for unspecified discrete time. Nonzero sample times default Variable to 'z'.
  • RunMat mode additionally accepts the variable aliases 'p', 'q', 'z^-1', and 'q^-1', and allows tf('z') to default to Ts = 1.
  • Complex coefficients are accepted and stored as complex row vectors.
  • In RunMat mode, logical and typed-integer coefficients enter a checked double-precision model boundary. Typed-integer sample time is gated separately.
  • Automatically resident coefficients are gathered through their owning provider. Explicit gpuArray input requires RunMat mode, and the returned model remains host-side.
  • tf objects overload +, -, unary +, unary -, *, .*, /, ./, \, .\, ^, and .^ for SISO transfer-function algebra with scalar gains.
  • Transfer-function powers require integer scalar exponents.
  • Arithmetic requires compatible sample times and does not support nonzero input or output delays.

GPU memory and residency

tf is a host-side object constructor. Automatic residency is gathered transparently; explicit gpuArray input is accepted only in RunMat mode, and the returned object is host-side.

Examples

Using the transfer-function variable shorthand

s = tf('s');
G = 2.5/(0.4*s^2 + 1.8*s + 1);
G.Denominator

Expected output:

ans = [0.4 1.8 1.0]

Creating a first-order continuous-time transfer function

H = tf(20, [1 5]);
class(H)

Expected output:

ans = "tf"

Creating a second-order transfer function

H = tf([1 2], [1 3 2]);
H.Numerator
H.Denominator

Expected output:

H.Numerator = [1 2]
H.Denominator = [1 3 2]

Creating a discrete-time transfer function

H = tf(1, [1 -0.5], 0.1);
H.Variable
H.Ts

Expected output:

H.Variable = 'z'
H.Ts = 0.1

Creating a closed-loop model

s = tf('s');
G = 1/(s + 1);
T = feedback(2*G, 1);
dcgain(T)

Expected output:

ans = 0.6667

Selecting the polynomial variable

H = tf([1 0], [1 2 1], 'Variable', 'p');
H.Variable

Expected output:

H.Variable = 'p'

How RunMat validates tf

tf validates coefficient shapes, finite numeric values, supported variable names, sample-time constraints, and SISO arithmetic compatibility before constructing or combining host-side transfer-function objects. Unit and integration tests cover continuous and discrete constructors, variable shorthand, polynomial arithmetic, scalar division by transfer functions, row normalization, option parsing, and invalid denominator or matrix coefficient inputs.

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

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

Using tf with coding agents

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

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

FAQ

Does tf evaluate the transfer function at frequency points?⌄

No. tf constructs the transfer-function object. Frequency-response helpers such as bode, freqresp, and evalfr are separate functions.

Does tf support MIMO transfer functions?⌄

Not yet. tf currently supports scalar-input scalar-output systems created from numeric coefficient vectors.

Can I build models with s = tf('s')?⌄

Yes. Continuous-time variable shorthand and integer powers are supported for common polynomial model construction.

Does tf implement response and stability helpers?⌄

step, impulse, nyquist, stepinfo, feedback, dcgain, pole, damp, and isstable are implemented as separate control builtins.

Can I pass matrices of coefficients?⌄

No. Numerator and denominator inputs must be scalars or vectors.

Can the denominator be all zeros?⌄

No. The denominator coefficient vector must contain at least one non-zero value.

Can I use integer coefficients?⌄

RunMat mode accepts all eight integer classes when every coefficient is exactly representable as double. MATLAB-compatible mode uses the documented floating coefficient surface.

What does Ts = -1 mean?⌄

It creates a discrete-time model whose sample time is unspecified. Continuous-time variables still require Ts = 0.

Related Control functions

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

Open-source implementation

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

  • View the source for tf 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 tf works
  • GPU memory and residency
  • Examples
  • Using the transfer-function variable shorthand
  • Creating a first-order continuous-time transfer function
  • Creating a second-order transfer function
  • Creating a discrete-time transfer function
  • Creating a closed-loop model
  • Selecting the polynomial variable
  • How RunMat validates tf
  • Using tf with coding agents
  • FAQ
  • Related Control functions
  • Open-source implementation
  • About RunMat