function isfirflag = isfir(f,sec)
%ISFIR  Determine if filter is FIR.
%   FLAG = ISFIR(F) determines if the filter object F is an
%   FIR filter and returns 1 if true and 0 if false.
%
%   FLAG = ISFIR(F,I) determines if the I-th section of the
%   filter object F is an FIR filter and returns 1 if true
%   and 0 if false.


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

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

if nargin == 2,
    f = section(f,sec);
end

isfirflag = 1; % Initialized assuming FIR
n = 1;

while isfirflag & n <= nsections(f),
    fsec = section(f,n);

    [b,a] = tf(fsec); % The tf method removes trailing zeros

    if length(a) ~= 1,
        isfirflag = 0;
    end
    
    n = n + 1;
end
    
