# sos

Convert quantized filter to second–order sections (SOS) form

## Syntax

```Hq2 = sos(Hq) Hq2 = sos(Hq, order) Hq2 = sos(Hq, order, scale) ```

## Description

`Hq2 = sos(Hq)` returns a quantized filter `Hq2` that has second-order sections and the `dft2` structure. Use the same optional arguments used in `tf2sos`.

`Hq2 = sos(Hq, order)` specifies the order of the sections in `Hq2`, where `order` is one of the following options:

• `'down'` — to order the sections so the first section of `Hq2` contains the poles closest to the unit circle (L norm scaling)

• `'up'` — to order the sections so the first section of `Hq2` contains the poles farthest from the unit circle (L2 norm scaling and the default)

`Hq2 = sos(Hq, order, scale)` also specifies the desired scaling of the gain and numerator coefficients of all second-order sections, where `scale` is one of the following options:

• `'none'` — to apply no scaling (default)

• `'inf'` — to apply infinity-norm scaling

• `'two'` — to apply 2-norm scaling

Use infinity-norm scaling in conjunction with up-ordering to minimize the probability of overflow in the filter realization. Consider using 2-norm scaling in conjunction with down-ordering to minimize the peak round-off noise.

When `Hq` is a fixed-point filter, the filter coefficients are normalized so that the magnitude of the maximum coefficient in each section is 1. The gain of the filter is applied to the first scale value of `Hq2`.

`sos` uses the direct form II transposed (`dft2`) structure to implement second- order section filters.

## Examples

```[b,a]=butter(8,.5); Hq = dfilt.df2t(b,a); Hq.arithmetic = 'fixed'; Hq1 = sos(Hq) Hq1 = FilterStructure: 'Direct-Form II Transposed, Second-Order Sections' Arithmetic: 'double' sosMatrix: [4x6 double] ScaleValues: [0.00927734375;1;1;1;1] OptimizeScaleValues: true PersistentMemory: false```