function [INDX,w,FocusInfo,InfFlag] = sectorresp(D,~,W1,W2,wspec,isPlotted)
% Computes relative sector index as a function of frequency.
%
%  [INDX,W,FOCUSINFO] = sectorresp(D,M0,W1,W2,WSPEC,ISPLOTTED) computes
%  the sector index for a single MIMO model D over some user-defined or
%  auto-generated frequency grid W. For the R-index (M0=[]), INDX is of
%  size Nu-by-Nf and contains the generalized singular values of
%  (W1'*H(jw),W2'*H(jw)) at each frequency.

%   Copyright 1986-2020 The MathWorks, Inc.
[w,Focus] = parseFreqSpec(D,wspec,isPlotted && isreal(D)); 
FocusInfo = struct('Focus',Focus,'DynRange',Focus,'Soft',false);
InfFlag = false;  % assume MP condition satisfies 

% Compute indices
h = fresp(D,w);
INDX = ltipack.getINDEX(h,W1,W2);

% Sort frequencies if response is plotted
if isPlotted
    [w,is] = sort(w);  INDX = INDX(:,is);
end