function N = order(h,sec)
%ORDER  Return the filter order of a dfilt object.
%   N = ORDER(H) Returns the order N of the dfilt object H.
%   If H is a single-section filter, the order is given by
%   the number of delays needed for a minimum realization of
%   the filter.
%
%   If H has multiple sections, the order is given by the
%   the number of delays needed for a minimum realization
%   of the overall filter.
%
%   N = ORDER(H,I) returns the order N of the I-th section
%   of the dfilt object H.

%   Author(s): R. Losada
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 2000/06/13 21:21:18 $

error(nargchk(1,2,nargin));

if nargin == 2,
    % Get the section first
    h = section(h,sec);
end

[b,a] = tf(h);
N = max(length(b),length(a)) - 1;



