function fb = bandwidth(D,drop)
% Bandwidth of state-space models.

%   Author(s): P. Gahinet 
%   Copyright 1986-2011 The MathWorks, Inc.
dc = dcgain(D);
if isinf(dc)
   fb = NaN;
elseif dc==0
   % Set to Inf using the definition: how long gain > dc - drop
   fb = Inf;
else
   % Crossover gain value
   gcross = abs(dc) * 10^(drop/20);
   % Compute all gain crossovers
   wc = getGainCrossover(D,gcross);
   if isempty(wc)
      % No crossing -> bandwidth = Inf (assuming no numerical issue)
      fb = Inf;
   else
      fb = min(abs(wc));
   end
end
