Documentation 
Package: TuningGoal
Disturbance rejection requirement for control system tuning
Use the TuningGoal.Rejection object to specify the minimum attenuation of a disturbance injected at a specified location in a control system. This requirement helps you tune control systems with tuning commands such as systune or looptune.
When you use a TuningGoal.Rejection requirement, the software attempts to tune the system so that the attenuation of a disturbance at the specified location exceeds the minimum attenuation factor you specify. This attenuation factor is the ratio between the open and closedloop sensitivities to the disturbance and is a function of frequency. You can achieve disturbance attenuation only inside the control bandwidth. The loop gain must be larger than one for the disturbance to be attenuated (attenuation factor > 1).
Req = TuningGoal.Rejection(distloc,attfact) creates a tuning requirement for rejecting a disturbance entering at distloc. This requirement constrains the minimum disturbance attenuation factor to the frequencydependent value, attfact.
distloc 
Disturbance location, specified as a string or a cell array of strings for vectorvalued signals.

attfact 
Attenuation factor as a function of frequency, specified as a numeric LTI model. The TuningGoal.Rejection requirement constrains the minimum disturbance attenuation to the frequencydependent value attfact. You can specify attfact as a smooth transfer function (tf , zpk, or ss model). Alternatively, you can specify a piecewise gain profile using a frd model. For example, the following code specifies an attenuation factor of 100 (40 dB) below 1 rad/s, gradually dropping to 1 (0 dB) past 10 rad/s, for a disturbance injected at u. attfact = frd([100 100 1 1],[0 1 10 100]); Req = TuningGoal.Rejection('u',attfact); bodemag(attfact)
When you use an frd model to specify attfact, the gain profile is automatically mapped onto a zpk model. The magnitude of this zpk model approximates the desired gain profile. Use viewSpec(Req) to visualize the resulting attenuation profile. 
MinAttenuation 
Minimum disturbance attenuation as a function of frequency, expressed as a SISO zpk model. The software automatically maps the attfact input argument to a zpk model. The magnitude of this zpk model approximates the desired attenuation factor and is stored in the MinAttenuation property. Use viewSpec(Req) to plot the magnitude of MinAttenuation. 
Focus 
Frequency band in which tuning requirement is enforced, specified as a row vector of the form [min,max]. Set the Focus property to limit enforcement of the requirement to a particular frequency band. Express this value in the frequency units of the control system model you are tuning (rad/TimeUnit). For example, suppose Req is a requirement that you want to apply only between 1 and 100 rad/s. To restrict the requirement to this band, use the following command: Req.Focus = [1,100]; Default: [0,Inf] for continuous time; [0,pi/Ts] for discrete time, where Ts is the model sampling time. 
LoopScaling 
Toggle for automatically scaling loop signals, specified as 'on' or 'off'. For multiloop or MIMO disturbance rejection requirements, the feedback channels are automatically rescaled to equalize the offdiagonal (loop interaction) terms in the openloop transfer function. Set LoopScaling to 'off' to disable such scaling and shape the unscaled openloop response. Default: 'on' 
Location 
Location of disturbance, specified as a string or cell array of strings that identify model inputs or analysispoint locations marked in the model. The initial value of the Location property is set by the distloc input argument when you construct the requirement object. 
Models 
Models to which the tuning requirement applies, specified as a vector of indices. Use the Models property when tuning an array of control system models with systune, to enforce a tuning requirement for a subset of models in the array. For example, suppose you want to apply the tuning requirement, Req, to the second, third, and fourth models in a model array passed to systune. To restrict enforcement of the requirement, use the following command: Req.Models = 2:4; When Models = NaN, the tuning requirement applies to all models. Default: NaN 
Openings 
Feedback loops to open when evaluating the requirement, specified as a cell array of strings that identify loopopening locations. The tuning requirement is evaluated against the openloop configuration created by opening feedback loops at the locations you identify. If you are using the requirement to tune a Simulink model of a control system, then Openings can include any linear analysis point marked in the model, or any linear analysis point in an slTuner interface associated with the Simulink model. Use addPoint to add analysis points and loop openings to the slTuner interface. Use getPoints to get the list of analysis points available in an slTuner interface to your model. If you are using the requirement to tune a generalized statespace (genss) model of a control system, then Openings can include any AnalysisPoint location in the control system model. Use getPoints to get the list of analysis points available in the genss model. Default: {} 
Name 
Name of the requirement object, specified as a string. For example, if Req is a requirement: Req.Name = 'LoopReq'; Default: [] 
When you tune a control system using a TuningGoal object to specify a tuning requirement, the requirement is converted into a normalized scalar value f(x). In this case, x is the vector of free (tunable) parameters in the control system. The parameter values are adjusted automatically to minimize f(x) or drive f(x) below 1 if the tuning requirement is a hard constraint.
For the TuningGoal.Rejection requirement, f(x) is given by:
$$f\left(x\right)=\underset{\omega \in \text{\hspace{0.17em}}\Omega}{\mathrm{max}}\Vert W\left(j\omega \right)S\left(j\omega ,x\right)\Vert .$$
W(jω) is the rational transfer function of the MinAttenuation property. This transfer function's magnitude approximates the minimum disturbance attenuation that you specify for the requirement. S(jω,x) is the closedloop sensitivity function measured at the disturbance location. Ω is the frequency interval over which the requirement is enforced, specified in the Focus property.
Create a tuning requirement that enforces a attenuation of at least a factor of 10 between 0 and 5 rad/s. The requirement applies to a disturbance entering a control system at a point identified as 'u'.
Req = TuningGoal.Rejection('u',10); Req.Name = 'Rejection spec'; Req.Focus = [0 5]
Create a tuning requirement that enforces an attenuation factor of at least 100 (40 dB) below 1 rad/s, gradually dropping to 1 (0 dB) past 10 rad/s. The requirement applies to a disturbance entering a control system at a point identified as 'u'.
attfact = frd([100 100 1 1],[0 1 10 100]);
Req = TuningGoal.Rejection('u',attfact);
These commands use a frd model to specify the minimum attenuation profile as a function of frequency. The minimum attenuation of 100 below 1 rad/s, together with the minimum attenuation of 1 at the frequencies of 10 and 100 rad/s, specifies the desired rolloff of the requirement.
attfact is converted into a smooth function of frequency that approximates the piecewise specified requirement. Display the error requirement using viewSpec.
viewSpec(Req)
The yellow region indicates where the requirement is violated.