# sos2tf

Convert digital filter second-order section data to transfer function form

## Syntax

``[b,a] = sos2tf(sos)``
``[b,a] = sos2tf(sos,g)``

## Description

````[b,a] = sos2tf(sos)` returns the transfer function coefficients of a discrete-time system described in second-order section form by `sos`.```

example

````[b,a] = sos2tf(sos,g)` returns the transfer function coefficients of a discrete-time system described in second-order section form by `sos` with gain `g`.```

## Examples

collapse all

Compute the transfer function representation of a simple second-order section system.

```sos = [1 1 1 1 0 -1; -2 3 1 1 10 1]; [b,a] = sos2tf(sos)```
```b = 1×5 -2 1 2 4 1 ```
```a = 1×5 1 10 0 -10 -1 ```

## Input Arguments

collapse all

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

`$\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]$`

whose rows contain the numerator and denominator coefficients bik and aik of the second-order sections of H(z):

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

Example: `[2 4 2 6 0 2;3 3 0 6 0 0]` specifies a third-order Butterworth filter with normalized 3 dB frequency 0.5π rad/sample.

Data Types: `double`
Complex Number Support: Yes

Overall system gain, specified as a real scalar.

Data Types: `double`

## Output Arguments

collapse all

Transfer function coefficients, returned as row vectors. `b` and `a` contain the numerator and denominator coefficients of H(z) stored in descending powers of z:

`$H\left(z\right)=\frac{B\left(z\right)}{A\left(z\right)}=\frac{{b}_{1}+{b}_{2}{z}^{-1}+\cdots +{b}_{n+1}{z}^{-n}}{{a}_{1}+{a}_{2}{z}^{-1}+\cdots +{a}_{m+1}{z}^{-m}}.$`

## Algorithms

`sos2tf` uses the `conv` function to multiply all of the numerator and denominator second-order polynomials together. For higher order filters (possibly starting as low as order 8), numerical problems due to round-off errors may occur when forming the transfer function.

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using MATLAB® Coder™.

Introduced before R2006a