Filters a series with an IIR digital filter in the time domain where the filter coefficients are represented in second order sections.
SOSFILT(sos, series, zi)
(y, zf) = SOSFILT(sos, series, zi)
sos 
 
A Nx6 array where the first 3 columns are the numerator terms and the last 3 columns are the denominator terms. Each row represents a 2nd order stage. 
series 
 
A series, the input data to filter. 
zi 
 
Optional. A series, the initial conditions. 
A filtered series.
(y, zf) = SOSFILT(sos, series, zi) returns the filtered series and final conditions.
W1: butterworth(1, 100.0, 10)
W2: gsin(100, 1/100, 4.0) + gsin(100, 1/100, 40.0)
W3: cas2sos(w1)
W4: cascade(w2, w1)
W5: sosfilt(w3, w2)
W6: w4w5
W1 contains a 10 Hz lowpass Butterworth filter. W2 contains the sum of a 4 Hz and 40 Hz sinewave. W3 converts the cascade form coefficients of W1 into a 6x6 array of second order sections. W4 removes the 40 Hz component by applying the cascade IIR filter coefficients. W5 performs the same filtering with the SOS coefficients and W6 displays the difference.
W1: cas2sos(butterworth(1, 100.0, 10))
W2: gsin(200, 1/100, 4.0) + gsin(200, 1/100, 40.0)
W3: extract(w2, 1, 100)
W4: extract(w2, 101, 1)
W5: (y, zf) = sosfilt(w1, w3);y
W6: sosfilt(w1, w4, zf)
W7: concat(w5, w6)
W8: sosfilt(w1, w2)
W9: w7  w8
W1 contains a 10 Hz lowpass Butterworth filter in SOS form.
W2 contains 200 samples of the sum of a 4 Hz and 40 Hz sinewave.
W3 and W4 split the input series into two sections.
W5 and W6 filter each section where the final conditions of the first section are used as the initial conditions of the second section.
W7 combines the filtered sections and W8 filters the original data in one step.
W9 shows the data filtered in sections is identical to the unsectioned filtered data.
An Infinite Impulse Response (IIR) filter can be implemented with the following difference equation:
where y[n] is the output data, x[n] the input and a[k] and b[k] are the filter coefficients.
The equivalent
To minimize roundoff error, enhance stability and provide a system more resistant to coefficient quantization noise, SOSFILT implements the filter in terms of cascaded second order stages or
or equivalently:
where G is the system gain, b_{k} and a_{k} are the filter coefficients for the k^{th} stage.
Thus, the filter can be thought of as a system of cascaded processing stages, represented schematically as:
SOSFILT implements each stage in the 2nd order transposed Form II depicted below:
To implement the transposed Form II structure, SOSFILT expects the filter coefficients of input parameter sos to be an Nx6 array in the following form:
{{b_{10}, b_{11}, b_{12}, 1.0, a_{11}, a_{12}},
_{ }{b_{20}, b_{21}, b_{22}, 1.0, a_{21}, a_{22}},
...
{b_{N0}, b_{N1}, b_{N2}, 1.0, a_{N1}, a_{N2}}}
Each row of the SOS coefficients represents a second order stage.
This coefficients produced by the BESSEL, BUTTERWORTH, CHEBY1, CHEBY2 and ELLIPTIC IIR filters design functions provided by DADiSP/Filters is in CASCADE form.
See CAS2SOS to convert cascade coefficients to SOS form.
See SOS2CAS to convert SOS coefficients to cascade form.
See CASCADE to process a filter implemented as cascade coefficients. Note the series and filter coefficient input arguments are reversed for SOSFILT and CASCADE.
See FILTEQ to process a filter implemented as a standard difference equation.
[1] 
Oppenheim and Schafer 

Digital Signal Processing 

Prentice Hall, 1975 
[2] 
Digital Signal Processing Committee 

Programs for Digital Signal Processing 

I.E.E.E. Press, 1979 