Main Content

Linearize at Simulation Snapshot

This example shows how to use the Model Linearizer to linearize a model by simulating the model and extracting the state and input levels of the system at specified simulation times.

To linearize your model at the command line, use the linearize function.

  1. Open the Simulink® model.

    sys = 'watertank';

  2. Open the Model Linearizer for the model.

    In the Simulink model window, in the Apps gallery, click Model Linearizer.

  3. To specify linearization input and output points, open the Linearization tab. To do so, in the Apps gallery, click Linearization Manager.

  4. To specify an analysis point for a signal, click the signal in the model. Then, on the Linearization tab, in the Insert Analysis Points gallery, select the type of analysis point.

    • Configure the output signal of the PID Controller block as an Input Perturbation.

    • Configure the output signal of the Water-Tank System block as an Open-loop Output.

  5. Create a new simulation-snapshot operating point at which to linearize the model. In the Model Linearizer, in the Operating Point drop-down list, select Take simulation snapshot.

  6. In the Enter snapshot times to linearize dialog box, in the Simulation Snapshot Times field, enter one or more snapshot times at which to linearize. For this example, enter 10 to extract the operating point at this simulation time.


    To linearize the model at several operating points, specify a vector of simulation times in the Simulation Snapshot Times field. For example, entering [1 10] results in an array of two linear models, one linearized at t = 1 and the other at t = 10.

  7. Generate the simulation-snapshot operating point. Click Take Snapshots.

    The operating point op_snapshot1 appears in the Linear Analysis Workspace. In the Operating Point drop-down list, this operating point is now selected as the operating point to be used for linearization.

  8. Linearize the model at the specified operating point and generate a bode plot of the result.

    Click Bode. The Bode plot of the linearized plant appears, and the linearized plant linsys1 appears in the Linear Analysis Workspace.

  9. Double-click linsys1 in the Linear Analysis Workspace to see the state space representation of the linear model. Right-click on the plot and select information from the Characteristics menu to examine characteristics of the linearized response.

  10. Close Simulink model.


Related Topics