control.tf2ss
- control.tf2ss(sys)[source]
Transform a transfer function to a state space system.
The function accepts either 1 or 2 parameters:
tf2ss(sys)
Convert a transfer function into space space form. Equivalent to
ss(sys)
.tf2ss(num, den)
Create a state space system from its numerator and denominator polynomial coefficients.
For details see:
tf
.- Parameters
- sys
StateSpace
orTransferFunction
A linear system.
- numarray_like, or list of list of array_like
Polynomial coefficients of the numerator.
- denarray_like, or list of list of array_like
Polynomial coefficients of the denominator.
- sys
- Returns
- out
StateSpace
New linear system in state space form.
- out
- Other Parameters
- inputs, outputsstr, or list of str, optional
List of strings that name the individual signals of the transformed system. If not given, the inputs and outputs are the same as the original system.
- namestring, optional
System name. If unspecified, a generic name ‘sys[id]’ is generated with a unique integer id.
- methodstr, optional
Set the method used for computing the result. Current methods are ‘slycot’ and ‘scipy’. If set to None (default), try ‘slycot’ first and then ‘scipy’ (SISO only).
- Raises
- ValueError
If
num
andden
have invalid or unequal dimensions, or if an invalid number of arguments is passed in.- TypeError
If
num
orden
are of incorrect type, or ifsys
is not aTransferFunction
object.
Notes
The
slycot
routine used to convert a transfer function into state space form appears to have a bug and in some (rare) instances may not return a system with the same poles as the input transfer function. For SISO systems, settingmethod
= ‘scipy’ can be used as an alternative.Examples
>>> num = [[[1., 2.], [3., 4.]], [[5., 6.], [7., 8.]]] >>> den = [[[9., 8., 7.], [6., 5., 4.]], [[3., 2., 1.], [-1., -2., -3.]]] >>> sys1 = ct.tf2ss(num, den)
>>> sys_tf = ct.tf(num, den) >>> sys2 = ct.tf2ss(sys_tf)