For many filter types, such as lowpass, highpass, and bandpass filters,a good choice of implementation structure is often series second-order sections. In fixed-point applications, the ordering of the sections can be important.
The matlab function tf2sos10.5 converts from ``transfer function form'', , to series ``second-order-section'' form. For example, the line
BAMatrix = tf2sos(B,A);converts the real filter specified by polynomial vectors B and A to a series of second-order sections (biquads) specified by the rows of BAMatrix. Each row of BAMatrix is of the form . The function tf2sos may be implemented simply as a call to tf2zp followed by a call to zp2sos, where the zp form of a digital filter consists of its (possibly complex) zeros, poles, and an overall gain factor:
function [sos,g] = tf2sos(B,A) [z,p,g]=tf2zp(B(:)',A(:)'); % Direct form to (zeros,poles,gain) sos=zp2sos(z,p,g); % (z,p,g) to series second-order sections