# TuningGoal.Margins

Stability margin requirement for control system tuning

## Description

Use `TuningGoal.Margins`

to specify a tuning
goal for the gain and phase margins of a SISO or MIMO feedback loop. You can use this
tuning goal for validating a tuned control system with `viewGoal`

. You
can also use the tuning goal for control system tuning with tuning commands such as
`systune`

or `looptune`

.

After you create a tuning goal, you can configure it further by setting Properties of the object.

After using the tuning goal to tune a control system, you can visualize the tuning
goal and the tuned value using the `viewGoal`

command. For information about interpreting the margins goal,
see Stability Margins in Control System Tuning.

## Creation

### Description

creates a tuning goal that specifies the minimum gain and phase margins at
the specified location in the control system. `Req`

=
TuningGoal.Margins(`location`

,`gainmargin`

,`phasemargin`

)

### Input Arguments

## Properties

## Examples

## Tips

This tuning goal imposes an implicit stability constraint on the closed-loop sensitivity function measured at

`Location`

, evaluated with loops opened at the points identified in`Openings`

. The dynamics affected by this implicit constraint are the*stabilized dynamics*for this tuning goal. The`MinDecay`

and`MaxRadius`

options of`systuneOptions`

control the bounds on these implicitly constrained dynamics. If the optimization fails to meet the default bounds, or if the default bounds conflict with other requirements, use`systuneOptions`

to change these defaults.

## Algorithms

When you tune a control system using a `TuningGoal`

, the software
converts the tuning goal into a normalized scalar value
*f*(*x*), where *x* is the vector
of free (tunable) parameters in the control system. The software then adjusts the
parameter values to minimize *f*(*x*) or to drive
*f*(*x*) below 1 if the tuning goal is a hard
constraint.

For `TuningGoal.Margins`

, *f*(*x*)
is given by:

$$f\left(x\right)={\Vert 2\alpha S-\alpha I\Vert}_{\infty}.$$

*S* = *D*^{–1}[*I* – *L*(*s*,*x*)]^{–1}*D*
is the scaled sensitivity function.

*L*(*s*,*x*) is the open-loop
response being shaped.

*D* is an automatically-computed loop scaling factor. For more
information about *D*, see Stability Margins in Control System Tuning.

*α* is a scalar parameter computed from the specified gain and phase
margin. For more information about *α*, see Stability Analysis Using Disk Margins (Robust Control Toolbox).

## Version History

**Introduced in R2016a**

## See Also

`looptune`

| `systune`

| `systune (for slTuner)`

(Simulink Control Design) | `looptune (for slTuner)`

(Simulink Control Design) | `viewGoal`

| `evalGoal`