Main Content

Linearizing at an Operating Point

What Is Linearization?

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.

What Is a Linearized Model?

Near an operating point, you can express the system state x, inputs u, and outputs y relative to that operating point in terms of xx0, uu0, and yy0. For convenience, shift the vectors by subtracting the operating point: xx0x, 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 depend explicitly on time, the linearized dynamics near the operating point are 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.

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.

Example

A pilot is flying, or simulating, an aircraft in level, constant-velocity, and constant-altitude flight relative to the ground. 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.

Choosing a Good Operating Point for Linearization

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 one direction and smoother behavior in another.

  • Small perturbations might result in a discontinuous change in a state value, making the current state unsuitable for 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. A common example is actuation systems, which should be linearized away from any hard constraints or end stops.

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.

Linearizing a Physical Model

Use the following methods to create numerical linearized state-space models from a model containing Simscape components.

Tip

The Simulink® Control Design™ product is recommended for linearization analysis.

Independent Versus Dependent States

An important difference from basic 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 independent (unconstrained) Simscape dynamic variables and other Simulink states.

  • The dependent states consist of Simscape algebraic variables and dependent (constrained) Simscape 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 (Control System Toolbox) and sminreal (Control System Toolbox) functions from Control System Toolbox™ software

  • Automatically with the Simulink Control Design approach

Linearizing with Simulink Control Design Software

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.

To linearize a model with an operating point object, use the linearize (Simulink Control Design) function, customizing where necessary. The resulting state-space object contains the matrices A, B, C, D.

You can also use the graphical user interface, through the Simulink Toolstrip: on the Apps tab, under Control Systems, click Model Linearizer.

For more information on linearizing Simscape models using Simulink Control Design, see Linearize Simscape Networks (Simulink Control Design).

Linearizing with the Simulink linmod and dlinmod Functions

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.

Note

The linmod and dlinmod functions provide only basic linearization capabilities. For full linearization functionality, use Simulink Control Design software. For more information, see Choose Linearization Tools (Simulink Control Design).

For more information about Simulink linearization, see Linearizing Models.

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 linmod 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:

  1. Open one or more Solver Configuration blocks in your model.

  2. Select the Start simulation from steady state check box for the physical networks that you want to linearize.

  3. Close the Solver Configuration dialog boxes and save the modified model.

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

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.

Linearizing with Simulink Linearization Blocks

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, it is recommended 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.