Convert transfer function filter parameters to state-space form
[A,B,C,D] = tf2ss(b,a)
tf2ss
converts the parameters of a transfer
function representation of a given system to those of an equivalent
state-space representation.
[A,B,C,D] = tf2ss(b,a)
returns
the A
, B
, C
,
and D
matrices of a state space representation
for the single-input transfer function
$$H(s)=\frac{B(s)}{A(s)}=\frac{{b}_{1}{s}^{n-1}+\cdots +{b}_{n-1}s+{b}_{n}}{{a}_{1}{s}^{m-1}+\cdots +{a}_{m-1}s+{a}_{m}}=C{(sI-A)}^{-1}B+D$$
in controller canonical form
$$\begin{array}{l}\dot{x}=Ax+Bu\\ y=Cx+Du\end{array}$$
The input vector a
contains the denominator
coefficients in descending powers of s. The rows
of the matrix b
contain the vectors of numerator
coefficients (each row corresponds to an output). In the discrete-time
case, you must supply b
and a
to
correspond to the numerator and denominator polynomials with coefficients
in descending powers of z.
For discrete-time systems you must make b
have
the same number of columns as the length of a
.
You can do this by padding each numerator represented in b
(and
possibly the denominator represented in the vector a
)
with trailing zeros. You can use the function eqtflength
to
accomplish this if b
and a
are
vectors of unequal lengths.
The tf2ss
function is part of the standard MATLAB^{®} language.