%% Conic Sector Goal
% Create a tuning goal that restricts the response from an input or analysis point 'u' to an output or analysis point 'y' in a control system to the following sector:
%  S = \left\{ {\left( {y,u} \right):0.1{u^2} < uy < 10{u^2}} \right\}.
% The Q matrix for this sector is given by:

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

%
% Use this Q matrix to create the tuning goal.

TG = TuningGoal.ConicSector('u','y',Q)

%
% Set properties to further configure the tuning goal. For example, suppose the control system model has an analysis point called 'OuterLoop', and you want to enforce the tuning goal with the loop open at that point.

TG.Openings = 'OuterLoop';

%
% Before or after tuning, use viewGoal to visualize the tuning goal.

viewGoal(TG)

% The goal is met when the relative sector index R < 1 at all frequencies. The shaded area represents the region where the goal is not met. When you use this requirement to tune a control system CL, viewGoal(TG,CL) shows R for the specified inputs and outputs on this plot, enabling you to identify frequency ranges in which the goal is not met, and by how much.
% Copyright 2012 The MathWorks, Inc.