| Simulink Control Design | ![]() |
www.kxcad.net Home > CAE Software Index > MATLAB Index >
| On this page… |
|---|
Workflow for Comparing the Linearized and Original Models Impact of Operating Point on Comparison of Linearized and Original Models |
To create accurate linearized models, it is important to be able to interpret the results and to understand the linearization algorithms. One method of interpreting the results is by simulating the linearized model and comparing the output with the original model. This helps to determine if the linearized system behaves in a similar way to the original model.
To compare the linearized and original models
Re-insert the linearized subsystem into the model.
Configure the inputs and operating points so that they are the same as in the original model.
Compare output signals from a simulation of the two models.
When comparing models, remember that the states, inputs, and outputs of the linearized model are defined about an operating point of the original model, using the following variables:

This means that when the original model is at the operating point x(t)=x0, u(t)=u0, y(t)=y0, the linearized model will be at the operating point δx(t)=0, δu(t)=0, δy(t)=0. To compare the models accurately, subtract u0 from input values and x0 from the initial state values in the linearized model, then add y0 to the output signal.
When you linearize only a portion of the original model, you should simulate the linearized model by substituting it back into the model in place of the original portion. This ensures that the operating point and inputs to the linearized portion are correct. To do this, export the linearized model to the workspace, delete the original portion from the model, and replace it with an LTI System block based on the linearized model.
This example compares the magball model with the linearized model computed in Linearizing the Model:
If you have not done so already, linearize the magball model at the targeted operating point computed in Creating Operating Points from Specifications.
To create a new model containing the linearized plant system, first export the linearized model and operating point from the Control and Estimation Tools Manager to the MATLAB® workspace. To do this, right click the linearized model name in the project tree of the Control and Estimation Tools Manager. Select Export from the menu. Accept the default name for the model, Model_sys, and for the operating point, Model_op.
Create a new Simulink® model, magball_lin, which is a copy of the original model, magball. Replace the Magnetic Ball Plant subsystem in magball_lin with an LTI System block (located in the Control System Toolbox category of the Simulink Library Browser). Import the linearized model into this block by entering Model_sys in the LTI system variable field in the Block Parameters window.
For simulations of the nonlinear and linearized models to be compared, you need to set the operating points for each model by specifying the initial values of the states in the models:
magball
To set the initial values for the magball model, in the Control and Estimation Tools Manager, right click on the operating point that you used for the linearization, and select Export to Workspace to open the Export to Workspace dialog box.
Within the Export to Workspace dialog box, click Model Workspace as the location to export the operating point to, and select the check box Use the operating point to initialize model.

Click OK to export the operating point to the model workspace and use it to define the initial values of states in the model.
magball_lin
In magball_lin, the operating point values for the linearized system will all be zero since this subsystem was linearized about the operating point values. The operating point values in the Controller will be the same as in the original model since the Controller was not linearized. To create a vector of initial state values with the correct state ordering, first create a new operating point object for the system by typing
op=operpoint('magball_lin')Change the operating point for the Controller in op to be the same as those in Model_op.
op.States(1).x=Model_op.States(1).x
This returns the following operating point:
Operating Point for the Model magball_lin.
(Time-Varying Components Evaluated at time t=0)
States:
----------
(1.) magball_lin/Controller/Controller
x: 0
x: -2.56e-006
(2.) magball_lin/LTI System/Internal
x: 0
x: 0
x: 0
Inputs: None Keep the operating point for the LTI system as zero.
Create a Simulink structure from this operating point using the getstatestruct function. The structure contains the operating point values in a format that Simulink can use to set initial values.
x_struct=getstatestruct(op);
To use the values in x_struct1, as initial values for magball_lin, select Simulation > Configuration Parameters in the magball_lin model window, then click the Data Import/Export tab. Select the check box next to Initial State and enter x_struct on the right. Click OK .
The output of magball_lin will be zero at the operating point. To create an output signal that is comparable with that in magball, add a Constant block, with a value of 0.05 to the output of magball_lin. Similarly, the input to magball_lin should be zero at the operating point. This is achieved by subtracting a value of 14 from the input signal of the linearized system. The operating point values, 0.05 and 14, were found using a Scope block to measure steady-state signal levels in the original model.
To observe the response of the models to a perturbation, add a Step block with the following parameter values to the input to the plant in both models.
Parameter Values for Step Block

The model diagrams should now look like those in the following figures.
Magball Model with a Step Block Added to the Input

Magball Model with Linearized Magnetic Ball Plant

Run simulations in both models. The output signals, in the Scope blocks, are shown in the following figure.
Scope Blocks from Original (left) and Linearized (right) Models

As shown in the figure, both the original and linearized models react to the step input in a similar way.
| Understanding Analysis in Simulink Control Design | Choosing a Linearization Algorithm Method | ![]() |
© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments