Main Content

voidModel

Mark missing or irrelevant models in model array

Description

Mout = voidModel(M,void) sets the models specified by void to NaN static gains. When working with model arrays defined on a multidimensional grid of design points, use voidModel to indicate that no model is available at specific grid points. For example, when using systune to tune controller parameters for a model array, remove models at points outside the design envelope or points to be ignored during analysis or design.

  • If void is a vector of integers, then voidModel sets M(:,:,void) to NaN.

  • If void is a logical array, then voidModel sets the models selected by void to NaN.

example

Examples

collapse all

Generate an array of tunable genss models. To do so, first create an array of plant models by varying parameters in a second-order transfer function. Then, interconnect the resulting array of plant models with a tunable controller element.

G = tf(zeros(1,1,3,3));
zeta = [0.66,0.71,0.75];
w = [1.0,1.2,1.5];
for i = 1:length(zeta)
    for j = 1:length(w)
        G(:,:,i,j) = tf(w(j)^2,[1 2*zeta(i)*w(j) w(j)^2]);
    end
end

C = tunablePID('C','PID');
M = feedback(C*G,1)
3x3 array of generalized continuous-time state-space models.
Each model has 1 outputs, 1 inputs, 3 states, and the following blocks:
  C: Tunable PID controller, 1 occurrences.

Type "ss(M)" to see the current value and "M.Blocks" to interact with the blocks.

Suppose that you want to tune the PID controller gains for all of the models in M, but that the parameter combinations (zeta,w) = (0.66,1.0) and (zeta,w) = (0.75,1.5) do not occur in your physical system. Void these models so that they do not contribute to any tuning or analysis of the model array. These models are the first and last models in the 3-by-3 array, with linear indices 1 and 9.

void = [1,9]
void = 1×2

     1     9

Mout = voidModel(M,void)
3x3 array of generalized continuous-time state-space models.
Each model has 1 outputs, 1 inputs, between 0 and 3 states, and between 0 and 1 blocks.

Type "ss(Mout)" to see the current value and "Mout.Blocks" to interact with the blocks.

The display indicates that the models in Mout have 0-3 states and 0-1 blocks. The 0-state, 0-block models are the voided entries in Mout. For instance, examine the first entry and confirm that it is a NaN static gain.

tf(Mout(:,:,1,1))
ans =
 
  NaN
 
Static gain.

Instead of using linear indices to specify the models to void, you can use a logical array.

void = logical([1 0 0;0 0 0;0 0 1]);
Mout1 = voidModel(M,void);

Confirm that the first and last models in Mout1 are NaN.

tf(Mout1(:,:,1,1))
ans =
 
  NaN
 
Static gain.
tf(Mout1(:,:,3,3))
ans =
 
  NaN
 
Static gain.

Input Arguments

collapse all

Model array, specified as an LTI model array such as an array of genss models.

Models to void, specified as a vector of integer values or a logical array.

  • If void is a vector of integers, then voidModel sets M(:,:,void) to NaN. For instance, using Void = [1,10] voids M(:,:,[1 10]), the 1st and 10th models in M determined by linear indexing, regardless of the array dimensions of M.

  • If void is a logical array, then voidModel sets the models selected by void to NaN. For instance, if M is a 2-by-2 array of models, then using void = logical([0,1;0,0]) voids the second model in the first row of M.

Output Arguments

collapse all

Array with voided models set to NaN, returned as an LTI model array of the same type and size as M.

Version History

Introduced in R2017b