# TF2SOS

## Purpose:

Converts transfer function form filter coefficients to second order section form.

## Syntax:

TF2SOS(b, a)

(sos, gain) = TF2SOS(b, a)

 b - A series. The numerator (i.e. zero) coefficients in ascending powers of z-1. a - A series. The denominator (i.e. pole) coefficients in ascending powers of z-1.

## 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) = TF2SOS(b, a) returns the Nx6 second order stages and gain in two separate variables.

## Example:

b = {1};

a = {1, -0.5, 0.2};

sos = tf2sos(b, a);

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

The direct form filter coefficients represent the following Z transform:

The resulting 2nd order section coefficients represent the equivalent Z transform:

Since the original coefficients represent a single 2nd order system, the SOS denominator coefficients are identical.

## Example:

b = {1};

a = {1, -0.5, 0.2, 0.1};

(sos, gain) = tf2sos(b, a);

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

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

gain == 1

The direct form filter coefficients represent the following Z transform:

The resulting SOS coefficients represent the equivalent Z transform:

The direct form coefficients are represented by two stages of SOS coefficients.

## Remarks:

TF2SOS converts direct form filter coefficients to second order section form. The direct form coefficients represent the terms of the rational polynomial H(z) = b(z) / a(z) where:

 z = e jω complex frequency N = number of numerator terms M = number of denominator terms

The second order section form of the coefficients represent the equivalent Z transform:

or:

where G is the system gain, bk and ak are the filter coefficients for the kth stage.

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.

See SOS2TF to convert second order section form coefficients to direct form.

CAS2TF

CAS2ZP

RESIDUEZ

ROOTS

SOS2TF

SOSFILT

TF2ZP

TF2ZPK

ZFREQ

ZPLANE