%% Tracking Goal With Maximum Tracking Error as a Function of Frequency
% Create a tracking goal specifying that a signal 'theta' track a signal 'theta_ref'. The maximum relative error is 0.01 (1%) in the frequency range [0,1]. The relative error increases to 1 (100%) at the frequency 100.
% Use an frd model to specify the error profile as a function of frequency.

err = frd([0.01 0.01 1],[0 1 100]);
Req = TuningGoal.Tracking('theta_ref','theta',err);

%
% The software converts err into a smooth function of frequency that approximates the piecewise specified profile. Display this function using viewGoal.

viewGoal(Req)

% The dashed line is the target error profile stored in MaxError, and the shaded region indicates where the tuning goal is violated.
% Copyright 2012 The MathWorks, Inc.