Convert digital filter transfer function data to second-order sections form
[sos,g] = tf2sos(b,a)
[sos,g] = tf2sos(b,a,'order'
)
[sos,g] = tf2sos(b,a,'order'
,'scale'
)
sos = tf2sos(...)
tf2sos
converts a transfer function representation
of a given digital filter to an equivalent second-order section representation.
[sos,g] = tf2sos(b,a)
finds
a matrix sos
in second-order section form with
gain g
that is equivalent to the digital filter
represented by transfer function coefficient vectors a
and b
.
$$H(z)=\frac{B(z)}{A(z)}=\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}}$$
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}\\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ {b}_{0L}& {b}_{1L}& {b}_{2L}& 1& {a}_{1L}& {a}_{2L}\end{array}\right]$$
whose rows contain the numerator and denominator coefficients b_{ik} and a_{ik} of the second-order sections of H(z).
$$H(z)=g{\displaystyle \prod _{k=1}^{L}{H}_{k}}(z)=g{\displaystyle \prod _{k=1}^{L}\frac{{b}_{0k}+{b}_{1k}{z}^{-1}+{b}_{2k}{z}^{-2}}{1+{a}_{1k}{z}^{-1}+{a}_{2k}{z}^{-2}}}$$
[sos,g] = tf2sos(b,a,
specifies
the order of the rows in 'order'
)sos
, where 'order'
is
'down'
, to order the sections so
the first row of sos
contains the poles closest
to the unit circle
'up'
, to order the sections so
the first row of sos
contains the poles farthest
from the unit circle (default)
[sos,g] = tf2sos(b,a,
specifies
the desired scaling of the gain and numerator coefficients of all
second-order sections, where 'order'
,'scale'
)'scale'
is:
'none'
, to apply no scaling (default)
'inf'
, to apply infinity-norm scaling
'two'
, to apply 2-norm scaling
Using infinity-norm scaling in conjunction with up
-ordering
minimizes the probability of overflow in the realization. Using 2-norm
scaling in conjunction with down
-ordering minimizes
the peak round-off noise.
Note Infinity-norm and 2-norm scaling are appropriate only for direct-form II implementations. |
sos = tf2sos(...)
embeds
the overall system gain, g
, in the first section, H_{1}(z),
so that
$$H(z)={\displaystyle \prod _{k=1}^{L}{H}_{k}(z)}$$
Note
Embedding the gain in the first section when scaling a direct-form
II structure is not recommended and may result in erratic scaling.
To avoid embedding the gain, use |
[1] Jackson, L. B. Digital Filters and Signal Processing. 3rd ed. Boston: Kluwer Academic Publishers, 1996, chap. 11.
[2] Mitra, S. K. Digital Signal Processing: A Computer-Based Approach. New York: McGraw-Hill, 1998, chap. 9.
[3] Vaidyanathan, P. P. "Robust Digital Filter Structures." Handbook for Digital Signal Processing (S. K. Mitra and J. F. Kaiser, eds.). New York: John Wiley & Sons, 1993, chap. 7.