{ } Raw JSON

bundles / scipy 1.17.1 / scipy / signal / _lti_conversion / tf2ss

function

scipy.signal._lti_conversion:tf2ss

source: /scipy/signal/_lti_conversion.py :20

Signature

def   tf2ss ( num den )

Summary

Transfer function to state-space representation.

Parameters

num, den : array_like

Sequences representing the coefficients of the numerator and denominator polynomials, in order of descending degree. The denominator needs to be at least as long as the numerator.

Returns

A, B, C, D : ndarray

State space representation of the system, in controller canonical form.

Notes

Array API Standard Support

tf2ss has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.

====================  ====================  ====================
Library               CPU                   GPU
====================  ====================  ====================
NumPy                 ✅                     n/a                 
CuPy                  n/a                   ⛔                   
PyTorch               ⛔                     ⛔                   
JAX                   ⛔                     ⛔                   
Dask                  ⛔                     n/a                 
====================  ====================  ====================

See dev-arrayapi for more information.

Examples

Convert the transfer function: .. math:: H(s) = \frac{s^2 + 3s + 3}{s^2 + 2s + 1}
num = [1, 3, 3]
den = [1, 2, 1]
to the state-space representation: .. math:: \dot{\textbf{x}}(t) = \begin{bmatrix} -2 & -1 \\ 1 & 0 \end{bmatrix} \textbf{x}(t) + \begin{bmatrix} 1 \\ 0 \end{bmatrix} \textbf{u}(t) \\ \textbf{y}(t) = \begin{bmatrix} 1 & 2 \end{bmatrix} \textbf{x}(t) + \begin{bmatrix} 1 \end{bmatrix} \textbf{u}(t)
from scipy.signal import tf2ss
A, B, C, D = tf2ss(num, den)
A
B
C
D

Aliases

  • scipy.signal.tf2ss