Main Content

genmat

Generalized matrix with tunable parameters

Description

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.

Creation

Description

example

M = genmat(A) converts the numeric array or tunable parameter A into a genmat object.

Input Arguments

expand all

Static control design block, specified as numeric array 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.

Data Types: double

Properties

expand all

System name, specified as a character vector. For example, 'mat_1'. When you convert a static control design block such as tunableSurface to a generalized matrix using genmat(blk), the Name property of the block is preserved.

Data Types: char

Structure containing the control design blocks included in the generalized LTI model or generalized matrix. The field names of Blocks are the Name property of each control design block.

You can change some attributes of these control design blocks using dot notation. For example, if the generalized LTI model or generalized matrix M contains a realp tunable parameter a, you can change the current value of a using:

M.Blocks.a.Value = -1;

Data Types: struct

Sampling grid for model arrays, specified as a structure array.

Use SamplingGrid to track the variable values associated with each model in a model array.

Set the field names of the 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 must be numeric scalars, and all arrays of sampled values must match the dimensions of the model array.

For example, you can create an 11-by-1 array of linear models, sysarr, by taking snapshots of a linear time-varying system at times t = 0:10. The following code stores the time samples with the linear models.

 sysarr.SamplingGrid = struct('time',0:10)

Similarly, you can create a 6-by-9 model array, M, by independently sampling two variables, zeta and w. The following code maps the (zeta,w) values to M.

[zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>)
M.SamplingGrid = struct('zeta',zeta,'w',w)

For model arrays generated by linearizing a Simulink® model at multiple parameter values or operating points, the software populates SamplingGrid automatically with the variable values that correspond to each entry in the array. For instance, the Simulink Control Design™ commands linearize (Simulink Control Design) and slLinearizer (Simulink Control Design) populate SamplingGrid automatically.

By default, SamplingGrid is a structure with no fields.

Examples

Create generalized matrix by using algebraic combinations of tunable parameters

This example shows how to use algebraic combinations of tunable parameters to create the generalized matrix:

M=[1a+b0ab],

where a and b are tunable parameters with initial values –1 and 3, respectively.

  1. Create the tunable parameters using realp.

     a = realp('a',-1);
     b = realp('b',3);
  2. 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.

  3. (Optional) Change the initial value of the parameter a.

    M.Blocks.a.Value = -3;
  4. (Optional) Use double to display the new value of M.

    double(M)

    The new value of M is M = [1 0;0 -9].

Version History

Introduced in R2011a