# TuningGoal.LoopShape

Target loop shape for control system tuning

## Description

Use `TuningGoal.LoopShape`

to specify a target
*gain profile* (gain as a function of frequency) of an open-loop response.
`TuningGoal.LoopShape`

constrains the open-loop, point-to-point
response (*L*) at a specified location in your control system. Use this tuning
goal for control system tuning with tuning commands, such as `systune`

or
`looptune`

.

When you tune a control system, the target open-loop gain profile is converted into
constraints on the inverse sensitivity function inv(*S*)
= (*I* + *L*) and the complementary sensitivity function *T* =
1–*S*. These constraints are illustrated for a representative tuned system in
the following figure.

Where *L* is much greater than 1, a minimum gain constraint on
inv(*S*) (green shaded region) is equivalent to a minimum gain constraint on
*L*. Similarly, where *L* is much smaller than 1, a maximum
gain constraint on *T* (red shaded region) is equivalent to a maximum gain
constraint on *L*. The gap between these two constraints is twice the
`CrossTol`

parameter, which specifies the frequency band where the loop gain
can cross 0 dB.

For multi-input, multi-output (MIMO) control systems, values in the gain profile greater
than 1 are interpreted as minimum performance requirements. Such values are lower bounds on the
smallest singular value of the open-loop response. Gain profile values less than one are
interpreted as minimum roll-off requirements, which are upper bounds on the largest singular
value of the open-loop response. For more information about singular values, see `sigma`

.

Use `TuningGoal.LoopShape`

when the loop shape near
crossover is simple or well understood (such as integral action). To specify only high gain or
low gain constraints in certain frequency bands, use `TuningGoal.MinLoopGain`

and `TuningGoal.MaxLoopGain`

. When you do so, the software
determines the best loop shape near crossover.

## Creation

### Syntax

### Description

creates a tuning goal for shaping the open-loop response measured at the specified location.
The magnitude of the single-input, single-output (SISO) transfer function
`Req`

=
TuningGoal.LoopShape(`location`

,`loopgain`

)`loopgain`

specifies the target open-loop gain profile. You can specify
the target gain profile (maximum gain across the I/O pair) as a smooth transfer function or
sketch a piecewise error profile using an `frd`

model.

specifies a tolerance on the location of the crossover frequency.
`Req`

= TuningGoal.LoopShape(`location`

,`loopgain`

,`crosstol`

)`crosstol`

expresses the tolerance in decades. For example,
`crosstol`

= 0.5 allows gain crossovers within half a decade on either
side of the target crossover frequency specified by `loopgain`

. When you
omit `crosstol`

, the tuning goal uses a default value of 0.1 decades. You
can increase `crosstol`

when tuning MIMO control systems. Doing so allows
more widely varying crossover frequencies for different loops in the system.

`Req = TuningGoal.LoopShape(`

specifies a range for the target gain crossover frequency. The range is a vector of the form
`location`

,`wcrange`

)`wcrange`

= `[wc1,wc2]`

. This syntax is equivalent to
using the geometric mean `sqrt(wc1*wc2)`

as `wc`

and
setting `crosstol`

to the half-width of `wcrange`

in
decades. Using a range instead of a single `wc`

value increases the ability
of the tuning algorithm to enforce the target loop shape for all loops in a MIMO control
system.

### 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.LoopShape`

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

$$f\left(x\right)={\Vert \begin{array}{c}{W}_{S}S\\ {W}_{T}T\end{array}\Vert}_{\infty}.$$

Here,
*S* = *D*^{–1}[*I* – *L*(*s*,*x*)]^{–1}*D*
is the scaled sensitivity function at the specified location, where
*L*(*s*,*x*) is the open-loop response being
shaped. *D* is an automatically-computed loop scaling factor. (If the
`LoopScaling`

property is set to `'off'`

, then
*D* = *I*.)
*T* = *S* – *I* is the
complementary sensitivity function.

*W _{S}* and

*W*are frequency weighting functions derived from the specified loop shape. The gains of these functions roughly match

_{T}`LoopGain`

and
`1/LoopGain`

, for values ranging from –20 dB to 60 dB. For numerical reasons,
the weighting functions level off outside this range, unless the specified loop gain profile
changes slope for gains above 60 dB or below –60 dB. Because poles of
*W*or

_{S}*W*close to

_{T}*s*= 0 or

*s*=

`Inf`

might lead to
poor numeric conditioning of the `systune`

optimization problem, it is not
recommended to specify loop shapes with very low-frequency or very high-frequency
dynamics.To obtain *W _{S}* and

*W*, use:

_{T}[WS,WT] = getWeights(Req,Ts)

where `Req`

is the tuning goal, and `Ts`

is the sample
time at which you are tuning (`Ts = 0`

for continuous time). For more
information about the effects of the weighting functions on numeric stability, see Visualize Tuning Goals.

## Version History

**Introduced in R2016a**

## See Also

`looptune`

| `systune`

| `looptune (for slTuner)`

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

(Simulink Control Design) | `TuningGoal.MinLoopGain`

| `TuningGoal.MaxLoopGain`

| `viewGoal`

| `TuningGoal.Tracking`

| `TuningGoal.Gain`

| `slTuner`

(Simulink Control Design) | `frd`