You are here : matlabSignal Processingfiltord

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.


n = filtord(b,a) examplen = filtord(sos) examplen = filtord(d) 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 =


Design the same filter using designfilt and verify its order.di = designfilt('lowpassfir','FilterOrder',20,'CutoffFrequency',0.5);
ni = filtord(di)

ni =


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, ...
iir = designfilt('lowpassiir','DesignMethod','butter','SampleRate',1e3, ...
                 'PassbandFrequency',100,'StopbandFrequency',120, ...
FIR = filtord(fir)
IIR = filtord(iir)





Output / Return Value


Alternatives / See Also