www.gusucode.com > robust 案例源码程序 matlab代码 > robust/GainSurfaceOverNonregularGridExample.m

    %% Gain Surface Over Nonregular Grid  
% Create a gain surface sampled at scheduling variable values that do not
% form a regular grid in the operating domain. The gain surface varies as
% a bilinear function of variables $\alpha$ and $\beta$: 
%
% $$K(\alpha,\beta) = K_{0} + K_{1}\alpha + K_{2}\beta + K_{3}\alpha\beta.$$ 
%
% Suppose that the values of interest of the scheduling variables are the following $(\alpha,\beta)$
% pairs. 
%%
% 
% $$\left( {\alpha ,\beta } \right) = \left\{ {\begin{array}{l}
% {( - 0.9,0.05)}\\
% {( - 1.5,0.6)}\\
% {( - 1.5,0.95)}\\
% {( - 2.5,0.5)}\\
% {( - 3.2,0.7)}\\
% {( - 3.9,0.3)}
% \end{array}} \right..$$
% 
%%
% Specify the $(\alpha,\beta)$ sample values as vectors.

% Copyright 2015 The MathWorks, Inc.

alpha = [-0.9;-1.5;-1.5;-2.5;-3.2;-3.9];
beta = [0.05;0.6;0.95;0.5;0.7;0.3];
%% 
% Instead of a regular grid of $(\alpha,\beta)$ values, here the gain surface is
% sampled at irregularly spaced points on $(\alpha,\beta)$-space.  
% 
plot(alpha,beta,'o')

%% 
% The basis functions of the expansion of $K$ are: 
%  
% * $F_{1} = \alpha$  
% * $F_{2} = \beta$  
% * $F_{3} = \alpha\beta$   
%


%% 
% Evaluate the basis functions at each of the sample points. 
F1 = alpha;
F2 = beta;
F3 = alpha.*beta;  

%% 
% Create the tunable model of the gain surface using these sampled function
% values. 
K = gainsurf('K',1,F1,F2,F3) 

%%
% The gain surface is represented by a 6-by-1 array of generalized matrices.
% Because |K| is a scalar gain, each element in the array is 1-by-1. Each
% element in the array represents $K(\alpha,\beta)$ for the corresponding $(\alpha,\beta)$
% sample. Each of these elements depends on the tunable parameters |K_0,...,K_3|.  

%% 
% Use the |SamplingGrid| property to associate the $\alpha$ and $\beta$ values with
% the corresponding entries in |K|. 
SG = struct('alpha',alpha,'beta',beta);
K.SamplingGrid = SG;