Skip to Main Content Skip to Search
Product Documentation

Linearize at Model Operating Point

Linearize Simulink Model

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.

 Code Alternative

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

  2. In the Simulink model window, select Tools > Control Design > Linear Analysis.

    This action opens the Linear Analysis Tool for the model.

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

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

      Note   Do not open the loop by manually removing the feedback signal from the model. Removing the signal manually changes the operating point of the model.

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

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

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

  8. Close Simulink model.

    bdclose(sys);

 Related Examples

Visualize Bode Response of Simulink Model During Simulation

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

  1. Open Simulink model.

    For example:

    watertank
  2. Open the Simulink Library Browser by selecting View > Library Browser in the model window.

  3. Add a plot block to the Simulink model.

    1. In the Simulink Control Design library, select Linear Analysis Plots.

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

  4. Double-click the block to open the Block Parameters dialog box.

    To learn more about the block parameters, see the block reference pages.

  5. Specify the linearization I/O points.

      Tip   If your model already contains I/O points, the block automatically detects these points and displays them.

    1. To specify an input:

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

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

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

    2. To specify an output:

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

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

      3. In the Configuration drop-down list of the Linearization inputs/outputs table, select Output for watertank/Water-Tank System : 1.

      4. Select the Open Loop option for watertank/Water-Tank System : 1.

      The Linearization inputs/outputs table now resembles the following figure.

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

  6. Save the linear system.

    1. Select the Logging tab.

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

  7. Click Show Plot to open an empty plot.

  8. 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'

 Examples and How To

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS