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 realp
objects.
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.
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
.
converts the numeric array
or tunable parameter M
=
genmat(A
)A
into a genmat
object.

Static control design block, such as a If If 

Structure containing the control design blocks included in the
generalized LTI model or generalized matrix. The field names of You can change some attributes of these
control design blocks using dot notation. For example, if the generalized
LTI model or generalized matrix M.Blocks.a.Value = 1; 

Sampling grid for model arrays, specified as a data structure. For model arrays that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model in the array. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables. Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array. For example, suppose you create a 11by1
array of linear models, sysarr.SamplingGrid = struct('time',0:10) Similarly, suppose you create a 6by9
model array, [zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>) M.SamplingGrid = struct('zeta',zeta,'w',w) When you display M M(:,:,1,1) [zeta=0.3, w=5] = 25  s^2 + 3 s + 25 M(:,:,2,1) [zeta=0.35, w=5] = 25  s^2 + 3.5 s + 25 ... For model arrays generated by linearizing a Simulink^{®} model
at multiple parameter values or operating points, the software populates Default: 
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]
.