Convert digital filter second-order section parameters to state-space form

`[A,B,C,D] = sos2ss(sos)`

[A,B,C,D] = sos2ss(sos,g)

`sos2ss`

converts a second-order section representation
of a digital filter to an equivalent state-space representation.

`[A,B,C,D] = sos2ss(sos)`

converts `sos`

,
a system expressed in second-order section form, to a single-input,
single-output state-space representation:

$$\begin{array}{ll}x(n+1)\hfill & =Ax(n)+Bu(n),\hfill \\ y(n)\hfill & =Cx(n)+Du(n).\hfill \end{array}$$

The discrete transfer function in second-order section form is given by

$$H(z)={\displaystyle \prod _{k=1}^{L}{H}_{k}(z)={\displaystyle \prod _{k=1}^{L}\frac{{b}_{0k}+{b}_{1k}{z}^{-1}+{b}_{2k}{z}^{-2}}{1+{a}_{1k}{z}^{-1}+{a}_{2k}{z}^{-2}}.}}$$

`sos`

is a *L* × 6 matrix
organized as

$$\text{sos}=\left[\begin{array}{cccccc}{b}_{01}& {b}_{11}& {b}_{21}& 1& {a}_{11}& {a}_{21}\\ {b}_{02}& {b}_{12}& {b}_{22}& 1& {a}_{12}& {a}_{22}\\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ {b}_{0L}& {b}_{1L}& {b}_{2L}& 1& {a}_{1L}& {a}_{2L}\end{array}\right].$$

The entries of `sos`

must be real for proper
conversion to state space. The returned matrix `A`

is
of size 2*L* × 2*L*, `B`

is
a 2*L* × 1 column vector, `C`

is
a 1 × 2*L* row
vector, and `D`

is a 1 × 1 scalar.

`[A,B,C,D] = sos2ss(sos,g)`

converts
to state space a system `sos`

in second-order section
form with gain `g`

:

$$H(z)=g{\displaystyle \prod _{k=1}^{L}{H}_{k}}(z).$$

`sos2ss`

first converts from second-order sections
to transfer function using `sos2tf`

,
and then from transfer function to state-space using `tf2ss`

.