%% Specify First-Order or Second-Order Step Disturbance Response Characteristics
% Create a requirement that specifies the step disturbance response in terms of peak time-domain response, settling time, and damping of oscillations.
% Suppose you want the response at 'y' to a disturbance injected at 'd' to never exceed an absolute value of 0.25, and to settle within 5 seconds. Create a TuningGoal.StepRejection requirement that captures these specifications and also specifies non-oscillatory response.

Req1 = TuningGoal.StepRejection('d','y',0.25,5);

%
% Omitting an explicit value for the damping ratio, zeta, is equivalent to setting zeta = 1. Therefore, Req specifies a non-oscillatory response. The software converts the peak value and settling time into a reference transfer function whose step response has the desired time-domain profile. This transfer function is stored in the ReferenceModel property of Req.

Req1.ReferenceModel

%
% Confirm the target response by displaying Req.

figure()
viewGoal(Req1)

%
% Suppose your application can tolerate oscillations provided the damping ratio is less than 0.4. Create a requirement that specifies this disturbance response.

Req2 = TuningGoal.StepRejection('d','y',0.25,5,0.4);
figure()
viewGoal(Req2)

% Copyright 2012 The MathWorks, Inc.