How to Write Coupled Nonlinear ODEs in State-Space Form
At a glance
- 1. Choose the states
Use enough variables to represent the system’s configuration and the derivatives needed to determine its future.
- 2. Make equations first order
Introduce state variables for higher derivatives, such as velocity for each second-order position equation.
- 3. Collect the derivatives
Write each state derivative as a function of the full state, the input, and, when needed, time.
- 4. Specify the output
Define the measured or required output separately as a function of the state and input.
A state-space representation rewrites a system of differential equations as a set of first-order equations for a vector of state variables. For a nonlinear system, the standard form is
where is the state, is the input, and is the output. The equations may be coupled: the derivative of one state can depend on several other states. That dependence is included in the function .
What state-space form means
A state is a collection of variables that, together with the input and the system equations, determines how the system evolves from its current condition. If the model has no external input, write , or when it is also time-independent (autonomous).
For a linear system, the state equation often has the form . A general nonlinear system instead uses a possibly nonlinear function . You should not expect constant matrices and to represent it exactly. A nonlinear model can sometimes be approximated by a linear model near an equilibrium, but that is a separate step.
Convert higher-order equations to first order
If the original equations contain second derivatives, introduce a state for each position-like variable and another for its first derivative. More generally, introduce enough state variables to express the system using only first derivatives. Then solve the original equations for those derivatives and collect the resulting equations into a vector.
The state choices are not unique. A useful choice is one that makes the equations explicit, keeps the variables physically interpretable, and avoids unnecessary states. The number of states is often the number of independent initial conditions needed to determine a solution.
Worked example: two coupled nonlinear equations
Consider the system
The terms and make the equations nonlinear, and each equation involves a variable that also appears in the other equation. The input acts on the first equation.
Define positions and velocities as the states:
The first two state derivatives follow directly from these definitions: and . Rearranging the original equations gives
Substitute the state variables to obtain the state-space model:
If the output is the pair of positions, define . If the output is only , define . The output equation depends on what you want to measure; it does not have to include every state.
When the equations are implicit
Some models are given in a form such as . If the mass matrix is invertible at the conditions of interest, solve for acceleration:
Then take and write . If the matrix is singular, you may have a differential-algebraic system rather than an ordinary explicit state equation; it cannot necessarily be put into this form just by taking its inverse.
Common mistakes
- Forgetting a velocity state: A second-order equation requires both a position and a velocity state for each independent coordinate.
- Leaving derivatives on the right-hand side: Solve for the highest derivatives before writing the state equation.
- Dropping cross-coupling: Keep terms involving other states, such as , in the appropriate derivative equation.
- Calling the model linear because it is a vector equation: A vector form does not make the system linear. Products, powers, and nonlinear functions of states generally make nonlinear.
- Confusing states with outputs: States describe the system’s internal condition; outputs are the quantities selected for measurement or reporting.
Check the result by substituting the state definitions back into each component equation. Each component of must match the derivative of its corresponding state, and the reconstructed equations should agree with the original model.
References
- Nonlinear Systems, 3rd Edition — Hassan K. Khalil
- Applied Nonlinear Control — Jean-Jacques E. Slotine and Weiping Li
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.