| Contents | Index |
| On this page… |
|---|
This example shows how to use the Linear Analysis Tool to linearize a model at the operating point specified in the model. The model operating point consists of the model initial state values and input signals.
Open Simulink model.
sys = 'watertank'; open_system(sys)
The Water-Tank System block represents the plant in this control system and includes all of the system nonlinearities.

In the Simulink model window, select Tools > Control Design > Linear Analysis.
This action opens the Linear Analysis Tool for the model.

In the Simulink model window, define the portion of the model to linearize:
Right-click the PID Controller block output signal, which is the input to the plant. Select Linearization Points > Input Point.
Right-click the Water-Tank System output signal, and select Linearization Points > Output Point.
The linearization I/O markers appear in the model.

Right-click the Water-Tank System output signal and select Linearization Points > Open Loop.
This command removes the effects of the feedback signal on the linearization without changing the model operating point. The loop opening marker appears in the model.

In the Exact Linearization tab of the Linear
Analysis Tool, click
for the Analysis I/Os list
to see the model linearization input and output points.

Click
for the Operating Point list
to see the selected operating point. By default, the model initial
condition is selected as the operating point.
This action launches the Model Initial Condition Viewer.

In the Plot linear result in a list, select Bode response plot.

Click
to linearize
the model.
The Bode plot of the linearized system appears.

This Bode plot looks like a stable first-order response, as expected.
Close Simulink model.
bdclose(sys);
This example shows how to visualize linear system characteristics of a nonlinear Simulink model during simulation, computed at the model operating point (simulation snapshot time of 0).
Open Simulink model.
For example:
watertank
Open the Simulink Library Browser by selecting View > Library Browser in the model window.
Add a plot block to the Simulink model.
In the Simulink Control Design library, select Linear Analysis Plots.

Drag and drop a block, such as the Bode Plot block, into the model window.
The model now resembles the following figure.

For more information on the blocks, see the Linear Analysis Plots block reference pages.
Double-click the block to open the Block Parameters dialog box.

To learn more about the block parameters, see the block reference pages.
Specify the linearization I/O points.
Tip If your model already contains I/O points, the block automatically detects these points and displays them. |
To specify an input:
Click
adjacent to the Linearization
inputs/outputs table.
The Block Parameters dialog expands to display a Click a signal in the model to select it area.

In the Simulink model, click the output signal of the PID Controller block to select it.
The Click a signal in the model to select it area updates to display the selected signal.

Click
to add the signal to the Linearization
inputs/outputs table.

To specify an output:
In the Simulink model, click the output signal of the Water-Tank System block to select it.
The Click a signal in the model to select it area updates to display the selected signal.

Click
to add the signal to the Linearization
inputs/outputs table.

In the Configuration drop-down list of the Linearization inputs/outputs table, select Output for watertank/Water-Tank System : 1.
Select the Open Loop option for watertank/Water-Tank System : 1.
The Linearization inputs/outputs table now resembles the following figure.

Click
to collapse the Click a signal
in the model to select it area.
Tip Alternatively, before you add the Linear Analysis Plots block, right-click the signals in the Simulink model and select Linearization Points > Input Points and Linearization Points > Output Points. Linearization I/O annotations appear in the model and the selected signals appear in the Linearization inputs/outputs table. |
Save the linear system.
Select the Logging tab.
Select the Save data to workspace option, and specify a variable name in the Variable name field.
The Logging tab now resembles the following figure.

Click Show Plot to open an empty plot.

Plot the linear system characteristics by clicking
in the plot window.
Alternatively, you can simulate the model from the model window.
The software linearizes the portion of the model between the linearization input and output at the default simulation time of 0, specified in Snapshot times parameter in the Block Parameters dialog box, and plots the Bode magnitude and phase.
After the simulation completes, the plot window resembles the following figure.

The computed linear system is saved as sys in the MATLAB workspace. sys is a structure with time and values fields. To view the structure, type:
sys
This command returns the following results:
sys =
time: 0
values: [1x1 ss]
blockName: 'watertank/Bode Plot'The time field contains the default simulation time at which the linear system is computed.
The values field is a state-space object which stores the linear system computed at simulation time of 0. To learn more about the properties of state-space objects, see ss in the Control System Toolbox documentation.
![]() | Specify Model Portion to Linearize | Linearize at Trimmed Operating Point | ![]() |

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |