## Documentation Center |

Generalized state-space model

Generalized state-space (`genss`) models
are state-space 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 state-space models to represent control
systems having a mixture of fixed and tunable components. Use generalized
state-space models for control design tasks such as parameter studies
and parameter tuning with `hinfstruct` (requires Robust Control Toolbox™).

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 arrayConvert 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 open-loop transfer function, use`getLoopTransfer(gensys,loc)`. Here,`loc`is the analysis point of interest.

This example shows how to create the low-pass filter *F* = *a*/(*s* + *a*) with
one tunable parameter *a*.

You cannot use `ltiblock.tf` to
represent *F*, because the numerator and denominator
coefficients of an `ltiblock.tf` 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 state-space (`genss`) model having both fixed and tunable
parameters.

Create a state-space model having the following state-space matrices:

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 fixed-value state-space matrices.

B = [-3.0;1.5]; C = [0.3 0]; D = 0;

Use

`ss`to create the state-space 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 the control system in the following illustration.

The plant response *G*(*s*) = 1/(*s* + 1)^{2}. The
model of sensor dynamics is *S*(*s*) = 5/(*s* + 4). The controller *C* is
a tunable PID controller, and the prefilter *F* = *a*/(*s* + *a*) is
a low-pass 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 `zpk` and `tf`.

G = zpk([],[-1,-1],1); S = tf(5,[1 4]);

Create a tunable representation of the controller *C*.

C = ltiblock.pid('C','PID');

C = Parametric continuous-time PID controller "C" with formula: 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 and tunable parameters Kp, Ki, Kd, Tf. Type "pid(C)" to see the current value and "get(C)" to see all properties.

`C` is a `ltiblock.pid` object,
which is a Control Design Block with a predefined proportional-integral-derivative
(PID) structure.

Create a model of the filter *F* = *a*/(*s* + *a*) 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`.

Connect the models together to construct a model of the
closed-loop response from *r* to *y*.

T = feedback(G*C,S)*F

`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.

Display the tunable elements of `T`.

T.Blocks

ans = C: [1x1 ltiblock.pid] a: [1x1 realp]

If you have Robust Control Toolbox software, you can use
tuning commands such as `systune` to tune the free
parameters of `T` to meet design requirements you
specify.

`connect` | `feedback` | `genfrd` | `genmat` | `getValue` | `ltiblock.pid` | `realp` | `ss` | `tf`

Was this topic helpful?