scipy.signal.

ss2tf#

scipy.signal.ss2tf(A, B, C, D, input=0)[source]#

State-space to transfer function.

A, B, C, D defines a linear state-space system with p inputs, q outputs, and n state variables.

Parameters:
Aarray_like

State (or system) matrix of shape (n, n)

Barray_like

Input matrix of shape (n, p)

Carray_like

Output matrix of shape (q, n)

Darray_like

Feedthrough (or feedforward) matrix of shape (q, p)

inputint, optional

For multiple-input systems, the index of the input to use.

Returns:
num2-D ndarray

Numerator(s) of the resulting transfer function(s). num has one row for each of the system’s outputs. Each row is a sequence representation of the numerator polynomial.

den1-D ndarray

Denominator of the resulting transfer function(s). den is a sequence representation of the denominator polynomial.

Notes

Before calculating num and den, the function abcd_normalize is called to convert the parameters A, B, C, D into two-dimesional arrays of the same dtype. The resulting dtype will be based on NumPy’s dtype promotion rules, except in the case where each of A, B, C, and D has integer dtype, in which case the resulting dtype will be the default floating point dtype of float64.

The State-space system representation section of the SciPy User Guide presents the corresponding definitions of continuous-time and disrcete time state space systems.

Examples

Convert the state-space representation:

\[ \begin{align}\begin{aligned}\begin{split}\dot{\textbf{x}}(t) = \begin{bmatrix} -2 & -1 \\ 1 & 0 \end{bmatrix} \textbf{x}(t) + \begin{bmatrix} 1 \\ 0 \end{bmatrix} \textbf{u}(t) \\\end{split}\\\textbf{y}(t) = \begin{bmatrix} 1 & 2 \end{bmatrix} \textbf{x}(t) + \begin{bmatrix} 1 \end{bmatrix} \textbf{u}(t)\end{aligned}\end{align} \]
>>> A = [[-2, -1], [1, 0]]
>>> B = [[1], [0]]  # 2-D column vector
>>> C = [[1, 2]]    # 2-D row vector
>>> D = 1

to the transfer function:

\[H(s) = \frac{s^2 + 3s + 3}{s^2 + 2s + 1}\]
>>> from scipy.signal import ss2tf
>>> ss2tf(A, B, C, D)
(array([[1., 3., 3.]]), array([ 1.,  2.,  1.]))