Convert second-order sections matrix to cell array


c = sos2cell(m)
c = sos2cell(m,g)


c = sos2cell(m) changes an L-by-6 second-order section matrix m generated by tf2sos into a 1-by-L cell array of 1-by-2 cell arrays, c. You can use c to specify a quantized filter with L cascaded second-order sections.

The matrix m should have the form

m = [b1 a1;b2 a2; ... ;bL aL]

where both bi and ai, with i = 1, ..., L, are 1-by-3 row vectors. The resulting c is a 1-by-L cell array of cells of the form

c = { {b1 a1} {b2 a2} ... {bL aL} }

c = sos2cell(m,g) with the optional gain term g, prepends the constant value g to c. When you use the added gain term in the command, c is a 1-by-L cell array of cells of the form

c = {{g,1} {b1,a1} {b2,a2}...{bL,aL} }


expand all

Second-Order-Section Cell Array of Elliptic Filter

Generate a lowpass elliptic filter of order 4 with 0.5 dB of passband ripple and 20 dB of stopband attenuation. The passband edge is 0.6 times the Nyquist frequency. Convert the transfer function to a matrix of second-order sections.

[b,a] = ellip(4,0.5,20,0.6);
m = tf2sos(b,a);

Use sos2cell to convert the 2-by-6 matrix produced by tf2sos into a 1-by-2 cell array, c, of cells. Display the second entry in the first cell of c. Verify that it contains the denominator coefficients of the first second-order section of m.

c = sos2cell(m);
compare = [c{1}{2};m(1,4:6)]
compare =

    1.0000    0.1677    0.2575
    1.0000    0.1677    0.2575

See Also


Was this topic helpful?