Documentation |
Generalized matrix with tunable parameters
Generalized matrices (genmat) are matrices that depend on tunable parameters (see realp). You can use generalized matrices for parameter studies. You can also use generalized matrices for building generalized LTI models (see genss) that represent control systems having a mixture of fixed and tunable components.
Generalized matrices arise when you combine numeric values with static blocks such as realpobjects. You create such combinations using any of the arithmetic operators +, -, *, /, \, and ^. For example, if a and b are tunable parameters, the expression M = a + b is represented as a generalized matrix.
A generalized matrix can represent a tunable gain surface for constructing gain-scheduled controllers. Use the Robust Control Toolbox™ command gainsurf to create such a tunable gain surface.
The internal data structure of the genmat object M keeps track of how M depends on the parameters a and b. The Blocks property of M lists the parameters a and b.
M = genmat(A) converts the numeric array or tunable parameter A into a genmat object.
A |
Static control design block, such as a realp object. If A is a numeric array, M is a generalized matrix of the same dimensions as A, with no tunable parameters. If A is a static control design block, M is a generalized matrix whose Blocks property lists A as the only block. |
Generalized Matrix With Two Tunable Parameters
This example shows how to use algebraic combinations of tunable parameters to create the generalized matrix:
$$M=\left[\begin{array}{cc}1& a+b\\ 0& ab\end{array}\right],$$
where a and b are tunable parameters with initial values –1 and 3, respectively.
Create the tunable parameters using realp.
a = realp('a',-1); b = realp('b',3);
Define the generalized matrix using algebraic expressions of a and b.
M = [1 a+b;0 a*b]
M is a generalized matrix whose Blocks property contains a and b. The initial value of M is M = [1 2;0 -3], from the initial values of a and b.
(Optional) Change the initial value of the parameter a.
M.Blocks.a.Value = -3;
(Optional) Use double to display the new value of M.
double(M)
The new value of M is M = [1 0;0 -9].