MATLAB Examples

Tunable Gain With Two Independent Scheduling Variables

This example shows how to model a scalar gain K with a bilinear dependence on two scheduling variables, $\alpha$ and V. Suppose that $\alpha$ is an angle of incidence that ranges from 0 to 15 degrees, and V is a speed that ranges from 300 to 600 m/s. By default, the normalized variables are:

$$x = {{\alpha  - 7.5} \over {7.5}},\quad y = {{V - 450} \over {150}}.$$

The gain surface is modeled as:

$$K\left( {\alpha ,V} \right) = {K_0} + {K_1}x + {K_2}y + {K_3}xy,$$

where $K_{0},...,K_{3}$ are the tunable parameters.

Create a grid of design points, $(\alpha,V)$, that are linearly spaced in $\alpha$ and V. These design points are the scheduling-variable values used for tuning the gain-surface coefficients. They must correspond to parameter values at which you have sampled the plant.

[alpha,V] = ndgrid(0:3:15,300:50:600);

These arrays, alpha and V, represent the independent variation of the two scheduling variables, each across its full range. Put them into a structure to define the design points for the tunable surface.

domain = struct('alpha',alpha,'V',V);

Create the basis functions that describe the bilinear expansion.

shapefcn = @(x,y) [x,y,x*y];  % or use polyBasis('canonical',1,2)

In the array returned by shapefcn, the basis functions are:

$$\matrix{
  {{F_1}\left( {x,y} \right) = x} \hfill  \cr
  {{F_2}\left( {x,y} \right) = y} \hfill  \cr
  {{F_3}\left( {x,y} \right) = xy.} \hfill  \cr
} $$

Create the tunable gain surface.

K = tunableSurface('K',1,domain,shapefcn);

You can use the tunable surface as the parameterization for a lookup table block or a MATLAB Function block in a Simulink model. Or, use model interconnection commands to incorporate it as a tunable element in a control system modeled in MATLAB. After you tune the coefficients, you can examine the resulting gain surface using the viewSurf command. For this example, instead of tuning, manually set the coefficients to non-zero values and view the resulting gain.

Ktuned = setData(K,[100,28,40,10]);
viewSurf(Ktuned)

viewSurf displays the gain surface as a function of the scheduling variables, for the ranges of values specified by domain and stored in the SamplingGrid property of the gain surface.