filtord() - Signal Processing
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.examplen = 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)].examplen = filtord(d) returns
the filter order, n, for the digital filter, d.
Use the function designfilt to
generate d.
Syntax
n = filtord(b,a) examplen = filtord(sos) examplen = filtord(d) example
Example
Verify Order of FIR FilterOpen This Example
Design a 20th-order FIR filter with normalized cutoff frequency
rad/sample using the window method. Verify the filter order.
b = fir1(20,0.5);
n = filtord(b)
n =
20
Design the same filter using designfilt and verify its order.di = designfilt('lowpassfir','FilterOrder',20,'CutoffFrequency',0.5);
ni = filtord(di)
ni =
20
Determine the Order Difference Between FIR and IIR DesignsOpen This Example
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
Output / Return Value
Limitations
Alternatives / See Also
Reference