## -*- texinfo -*-
## @deftypefn {Function File} {@var{n} =} dsp_filter_order (@var{b}, @var{a})
## Return the realized order of the digital filter with numerator @var{b}
## and denominator @var{a}.
##
## The order is @code{max (numel (b), numel (a)) - 1}, i.e. the degree of
## the higher-degree polynomial.  Using @code{numel (a) - 1} alone reports
## zero for every FIR filter, whose denominator is the scalar 1.
##
## Note that this is the order actually realized by the coefficients, which
## may exceed the order requested in the GUI: @code{dsp_compute_filter}
## bumps odd-order FIR high-pass and band-stop designs up by one so they
## stay realizable.
## @end deftypefn

function n = dsp_filter_order(b, a)
    if nargin < 2 || isempty(a)
        a = 1;
    end
    n = max(numel(b), numel(a)) - 1;
end
