主要内容

Import and Export Filter Coefficients

In the Filter Analyzer and Filter Designer apps, you can import filter coefficients from the MATLAB® workspace for analysis and visualization. In Filter Designer, you can also import filter coefficients for quantization and further design, or export filter coefficients.

Import Filter Coefficients

To import the designs, use Import Filters and specify the coefficients and gain. Specify the coefficients as two L-row matrices B and A, and specify the gain as an L + 1-element vector g.

B=[b11b12b1,m+1b21b22b2,m+1bL1bL2bL,m+1],A=[a11a12a1,n+1a21a22a2,n+1aL1aL2aL,n+1],g=[g1g2gLgS]

Filter Designer and Filter Designer assumes you have specified the filter as a sequence of L cascaded transfer functions (CTF), such that the full transfer function of the filter is

H(z)=gS(g1b11+b12z1++b1,m+1zma11+a12z1++a1,n+1zn×g2b21+b22z1++b2,m+1zma21+a22z1++a2,n+1zn× ×gLbL1+bL2z1++bL,m+1zmaL1+aL2z1++aL,n+1zn),

where m ≥ 0 is the numerator order of the filter and n ≥ 0 is the denominator order.

  • If L = 1, then B and A are row vectors that specify the transfer function of an IIR filter.

  • If you specify both B and A as column vectors, Filter Designer assumes they represent the transfer function of an IIR filter.

  • If B is a scalar, Filter Designer assumes you specified the filter as a cascade of all-pole IIR filters with each section having a scaling gain equal to B.

  • If A is a scalar, Filter Designer assumes you specified the filter as a cascade of FIR filters with each section having a scaling gain equal to 1/A.

  • If the gain is a scalar, Filter Designer applies the value uniformly to all the cascade filter sections.

Tip

  • To convert second-order section matrices to cascaded transfer functions, use the sos2ctf function.

  • To convert a zero-pole-gain filter representation to cascaded transfer functions, use the zp2ctf function.

Export Filter Coefficients

You can also use Filter Designer to export a selected filter design to the MATLAB workspace as coefficients. To export the design,click Export on the Designer tab, select Export to MATLAB Workspace, and select Coefficients. The app exports the coefficients as matrices of cascaded second-order transfer functions, each with unit gain.

See Also

Apps

Functions

Live Editor Tasks

Topics