Generalized statespace model
Generalized statespace (genss
) models
are statespace models that include tunable parameters or components. genss
models
arise when you combine numeric LTI models with models containing tunable
components (control design blocks). For more information about numeric
LTI models and control design blocks, see Models with Tunable Coefficients.
You can use generalized statespace models to represent control
systems having a mixture of fixed and tunable components. Use generalized
statespace models for control design tasks such as parameter studies
and parameter tuning with commands such as systune
and looptune
.
To construct a genss
model:
Use series
, parallel
, lft
,
or connect
, or the arithmetic
operators +
, 
, *
, /
, \
,
and ^
, to combine numeric LTI models with control
design blocks.
Use tf
or ss
with one or more input arguments
that is a generalized matrix (genmat
)
instead of a numeric array
Convert any numeric LTI model, control design block, or slTuner
interface (requires Simulink^{®} Control Design™),
for example, sys
, to genss
form
using:
gensys = genss(sys)
When sys
is an slTuner
interface, gensys
contains
all the tunable blocks and analysis points specified in this interface.
To compute a tunable model of a particular I/O transfer function,
call getIOTransfer(gensys,in,out)
. Here, in
and out
are
the analysis points of interest. (Use getPoints(sys)
to
get the full list of analysis points.) Similarly, to compute a tunable
model of a particular openloop transfer function, use getLoopTransfer(gensys,loc)
.
Here, loc
is the analysis point of interest.

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; 

Vector storing internal delays. Internal delays arise, for example, when closing feedback loops on systems with delays, or when connecting delayed systems in series or parallel. For more information about internal delays, see Closing Feedback Loops with Time Delays in the Control System Toolbox™ User's Guide. For continuoustime models, internal delays are expressed in
the time unit specified by the You can modify the values of internal delays. However, the
number of entries in 

Input delay for each input channel, specified as a scalar value
or numeric vector. For continuoustime systems, specify input delays
in the time unit stored in the For a system with You can also set Default: 0 

Output delays. For a system with Default: 0 for all output channels 

Sample time. For continuoustime models, Changing this property does not discretize or resample the model.
Use Default: 

String representing the unit of the time variable. This property
specifies the units for the time variable, the sample time
Changing this property has no effect on other properties, and
therefore changes the overall system behavior. Use Default: 

Input channel names. Set Alternatively, use automatic vector expansion to assign input
names for multiinput models. For example, if sys.InputName = 'controls'; The input names automatically expand to You can use the shorthand notation Input channel names have several uses, including:
Default: Empty string 

Input channel units. Use Default: Empty string 

Input channel groups. The sys.InputGroup.controls = [1 2]; sys.InputGroup.noise = [3 5]; creates input groups named sys(:,'controls') Default: Struct with no fields 

Output channel names. Set Alternatively, use automatic vector expansion to assign output
names for multioutput models. For example, if sys.OutputName = 'measurements'; The output names automatically expand to You can use the shorthand notation Output channel names have several uses, including:
Default: Empty string 

Output channel units. Use Default: Empty string 

Output channel groups. The sys.OutputGroup.temperature = [1]; sys.InputGroup.measurement = [3 5]; creates output groups named sys('measurement',:) Default: Struct with no fields 

System name. Set Default: 

Any text that you want to associate with the system. Set Default: 

Any type of data you want to associate with system. Set Default: 

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: 
This example shows how to create the lowpass filter F = a/(s + a) with one tunable parameter a.
You cannot use tunableTF
to
represent F, because the numerator and denominator
coefficients of a tunableTF
block are independent.
Instead, construct F using the tunable real parameter
object realp
.
Create a tunable real parameter.
a = realp('a',10);
The realp
object a
is
a tunable parameter with initial value 10.
Use tf
to create the tunable filter F
:
F = tf(a,[1 a]);
F
is a genss
object
which has the tunable parameter a
in its Blocks
property.
You can connect F
with other tunable or numeric
models to create more complex models of control systems. For an example,
see Control System with Tunable Components.
This example shows how to create a statespace (genss
) model having both fixed and tunable
parameters.
Create a statespace model having the following statespace matrices:
$$A=\left[\begin{array}{cc}1& a+b\\ 0& ab\end{array}\right],\text{\hspace{1em}}B=\left[\begin{array}{c}3.0\\ 1.5\end{array}\right],\text{\hspace{1em}}C=\left[\begin{array}{cc}0.3& 0\end{array}\right],\text{\hspace{1em}}D=0,$$
where a and b are tunable parameters, whose initial values are –1 and 3, respectively.
Create the tunable parameters using realp
.
a = realp('a',1); b = realp('b',3);
Define a generalized matrix using algebraic expressions
of a
and b
.
A = [1 a+b;0 a*b]
A
is a generalized matrix whose Blocks
property
contains a
and b
. The initial
value of A
is M = [1 2;0 3]
,
from the initial values of a
and b
.
Create the fixedvalue statespace matrices.
B = [3.0;1.5]; C = [0.3 0]; D = 0;
Use ss
to
create the statespace model.
sys = ss(A,B,C,D)
sys
is a generalized LTI model (genss
)
with tunable parameters a
and b
.
This example shows how to create a tunable model of a control system that has both fixed plant and sensor dynamics and tunable control components.
Consider the the control system of the following illustration.
Suppose that the plant response is , and that the model of the sensor dynamics is . The controller is a tunable PID controller, and the prefilter is a lowpass filter with one tunable parameter, a.
Create models representing the plant and sensor dynamics. Because the plant and sensor dynamics are fixed, represent them using numeric LTI models.
G = zpk([],[1,1],1); S = tf(5,[1 4]);
To model the tunable components, use Control Design Blocks. Create a tunable representation of the controller C.
C = tunablePID('C','PID');
C
is a tunablePID
object, which is a Control Design Block with a predefined proportionalintegralderivative (PID) structure.
Create a model of the filter with one tunable parameter.
a = realp('a',10);
F = tf(a,[1 a]);
a
is a realp
(real tunable parameter) object with initial value 10. Using a
as a coefficient in tf
creates the tunable genss
model object F
.
Interconnect the models to construct a model of the complete closedloop response from r to y.
T = feedback(G*C,S)*F
T = Generalized continuoustime statespace model with 1 outputs, 1 inputs, 5 states, and the following blocks: C: Parametric PID controller, 1 occurrences. a: Scalar parameter, 2 occurrences. Type "ss(T)" to see the current value, "get(T)" to see all properties, and "T.Blocks" to interact with the blocks.
T
is a genss
model object. In contrast to an aggregate model formed by connecting only numeric LTI models, T
keeps track of the tunable elements of the control system. The tunable elements are stored in the Blocks
property of the genss
model object. Examine the tunable elements of T
.
T.Blocks
ans = C: [1x1 tunablePID] a: [1x1 realp]
When you create a genss
model of a control system that has tunable components, you can use tuning commands such as systune
to tune the free parameters to meet design requirements you specify.