主要内容

ndBasis

可调增益表面的基础功能

Description

You use basis function expansions to parameterize gain surfaces for tuning gain-scheduled controllers, with thetunableSurfacecommand. The complexity of such expansions grows quickly when you have multiple scheduling variables. UsendBasisto build N-dimensional expansions from low-dimensional expansions.ndBasisis analogous tondgridin the way it spatially replicates the expansions along each dimension.

example

shapefcn= ndbasis(F1,F2)形成两个基本函数扩展的外部(张量)乘积。每个基础函数扩展都是返回扩展项的向量的函数,例如返回polyBasis. If F 1 ( x 1 ) = [ F 1 , 1 ( x 1 ) , F 1 , 2 ( x 1 ) , , F 1 , i ( x 1 ) ] F 2 ( x 2 ) = [ F 2 , 1 ( x 2 ) , F 2 , 2 ( x 2 ) , , F 2 , i ( x 2 ) ] , thenshapefcnis a vector of terms of the form:

F i j = F 1 , i ( x 1 ) F 2 , j ( x 2 ) .

The terms are listed in a column-oriented fashion, withivarying first, thenj.

shapefcn= ndbasis(F1,F2,...,,,Fn)forms the outer product of three or more basis function expansions. The terms in the vector returned byshapefcnare of the form:

F i 1 i N = F 1 , i i ( x 1 ) F 2 , i 2 ( x 2 ) F N , i N ( x N ) .

这些术语以n维数组的排序顺序列出,带有i1varying first, theni2, and so on. EachFjcan itself be a multi-dimensional basis function expansion.

Examples

collapse all

Create a two-dimensional basis of polynomial functions to second-order in both variables.

Define a one-dimensional set of basis functions.

F = @(x)[x,x^2];

等效地,您可以使用polyBasisto create F.

F = polyBasis('canonical',2);

Generate a two-dimensional expansion fromF.

F2D = ndBasis(F,F);

F2Dis a function of two variables. The function returns a vector containing the evaluated basis functions of those two variables:

F 2 D ( x , y ) = [ x , x 2 , y , y x , y x 2 , y 2 , x y 2 , x 2 y 2 ] .

To confirm this, evaluateF2Dforx= 0.2,y= -0.3.

F2D(0.2,-0.3)
ans =1×80.2000 0.0400 -0.3000 -0.0600 -0.0120 0.0900 0.0180 0.0036

您结合的扩展ndBasisneed not have the same order. For instance, combineFwith first-order expansion in one variable.

g = @(y)[y];f2d2 = ndBasis(f,g);

The array returned byF2D2与返回的相似F2D, without the terms that are quadratic in the second variable.

F 2 D 2 ( x , y ) = [ x , x 2 , y , y x , y x 2 ] .

评估F2D2forx= 0.2,y= -0.3 to confirm the order of terms.

F2D2(0.2,-0.3)
ans =1×50.2000 0.0400 -0.3000 -0.0600 -0.0120

Create a set of two-dimensional basis functions where the expansion is quadratic in one variable and periodic in the other variable.

First generate the one-dimensional expansions. Name the variables for improved readability.

F1 = polyBasis('canonical',2,'x'); F2 = fourierBasis(1,1,'y');

For simplicity, this example takes only the first harmonic of the periodic variation. These expansions have basis functions given by:

F 1 ( x ) = [ x , x 2 ] , F 2 ( y ) = [ cos ( π y ) , sin ( π y ) ] .

创建二维英航sis function expansion. Note thatndBasispreserves the variable names you assigned to one-dimensional expansions.

F = ndBasis(F1,F2)
F =function_handle with value:@(x,y)utFcnBasisOuterProduct(FDATA_,x,y)

The array returned byF包括基本函数的所有乘法组合:

F ( x , y ) = [ x , x 2 , cos ( π y ) , cos ( π y ) x , cos ( π y ) x 2 , sin ( π y ) , x sin ( π y ) , x 2 sin ( π y ) ] .

To confirm this, evaluateFforx= 0.2,y= -0.3.

F(0.2,-0.3)
ans =1×80.2000 0.0400 0.5878 0.1176 0.0235 -0.8090 -0.1618 -0.0324

Input Arguments

collapse all

基础功能扩展, specified as a function handle. The function must return a vector of basis functions of one or more scheduling variables. You can define these basis functions explicitly, or usingpolyBasis或者fourierBasis.

例子:F = @(x)[x,x^2,x^3]

例子:f =多基质(3,2)

Output Arguments

collapse all

基础功能扩展, specified as a function handle.shapefcntakes as input arguments the total number of variables inF1,F2,...,FN. It returns a vector of functions of those variables, defined on the interval [–1,1] for each input variable. When you useshapefcn为了创建增益表面,tunableSurface自动为向量中的每个项生成可调系数。

提示

  • ThendBasisoperation is associative:

    ndBasis(F1,ndBasis(F2,F3)) = ndBasis(ndBasis(F1,F2),F3) = ndBasis(F1,F2,F3)

Version History

在R2015B中引入