# tunableSurface

Create tunable gain surface for gain scheduling

## Description

`tunableSurface`

lets you parameterize
and tune *gain schedules*, which are gains that
vary as a function of one or more scheduling variables.

For tuning purposes, it is convenient to parameterize a variable
gain as a smooth *gain surface* of the form:

$$K\left(n\left(\sigma \right)\right)=\gamma \left[{K}_{0}+{K}_{1}{F}_{1}\left(n\left(\sigma \right)\right)+\dots +{K}_{M}{F}_{M}\left(n\left(\sigma \right)\right)\right],$$

where

*σ*is a vector of scheduling variables.*n*(*σ*) is a normalization function (see the`Normalization`

property of the output argument`K`

).*γ*is a scaling factor (see the`Normalization`

property of the output argument`K`

).*F*_{1},...,*F*are user-selected basis functions._{M}*K*_{0},...,*K*are the coefficients to be tuned_{M}

You can use terms in a generic polynomial expansion as basis functions. Or, when the
expected shape of *K*(*σ*) is known, you can use more
specific functions. You can then use `systune`

to tune the
coefficients
*K*_{0},...,*K _{M}*,
subject to your design requirements, over the range of scheduling-variable
values.

creates
the tunable gain surface: `K`

= tunableSurface(`name`

,`K0init`

,`domain`

,`shapefcn`

)

$$K\left(n\left(\sigma \right)\right)=\gamma \left[{K}_{0}+{K}_{1}{F}_{1}\left(n\left(\sigma \right)\right)+\dots +{K}_{M}{F}_{M}\left(n\left(\sigma \right)\right)\right].$$

The tunable surface `K`

stores the basis
functions specified by `shapefcn`

and a discrete
set of *σ* values (the *design points*)
given by `domain`

. The tunable gain surface has
tunable coefficients *K*_{0},...,*K _{M}*.
The gain value is initialized to the constant gain

`K0init`

.
You can combine `K`

with other static or dynamic
elements to construct a closed-loop model of your gain-scheduled control
system. Or, use `K`

to parameterize a lookup table
in an `slTuner`

interface to a Simulink^{®}model. Then, use

`systune`

to tune *K*

_{0},...,

*K*so that the closed-loop system meets your design requirements at the selected design points.

_{M}## Examples

## Input Arguments

## Output Arguments

## Tips

To tune a gain surface in a control system modeled in MATLAB

^{®}: Connect the gain surface with an array of plant models corresponding to the design points in`domain`

. For example, suppose`G`

is such an array, and`K`

represents a variable integration time. The following command builds a closed-loop model that you can tune with the`systune`

command.C0 = tf(K,[1 0]); T0 = feedback(C0*G,1);

To tune a gain surface in a control system modeled in Simulink: Use the gain surface to parameterize a lookup-table, matrix interpolation, or MATLAB function block in the Simulink model. For example, suppose

`ST0`

is an`slTuner`

interface to a Simulink model, and`GainTable`

is the name of a tuned block in the interface. The following command sets the parameterization of`GainTable`

to the tunable gain surface.`ST0 = setBlockParam(ST0,'GainTable',K);`

See Parameterize Gain Schedules for more information.

When you use

`writeBlockValue`

(Simulink Control Design) to write a tuned gain surface back to a Simulink model, the software uses`codegen`

to generate MATLAB code for the gain surface. You can use`codegen`

yourself to examine this code.

## See Also

### Functions

**Introduced in R2015b**