%% Varying Tuning Goal With LTI Parameter
% Create a tuning goal that specifies a loop shape that varies with one scheduling variable, a.
% Suppose you want to specify a loop shape with a crossover frequency that varies as 2*a over three design points. To enforce this requirement, first create a template for the loop-shape goal. The template is a function that takes a numeric scalar input parameter and returns a TuningGoal.LoopShape object. The function input must be scalar, so the function constructs the LTI models representing the loop shapes.

a = [5;10;15];
s = tf('s');
FH = @(A) TuningGoal.LoopShape('u',2*A/s);

% Here, 'u' is an Analysis Point in the system, the location at which you want to impose the loop-shape requirements.
%
% Use the template and the array to create the varying goal.

VG = varyingGoal(FH,a);

%
% Attach the design-point information to VG.

VG.SamplingGrid = struct('a',a);

%
% Now each value of a is associated with a tuning goal that enforces the corresponding loop shape. For example, confirm that the third entry in a, a = 15, is associated with the third loop shape, 30/s.

LS3 = getGoal(VG,'index',3);
tf(LS3.LoopGain)

% Copyright 2012 The MathWorks, Inc.