# 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 Nx6 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 Nx6 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, bk and ak are the filter coefficients for the kth stage.

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

{G, b10, b11, b12, a11, a12, b20, b21, b22, a21, a22, ... , bN0, bN1, bN2, aN1, aN2}

The SOS form is an Nx6 array:

{{b10,  b11,  b12,  1.0,  a11,  a12},

{b20,  b21,  b22,  1.0,  a21,  a22},

...

{bN0,  bN1,  bN2,  1.0,  aN1,  aN2}}

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.

CAS2TF

CAS2ZP