filtord

Filter order

Syntax

Description

example

n = filtord(b,a) returns the filter order, n, for the causal rational system function specified by the numerator coefficients, b, and denominator coefficients, a.

example

n = filtord(sos) returns the filter order for the filter specified by the second-order sections matrix, sos. sos is a K-by-6 matrix. The number of sections, K, must be greater than or equal to 2. Each row of sos corresponds to the coefficients of a second-order filter. The ith row of the second-order section matrix corresponds to [bi(1) bi(2) bi(3) ai(1) ai(2) ai(3)].

example

n = filtord(d) returns the filter order, n, for the digital filter, d. Use the function designfilt to generate d.

Examples

expand all

Verify the Order of an FIR Filter

Design an order-20 FIR filter with normalized cutoff frequency $0.5\pi$ rad/sample using the window method. Verify the filter order.

b = fir1(20,0.5);
n = filtord(b)
n =

    20

Determine the Order Difference Between FIR and IIR Designs

Design FIR equiripple and IIR Butterworth filters from the same set of specifications. Determine the difference in filter order between the two designs.

fir = designfilt('lowpassfir','DesignMethod','equiripple','SampleRate',1e3, ...
                 'PassbandFrequency',100,'StopbandFrequency',120, ...
                 'PassbandRipple',0.5,'StopbandAttenuation',60);
iir = designfilt('lowpassiir','DesignMethod','butter','SampleRate',1e3, ...
                 'PassbandFrequency',100,'StopbandFrequency',120, ...
                 'PassbandRipple',0.5,'StopbandAttenuation',60);
FIR = filtord(fir)
IIR = filtord(iir)
FIR =

   114


IIR =

    41

Input Arguments

expand all

b — Numerator coefficientsvector | scalar

Numerator coefficients, specified as a scalar or a vector. If the filter is an allpole filter, b is a scalar. Otherwise, b is a row or column vector.

Example: b = fir1(20,0.25)

Data Types: single | double
Complex Number Support: Yes

a — Denominator coefficientsvector | scalar

Denominator coefficients, specified as a scalar or a vector. If the filter is an FIR filter, a is a scalar. Otherwise, a is a row or column vector.

Example: [b,a] = butter(20,0.25)

Data Types: single | double
Complex Number Support: Yes

sos — Matrix of second-order sectionsmatrix

Matrix of second order-sections, specified as a K-by-6 matrix. The system function of the Kth biquad filter has the rational Z-transform

Hk(z)=Bk(1)+Bk(2)z1+Bk(3)z2Ak(1)+Ak(2)z1+Ak(3)z2.

The coefficients in the Kth row of the matrix, sos, are ordered as follows.

[Bk(1)Bk(2)Bk(3)Ak(1)Ak(2)Ak(3)].

The frequency response of the filter is the system function evaluated on the unit circle with

z=ej2πf.

Data Types: single | double
Complex Number Support: Yes

d — Digital filterdigitalFilter object

Digital filter, specified as a digitalFilter object. Use designfilt to generate a digital filter based on frequency-response specifications.

Example: d = designfilt('lowpassiir','FilterOrder',3,'HalfPowerFrequency',0.5) specifies a third-order Butterworth filter with normalized 3-dB frequency 0.5π rad/sample.

Output Arguments

expand all

n — Filter orderinteger

Filter order, specified as an integer.

Was this topic helpful?