%% Visualize Tuning Goal as Function of Frequency
% Create a tuning goal that constrains the response from a signal 'd' to another signal 'y' to roll off at 20 dB/decade at frequencies greater than 1. The tuning goal also imposes disturbance rejection (maximum gain of 1) in the frequency range [0,1].

gmax = frd([1 1 0.01],[0 1 100]);
Req = TuningGoal.MaxGain('du','u',gmax);

%
% When you use a frequency response data (frd) model to sketch the bounds of a gain constraint or loop shape, the tuning goal interpolates the constraint. This interpolation converts the constraint to a smooth function of frequency. Examine the interpolated gain constraint using viewGoal.

viewGoal(Req)

% The dotted line shows the gain profile specified in the tuning goal. The shaded region represents gain values that violate the tuning requirement. For more information about interpreting tuning-goal plots, see Visualize Tuning Goals.
% Copyright 2012 The MathWorks, Inc.