# CAS2SOS

## Purpose:

Converts cascade form filter coefficients to second order section form.

## Syntax:

CAS2SOS(c)

(sos, gain) = CAS2SOS(c)

c |
- |
A series. The filter coefficients in cascade
form. |

## Returns:

An *N*x6 column series, where
the first 3 columns contain the numerator coefficients and the last three
columns contain the denominator coefficients. Each row represents a 2nd
order stage.

**(sos, gain) = CAS2SOS(c)** returns
the *N*x6 second order stages
and gain in two separate variables.

## Example:

c = {1, 1, 0, 0, -0.5, 0.2};

(sos, gain) = cas2sos(c);

sos == {{1, 0, 0, 1, -0.5, 0.2}

gain == 1.0

The 2nd order cascade filter coefficients represent the following Z
transform:

The resulting SOS form filter coefficients represent
the same Z transform.

## Example:

c = {1, 1, 0, 0, -0.754856, 0.392379, 1, 0, 0, 0.254856,
0};

(sos, gain) = cas2dir(c);

sos == {{1, 0, 0, 1, -0.754856, 0.292379},

{1,
0, 0, 1, 0.254856,
0}}

gain == 1.0

The 2nd order cascade filter coefficients represent the following 2
stage cascaded Z transform:

The resulting SOS form filter coefficients represent
the same Z transform.

## Remarks:

CAS2SOS converts cascade form filter coefficients to second order section
form. Both forms represent the following Z transform:

or:

where *G*
is the system gain, *b*_{k}
and *a*_{k} are the filter
coefficients for the *k*^{th}
stage.

The cascade filter coefficients are returned
as a single column series with the coefficients in the following order:

{G, b_{10}, b_{11}, b_{12},
a_{11}, a_{12}, b_{20}, b_{21}, b_{22},
a_{21}, a_{22}, ... , b_{N0}, b_{N1},
b_{N2}, a_{N1}, a_{N2}}

The SOS form is an *N*x6 array:

**{{b**_{10},
b_{11},
b_{12},
1.0, a_{11},
a_{12}},

_{ }{b_{20},
b_{21},
b_{22},
1.0, a_{21},
a_{22}},

...

** {b**_{N0},
b_{N1},
b_{N2},
1.0, a_{N1},
a_{N2}}}

Each row of the SOS coefficients represents a second order stage.

If the gain is not returned as a separate variable, the gain is embedded
into the first stage.

See SOS2CAS to convert SOS form
coefficients to cascade form.

## See Also:

CAS2TF

CAS2ZP

DADiSP/Filters

SOS2CAS

SOSFILT

TF2CAS

TF2ZP

TF2ZPK

ZFREQ