function isrealflag = isreal(f,sec)
%ISREAL  Determine if filter has real coefficients.
%   FLAG = ISREAL(F) determines if the filter object F has 
%   real coefficients and returns 1 if true and 0 if false.
%
%   FLAG = ISREAL(F,I) determines if the I-th section of the
%   filter object F has real coefficients and returns 1 if true
%   and 0 if false.
%
%   See also DFILT/ISSTABLE, DFILT/COEFFICIENTS, DFILT/ORDER.

%   Author(s): R. Losada
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.2 $Date: $ 

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

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

isrealflag = 1; % Initialized assuming real coeffs.
n = 1;

while isrealflag & n <= nsections(f),
    fsec = section(f,n);
      
    isrealflag = isreal(fsec);
            
    n = n + 1;
end
