| Contents | Index |
| On this page… |
|---|
Linearizing a Model with Simscape, Simulink, and Related Products |
Determining the response of a system to small perturbations at an operating point is a critical step in system and controller design. Once you find an operating point, you can linearize the model about that operating point to explore the response and stability of the system. To find an operating point in a Simscape model, see Finding an Operating Point.
Near an operating point, you can express the system state x, inputs u, and outputs y relative to that operating point in terms of x – x0, u – u0, and y – y0. For convenience, shift the vectors by subtracting the operating point: x – x0 → x, and so on.
If the system dynamics do not explicitly depend on time and the operating point is a steady state, the system response to state and input perturbations near the steady state is approximately governed by a linear time-invariant (LTI) state space model:
dx/dt = A·x + B·u
y = C·x + D·u.
The matrices A, B, C, D have components and structures that are independent of the simulation time. A system is stable to changes in state at an operating point if the eigenvalues of A are negative.
If the operating point is not a steady state or the system dynamics depends explicitly on time, the linearized dynamics near the operating point is more complicated. The matrices A, B, C, D are not constant and depend on the simulation time t0 , as well as the operating point x0 and u0 [3].
Tip While you can linearize a closed system with no inputs or outputs and obtain a nonzero A matrix, obtaining a nontrivial linearized input-output model requires at least one input component in u and one output component in y. |
A pilot is flying, or simulating, an aircraft in level, constant-velocity, and constant-altitude flight relative to the ground, in a known environment. A crucial question for the aircraft pilot and designers is: will the aircraft return to the steady state if perturbed from it by a disturbance, such as a wind gust — in other words, is this steady state stable? If the operating point is unstable, the aircraft trajectory can diverge from the steady state, requiring human or automatic intervention to maintain steady flight.
Although steady-state and other operating points (state x0 and inputs u0) might exist for your model, that is no guarantee that such operating points are suitable for linearization. The critical question is: how good is the linearized approximation compared to the exact system dynamics?
When perturbed slightly, a problematic operating point might exhibit strong asymmetries, with strongly nonlinear behavior when perturbed in certain ways and smoother behavior in other ways.
Small perturbations might change discrete states in a large, discontinuous way that violates the linear approximation.
Operating points with a strongly nonlinear or discontinuous character are not suitable for linearization. You should analyze such models in full simulation, away from any discontinuities, and perturb the system by varying its inputs, parameters, and initial conditions.
Tip Check for such an unsuitable operating point by linearizing at several nearby operating points. If the results differ greatly, the operating point is strongly nonlinear or discontinuous. |
Note One step in this example (creating Bode plots) requires Control System Toolbox™ software. |
The ssc_hydraulic_system_2_way_valve model simulates a hydraulic system made up of a valve and piston, with a controller based on the linear position of the piston. To examine the valve characteristics, open the Cylinder DA Custom block. Run the model with the Position scope open.
The piston has two natural operating points, at zero position and at the stop. Without feedback control, both operating points are steady states. Create an open-loop system by deleting the feedback signal line from Ideal Translational Motion Sensor to PS Subtract. Then run the model again to see these steady states.
The operating point at piston position of 0 m is appropriate for linearization, because of this state's quasi-linear character. In this position, the piston can move freely forward and backward.
The operating point at the stop (stroke at 0.3 m) is not appropriate for linearization. This state's response is quasi-linear if perturbed by moving the piston back slightly, but highly nonlinear if you attempt to push the piston beyond the stop.
Open the modified version of the model, ssc_hydraulic_system_2_way_valve_trimlin. This version is set up for stability analysis with the hydraulic plant confined to its own subsystem and model-level input and output ports.
To see the simulation results, run the model first. Check the suitability of these operating points for linearization by linearizing to obtain the A, B, C, D matrices.
Linearize at zero piston position. To do this automatically, double-click the Linearize block. The result is plotted as a Bode diagram.
Then linearize at a few other positions close to zero (slightly more than 0 m).
Linearize at the piston stop, then a few other positions just short of the stop (a little less than 0.3 m).
Once you have a series of A matrices near zero and near the stop, you can define scalar-invariant metrics from A for comparison purposes. One such metric is the trace of A, the sum of its eigenvalues.
The suitability of the operating point at zero means that the trace of A varies little over operating points near zero.
The unsuitability of the operating point at the stop means that the trace of A varies significantly over operating points near the stop.
These characteristics indicate that this operating point is highly nonlinear and changes too rapidly for small perturbations to make a good linearization point.
Once you know an operating point, you have three practical methods for investigating the system response to small disturbances.
You can experiment with the system or a system simulation by making repeated, different, and slight changes to the system parameters, inputs, and initial conditions, while operating at a steady state. This method requires costly trial and error and generates uncontrolled and imprecise approximations.
If you know the system state dynamics and an operating point x0 and u0 in analytic form, you can apply standard approximation techniques to derive an analytic form for the A, B, C, D matrices.
If you have a controlled numerical approximation to your system state dynamics and operating point, you can apply standard computational techniques to generate numerical approximations to the A, B, C, D matrices.
Simulink and Simscape features provide methods for generating numerical linearized models.
Use the following methods to create numerical linearized state-space models from a model containing Simscape components.
An important difference from normal Simulink models is that the states in a physical network are not independent in general, because some states have dependencies on other states through constraints.
The independent states are a subset of system variables and consist of Simscape dynamic variables and Simulink states.
The dependent states consist of Simscape algebraic variables and dependent (constrained) dynamic variables.
For more information on Simscape dynamic and algebraic variables, see How Simscape Simulation Works.
The complete, unreduced LTI A, B, C, D matrices have the following structure.
The A matrix, of size n_states by n_states, is all zeros except for a submatrix of size n_ind by n_ind, where n_ind is the number of independent states.
The B matrix, of size n_states by n_inputs, is all zeros except for a submatrix of size n_ind by n_inputs.
The C matrix, of size n_outputs by n_states, is all zeros except for a submatrix of size n_outputs by n_ind.
The D matrix, of size n_outputs by n_inputs, can be nonzeros everywhere.
Obtaining the Independent Subset of States. A minimal linearized solution uses only an independent subset of system states. From the matrices A, B, C, D, you can obtain a minimal input-output linearized model with:
The minreal and sminreal functions from Control System Toolbox software
Automatically with the Simulink Control Design approach
Note The techniques described in this section require the Simulink Control Design product. You must use the features of this product on the Simulink lines in your model, not directly on Simscape physical network lines or blocks. |
This approach requires that you start with an operating point object saved from trimming the model to an operating specification, as explained in Using Simulink Control Design Techniques to Find Operating Points.
To linearize a model with an operating point object, use the linearize function, customizing where necessary. The resulting state-space object contains the matrices A, B, C, D.
Additional Simulink Control Design Methods. You can also use the graphical user interface, through the model menu bar: Tools > Control Design > Linear Analysis. For more details on linearization, operating points and state-space objects, related functions, and the graphical interface, see the Simulink Control Design documentation.
You have several ways that you can use the Simulink functions linmod and dlinmod, and the linearization results can differ depending on the method chosen. To use these functions, you do not have to open the model, just have the model file on your MATLAB path.
For more information about Simulink linearization, see Linearizing Models in the Simulink documentation.
Tip If your model has continuous states, use linmod. (Continuous states are the Simscape default.) If your model has mixed continuous and discrete states, or purely discrete states, use dlinmod. Linearizing a model with the local solver enabled (in the Solver Configuration block) is not supported. |
Linearizing with Default State and Input. You can call linmod without specifying state or input. Enter linmod('modelname') at the command line.
With this form of linmod, Simulink linearization solves for consistent initial conditions in the same way it does on the first step of any simulation. Any initial conditions, such as initial offset from equilibrium for a spring, are set as if the simulation were starting from the initial time.
linmod allows you to change the time of externally specified signals (but not the internal system dynamics) from the default. For this and more details, see the function reference page.
Linearizing with the Steady-State Solver at an Initial Steady State. You can linearize at an operating point found by the Simscape steady-state solver:
Open one or more Solver Configuration blocks in your model.
Select the Start simulation from steady state check box for the physical networks that you want to linearize.
Close the Solver Configuration dialog boxes and save the modified model.
Enter linmod('modelname') at the command line.
linmod linearizes at the first step of simulation. In this case, the initial state is also an operating point, a steady state.
For more about setting up the steady-state solver, see the Solver Configuration block reference page. For more details on its use, see Using the Simscape Steady-State Solver.
Linearizing with Specified State and Input — Ensuring Consistency of States. You can call linmod and specify state and input. Enter linmod('modelname',x0,u0) at the command line. The extra arguments specify, respectively, the steady state x0 and inputs u0 for linearizing the simulation. When you specify a state to linmod, ensure that it is self-consistent, within solver tolerance.
With this form of linmod, Simulink linearization does not solve for initial conditions. Because not all states in the model have to be independent, it is possible, though erroneous, to provide linmod with an inconsistent state to linearize about.
If you specify a state that is not self-consistent (within solver tolerance), the Simscape solver issues a warning at the command line when you attempt linearization. The Simscape solver then attempts to make the specified x0 consistent by changing some of its components, possibly by large amounts.
Tip You most easily ensure a self-consistent state by taking the state from some simulated time. For example, by selecting the States check box on the Data Import/Export pane of the model Configuration Parameters dialog box, you can capture a time series of state values in a simulation run. |
You can generate linearized state-space models from your Simscape model by adding a Timed-Based Linearization or Trigger-Based Linearization block to the model and simulating. These blocks combine time-based simulation, up to specified times or internal trigger points, with state-based linearization at those times or trigger points.
For complete details about these blocks, see their respective block reference pages.
Note If your model contains PS Constant Delay or PS Variable Delay blocks, or custom blocks utilizing the delay operator in the Simscape language, MathWorks recommends that you linearize the model by using the Timed-Based Linearization or Trigger-Based Linearization block and simulating the model for a time period longer than the specified delay time. |
![]() | Finding an Operating Point | Finding and Using Operating Points in an Electronic Circuit | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |