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, and V. Suppose that 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:
The gain surface is modeled as:
where are the tunable parameters.
Create a grid of design points, , that are linearly spaced in 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:
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.