This example shows how to use the Linear Analysis Tool to batch linearize a Simulink® model. You vary model parameter values and obtain multiple open-loop and closed-loop transfer functions from the model.
scdcascade model used for this example
contains a pair of cascaded feedback control loops. Each loop includes
a PI controller. The plant models, G1 (outer loop)
and G2 (inner loop), are LTI models. In this example,
you use Linear Analysis Tool to vary the PI controller parameters
and analyze the inner-loop and outer-loop dynamics.
At the MATLAB® command line, open the Simulink model.
mdl = 'scdcascade'; open_system(mdl)
In the model window, select Analysis > Control Design > Linear Analysis to open the Linear Analysis Tool for the model.
To analyze the behavior of the inner loop, very the gains of
the inner-loop PI controller,
C2. As you can see
by inspecting the controller block, the proportional gain is the variable
and the integral gain is
Ki2. Examine the performance
of the inner loop for two different values of each of these gains.
In the Parameter Variations drop-down
The Parameter Variations tab opens. click Manage Parameters.
In the Select model variables dialog box, check the parameters
The selected variables appear in the Parameter Variations table.
Each column in the table corresponds to one of the selected variables.
Each row in the table represents one
at which to linearize. These parameter-value combinations are called parameter
samples. When you linearize, Linear Analysis Tool computes
as many linear models as there are parameter samples, or rows in the
Specify the parameter samples at which to linearize the
model. For this example, specify four
(3.5,1), (3.5,2), (5,1), and (5,2). Enter these values in the table
manually. To do so, select a row in the table. Then, select Insert Row > Insert Row Below twice.
Edit the values in the table as shown to specify the four
For more details about specifying parameter values, see Specify Parameter Samples for Batch Linearization
To analyze the inner-loop performance, extract a transfer function
from the inner-loop input
u1 to the inner-plant
y2, computed with the outer loop open. To
specify this I/O for linearization, in the Linear Analysis tab,
in the Analysis I/Os drop-down list, select
New Linearization I/Os.
Specify the I/O set by creating:
An input perturbation point at
An output measurement point at
A loop break at
Name the I/O set by typing
InnerLoop in the Variable
name field of the Create linearization I/O set dialog box.
The configuration of the dialog box is as shown.
For more information about specifying linearization I/Os, see Specify Portion of Model to Linearize.
Now that you have specified the parameter variations and the analysis I/O set for the inner loop, linearize the model and examine a step response plot. Click Step.
Linear Analysis Tool linearizes the model at each of the parameter
samples you specified in the Parameter Variations table. A new variable,
appears in the Linear Analysis Workspace section of the Data Browser.
This variable is an array of state-space (
models, one for each
(Ki2,Kp2) pair. The plot shows
the step responses of all the entries in
This plot gives you a sense of the range of step responses of the
system in the operating ranges covered by the parameter grid.
Examine the overall performance of the cascaded control system
for varying values of the outer-loop controller,
To do so, vary the coefficients
at the values specified in the model.
In the Parameter Variations tab, click Manage Parameters.
Kp1. Click OK.
Use Linear Analysis Tool to generate parameter values
automatically. Click Generate Values.
In the Values column of the Generate Parameter
Values table, enter an expression specifying the possible values for
each parameter. For example, vary
± 50% of their nominal values, by entering expressions as shown.
The All Combinations gridding method
generates a complete parameter grid of
to compute a linearization at all possible combinations of the specified
values. Click Overwrite to
replace all values in the Parameter Variations table with the generated
Because you want to examine the overall closed-loop transfer
function of the system, create a new linearization I/O set. In the Linear
Analysis tab, in the Analysis I/Os drop-down
Create New Linearization I/Os.
r as an input perturbation point, and
the system output
y1m as an output measurement.
Linearize the model with the parameter variations and
examine the step response of the resulting models. Click Step to
linearize and generate a new plot for the new model array,
The step plot shows the responses of every model in the array. This plot gives you a sense of the range of step responses of the system in the operating ranges covered by the parameter grid.
Although the new plot reflects the new set of parameter variations,
Plot 1 and
linsys1 are unchanged. That
plot and array still reflect the linearizations obtained with the
inner-loop parameter variations.
The results of both batch linearizations,
are arrays of state-space (
ss) models. Use these
arrays for further analysis in any of several ways:
Create additional analysis plots, such as Bode plots or impulse response plots, as described in Analyze Results Using Linear Analysis Tool Response Plots.
Examine individual responses in analysis plots as described in Analyze Batch Linearization Results in Linear Analysis Tool.
Drag the array from Linear Analysis Workspace to the MATLAB workspace.
You can then use Control System
Toolbox™ control design tools,
such as the Linear System Analyzer (Control System Toolbox) app,
to analyze linearization results. Or, use Control System
design tools, such as
pidtune or Control System Designer, to
design controllers for the linearized systems.
Also see Validate Batch Linearization Results for information about validating linearization results in the MATLAB workspace.