Function File: n = filtord (b, a)
Function File: n = filtord (sos)

Returns the filter order n for a filter defined by the numerator coefficients, b, and the denominator coefficients, a. It also accepts a filter defined by a matrix of second-order sections, sos.

Example:

[b, a] = butter (8, 0.5);
filtord (b, a)

Demonstration 1

The following code

 b = [1 0];
 a = [1 1];
 n = filtord (b, a)

Produces the following output

n = 1

Demonstration 2

The following code

 b = [1 0 0 0 0 0 0 1];
 a = [1 0 0 0 0 0 0 .5];
 [sos, g] = tf2sos (b, a);
 n = filtord (sos)
 ## test input validation

Produces the following output

n = 7

Package: signal