tfdata — Extract transfer-function numerator, denominator and sample time from a control model.
[num,den,Ts] = tfdata(sys) returns coefficient cells and sample time. A state-space MIMO model yields an output-by-input coefficient cell grid. A homogeneous model array adds its model dimensions after the output and input dimensions; scalar indices select one array entry. For a scalar SISO model, 'v' returns coefficient row vectors instead of cells.
Syntax
[num,den,ts,sdnum,sdden] = tfdata(sys)
[num,den] = tfdata(sys,'v')
[num,den] = tfdata(sys,J1,...,JN)Inputs
sys- Type
Any- Required
- Yes
- Default
- —
- Description
- Scalar tf or ss model, or a homogeneous tf/ss model array.
sys- Type
Any- Required
- Yes
- Default
- —
- Description
- SISO tf or ss model.
v- Type
StringScalar- Required
- Yes
- Default
- —
- Description
- Vector output selector.
sys- Type
Any- Required
- Yes
- Default
- —
- Description
- Homogeneous tf or ss model array.
J1,...,JN- Type
NumericScalar- Required
- Variadic
- Default
- —
- Description
- Positive scalar model-array indices in column-major order.
Returns
num- Type
Any- Description
- Numerator coefficient cell or row vector.
den- Type
Any- Description
- Denominator coefficient cell or row vector.
ts- Type
NumericScalar- Description
- Sample time.
sdnum- Type
Any- Description
- Empty uncertainty for a deterministic model.
sdden- Type
Any- Description
- Empty uncertainty for a deterministic model.
Errors
RunMat:tfdata:InvalidArgument- When
- Input selector or requested output count is invalid.
- Message
tfdata: invalid argument
RunMat:tfdata:InvalidModel- When
- Consumed model properties are malformed.
- Message
tfdata: invalid model
RunMat:tfdata:UnsupportedModel- When
- Model representation is not supported.
- Message
tfdata: unsupported model
RunMat:tfdata:Internal- When
- Coefficient output construction fails.
- Message
tfdata: internal error
Results
Scalar tf or ss models and nonempty homogeneous arrays of those models are accepted. Without the vector selector, numerator and denominator are output-by-input cells containing coefficient row vectors (1-by-1 for scalar SISO). An array returns cell pages in column-major model order. The optional third output is the common sample time; fourth and fifth uncertainty outputs are empty for deterministic models.
Positive scalar indices in tfdata(sys,J1,...,JN) select one model-array entry; one index uses column-major linear order. The vector selector tfdata(sys,'v') applies only to a scalar SISO model. State-space conversion uses the shared characteristic/Markov polynomial owner; empty arrays, zpk, and uncertain models remain unsupported.
Placement
Accepted resident model properties are gathered through their exact provider owner. The output is host-side coefficient data; no GPU coefficient kernel is claimed.
Examples
Read SISO coefficient vectors
G = tf([2 4],[1 3]); [n,d] = tfdata(G,'v');Read a MIMO coefficient grid
G = ss(-2,[1 3],[1;2],[0 1;0 2]); [n,d,ts] = tfdata(G);Using tfdata with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how tfdata changes the result.
Run a small tfdata example, explain the result, then change one input and compare the output.
FAQ
When are cells returned?⌄
Without the SISO 'v' selector, coefficient outputs are cell arrays.
Related Control functions
Source you can read
Every RunMat function's source is public. Read exactly how tfdata is executed, line by line, in Rust.
- View the source for tfdata 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.