## Documentation Center |

This example shows how to plot and analyze
the step response for batch linearization results. *Batch
linearization results* refers to the `ss` model
array returned by the `slLinearizer` interface
or `linearize` function. This array contains linearizations
for varying parameter values, operating points, or both. You can use
the technique in this example to analyze the frequency response, stability,
or sensitivity for batch linearization results.

**Obtain batch linearization results.**

Load the batch linearization results saved in `scd_batch_lin_results1.mat`.

load scd_batch_lin_results1 linsys;

`linsys`, a 4 x 3 x 2 `ss` model
array, contains the closed-loop transfer function of the `watertank` model
from the reference input to the plant output. `linsys` was
obtained for four simulation snapshot times, `t = [0 1 2 3]`,
by varying the model parameters, `A` and `b`.
The sample values for `A` are `[10 20 30]`,
and the sample values for `b` are `[4 6]`.

**Plot the step response for the linearized models.**

stepplot(linsys);

**View the parameter combination and simulation snapshot
time that yielded a specific response.**

Click the response.

A data tip appears on the plot, providing information about
the selected response and the related model. The last lines of the
data tip show the parameter combination and simulation snapshot time
that yielded this response. In the previous plot, the selected response
corresponds to the model obtained by setting `A` to `30` and `b` to `6`.
The software linearized the model after simulating the model for two
time units.

**Plot the step response for a subset of the batch linearization
results.**

Suppose you want to view the responses for models linearized
at a specific simulation snapshot time, for example two time units.
Right-click the plot and select **Array Selector**.
The Model Selector for LTI Arrays dialog box opens.

The **Selection Criterion Setup** panel
contains three columns, one for each model array dimension of `linsys`.
The first column corresponds to the simulation snapshot time. The
third entry of this column corresponds to the simulation snapshot
time of two time units. Select only this entry in the first column.

Click **OK**. The plot displays the
responses for only the models linearized at two time units.

**Plot the step response for a specific parameter combination
and simulation snapshot time.**

Suppose you want to view the step response for the model obtained
by linearizing the `watertank` model at `t
= 3`, for `A = 10` and `b = 4`.
To do so, you can use the `SamplingGrid` property
of the linearized models, which is specified as a structure. When
you perform batch linearization, the software populates the `SamplingGrid` structure
with information regarding the variable values used to obtain the
model. *Variable values* includes each parameter
that you vary and the simulation snapshot times at which you linearize
the model. For example:

linsys(:,:,1).SamplingGrid

ans = A: 10 b: 4 Time: 0

Here `linsys(:,:,1)` refers to the first model
in `linsys`. This model was obtained at simulation
time `t = 0`, for `A = 10` and `b
= 4`.

Extract, from `linsys`, the model obtained
by linearizing the `watertank` model at `t
= 3`, for `A = 10` and `b = 4`:

sg = linsys.SamplingGrid; sys = linsys(:,:,sg.A == 10 & sg.b == 4 & sg.Time == 3);

The structure, `sg`, contains the sampling
grid for all the models in `linsys`. The expression `sg.A
== 10 & sg.b == 4 & sg.Time == 3` returns a logical
array. Each entry of this array contains the logical evaluation of
the expression for corresponding entries in `sg.A`, `sg.b`,
and `sg.Time`. `sys`, a model array,
contains all the `linsys` models that satisfy the
expression.

View the step response for `sys`.

stepplot(sys);

Was this topic helpful?