Main Content

cell2sos

Convert second-order sections cell array to matrix

Description

sos = cell2sos(cll) generates a matrix sos containing the coefficients of the filter system described by the second-order section cell array cll.

example

[sos,g] = cell2sos(cll) also returns the scale gain g.

Examples

collapse all

Generate a 3-by-1 cell array of 1-by-2 cell arrays of 1-by-3 row vectors. Convert it to a matrix of second-order sections.

cll = {{[3 6 7] [1 1 2]} 
       {[1 4 5] [1 9 3]}
       {[2 7 1] [1 7 8]}};
sos = cell2sos(cll)
sos = 3×6

     3     6     7     1     1     2
     1     4     5     1     9     3
     2     7     1     1     7     8

Input Arguments

collapse all

Second-order section cell-array representation, specified as a cell array.

For a filter system with L sections, specify cll using this structure:

  • Cell array with L elements — For unity-gain filter systems. Each element of the cell array corresponds to a second-order section. The kth cell array element of cll

    cll{k} = {[b_0k b_1k b_2k] [1 a_1k a_2k]}
    contains the coefficients from the kth second-order-section of the filter system H(z):

    H(z)=k=1LHk(z)=k=1Lb0k+b1kz1+b2kz21+a1kz1+a2kz2.

  • Cell array with L+1 elements — If the gain of the filter system is different from 1. The first element of cll contains the system gains at the numerator (gn) and at the denominator (gd). Then, the function appends each element of the cell array for the corresponding second-order section.

    The first and the k+1th cell array element of cll

    cll{1} = {g_n g_d}
    cll{k+1} = {[b_0k b_1k b_2k] [1 a_1k a_2k]}
    contain the system gain and the coefficients from the kth second-order section of the filter system H(z), respectively, such that:

    H(z)=gk=1LHk(z)=gngdk=1Lb0k+b1kz1+b2kz21+a1kz1+a2kz2.

Example: cll = {{[2 4 2] [6 0 2]} {[3 3 0] [6 0 0]}} specifies the second-order-section coefficients of a third-order Butterworth filter with normalized 3 dB frequency 0.5π rad/sample in the cell array format.

Example: cll = {{7 5} {[2 4 2] [6 0 2]} {[3 3 0] [6 0 0]}} specifies the second-order-section coefficients of a third-order Butterworth filter with normalized 3 dB frequency 0.5π rad/sample and scalar gain value of 7/5 = 1.4, represented in the cell array format.

Data Types: double
Complex Number Support: Yes

Output Arguments

collapse all

Second-order section representation, returned as an L-by-6 matrix, where L is the number of second-order sections. The matrix

sos=[b01b11b211a11a21b02b12b221a12a22b0Lb1Lb2L1a1La2L]

represents the second-order sections of H(z):

H(z)=gk=1LHk(z)=gk=1Lb0k+b1kz1+b2kz21+a1kz1+a2kz2.

Scale gain, returned as a scalar.

  • If you specify cll as a cell array with L elements for a filter system with L sections, the cell2sos function returns g as 1.

  • If you specify cll as a cell array with L+1 elements for a filter system with L sections, the cell2sos function returns g as g = g_n/g_d, where g_n and g_d come from the first element of cll.

Tips

  • You can use cll = sos2cell(sos) to perform the reverse operation of sos = cell2sos(cll).

Version History

Introduced before R2006a

See Also

|