Contenu principal

Import and Export Filter Coefficients

R2026b

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 scaling gain. Specify the coefficients as two L-row matrices B and A, and specify the scaling gain as an L + 1-element vector Γ.

B=[b11b12b1,m+1b21b22b2,m+1bL1bL2bL,m+1],A=[a11a12a1,n+1a21a22a2,n+1aL1aL2aL,n+1],Γ=[γ1γ2γLγS]

Filter Designer and Filter Designer assume 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)=γS(γ1b11+b12z1++b1,m+1zma11+a12z1++a1,n+1zn·γ2b21+b22z1++b2,m+1zma21+a22z1++a2,n+1zn··γLbL1+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 B is a scalar, then the apps assume that the filter is a cascade of all-pole IIR filters.

  • If A is a scalar, then the apps assume that the filter is a cascade of FIR filters.

  • If both B and A are vectors (L = 1), then the apps assume that B and A represent the transfer function of an IIR filter.

  • If Γ is a scalar, then the apps distribute the value uniformly to all the CTF sections.

  • If Γ is a vector, then the apps assume that the first L elements are scaling gains that apply to the corresponding CTF sections, and the last value corresponds to the overall scaling gain of the filter.

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