%% Plot Sector Index Versus Frequency
% Plot the sector index to visualize the frequencies at which the I/O trajectories of G\left( s \right) = \left( {s + 2} \right)/\left( {s + 1} \right) lie within the sector defined by:
%  S = \left\{ {\left( {y,u} \right):0.1{u^2} < uy < 10{u^2}} \right\}.
% In U/Y space, this sector is the shaded region of the following diagram.
%
% The Q matrix for this sector is given by:

a = 0.1;  
b = 10; 
Q = [1 -(a+b)/2 ; -(a+b)/2 a*b];

% A trajectory y\left( t \right) = G{\kern 1pt} u\left( t \right) lies within the sector S when for all T > 0,
% 0.1\int_0^T {u{{\left( t \right)}^2} < } \;\;\int_0^T {u\left( t
% \right)y\left( t \right)dt < } \;\;10\int_0^T {u{{\left( t \right)}^2}dt}
% .
% In the frequency domain, this same condition can be expressed as:
% {\left( {\begin{array}{*{20}{c}} {G\left( {j\omega } \right)}\\ 1
% \end{array}} \right)^H}Q\left( {\begin{array}{*{20}{c}} {G\left( {j\omega
% } \right)}\\ 1 \end{array}} \right) < 0.
%
% To check whether G satisfies or violates this condition at any frequency, plot the sector index for H = [G;1].

G = tf([1 2],[1 1]); 
sectorplot([G;1],Q)

% The plot shows that the sector index is less than 1 at all frequencies. Therefore, the trajectories of G(s) fit within in the specified sector Q at all frequencies.
% Copyright 2012 The MathWorks, Inc.