Convert zero-pole-gain filter parameters to state-space form

`[`

finds a state-space representation`A`

,`B`

,`C`

,`D`

] = zp2ss(`z`

,`p`

,`k`

)

$$\begin{array}{l}\dot{x}=Ax+Bu\\ y=Cx+Du\end{array}$$

such that it is equivalent to a system in factored transfer function form

$$H(s)=\frac{Z(s)}{P(s)}=k\frac{(s-{z}_{1})(s-{z}_{2})\cdots (s-{z}_{n})}{(s-{p}_{1})(s-{p}_{2})\cdots (s-{p}_{n})}$$

Column vector `p`

specifies the pole locations, and matrix
`z`

the zero locations with as many columns as there are outputs. The
gains for each numerator transfer function are in vector `k`

. The
`A`

, `B`

, `C`

, and
`D`

matrices are returned in controller canonical form.

`zp2ss`

, for single-input systems, groups complex pairs together into
two-by-two blocks down the diagonal of the `A`

matrix. This requires the
zeros and poles to be real or complex conjugate pairs.