function isstableflag = isstable(f,sec)
%ISSTABLE  Determine if CAS filter is stable.
%   FLAG = ISSTABLE(F) determines if all section of the filter
%   object F are stable and returns 1 if true and 0 if false.
%
%   FLAG = ISSTABLE(F,I) determines if the I-th section of the
%   filter object F is a stable filter and returns 1 if true
%   and 0 if false.


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

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

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

isstableflag = 1; % Initialized assuming stability
n = 1;

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

    isstableflag = isstable(fsec); % The stability of each section is determined natively
    
    n = n + 1;
end
