# sos2ss

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

## Description

[A,B,C,D] = sos2ss(sos) converts a second-order section representation of a digital filter sos to its equivalent state-space form.

example

[A,B,C,D] = sos2ss(sos,g) converts a second-order section representation of a digital filter sos to its equivalent state-space form with gain g.

## Examples

collapse all

Compute the state-space representation of a simple second-order section system with a gain of 2.

sos = [1  1  1  1   0  -1 ;
-2  3  1  1  10   1];
[A,B,C,D] = sos2ss(sos,2)
A = 4×4

-10     0    10     1
1     0     0     0
0     1     0     0
0     0     1     0

B = 4×1

1
0
0
0

C = 1×4

42     4   -32    -2

D = -4

## Input Arguments

collapse all

Second-order section representation, specified as a matrix. sos is an L-by- 6 matrix of the form

$\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}\\ ⋮& ⋮& ⋮& ⋮& ⋮& ⋮\\ {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.

Overall system gain, specified as a real-valued scalar. The function applies the gain to the system as

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

## Output Arguments

collapse all

State matrix, returned as a 2L-by-2L matrix.

Input-to-state vector, returned as a 2L-by-1 vector.

Output-to-state vector, returned as a 1-by-2L vector.

Feedthrough matrix, returned as a scalar.

collapse all

### Transfer Function

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

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

## Algorithms

The sos2ss function first converts from second-order sections to transfer function using the sos2tf function, and then from transfer function to state-space form using the tf2ss function.

The single-input, single-output state-space representation is given by

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

## Version History

Introduced before R2006a