As systems become more complex, representing them with differential equations or transfer functions becomes cumbersome. This is even more true if the system has multiple inputs and outputs. This document introduces the state space method which largely alleviates this problem. The state space representation of a system replaces an n^{th} order differential equation with a single first order matrix differential equation. The state space representation of a system is given by two equations :
Note: Bold face characters denote a vector or matrix.The variable x is more commonly used in textbooks and other references than is the variable q when state variables are discussed. The variable q will be used here since we will often use x to represent position.
The first equation is called the state equation, the second equation is called the output equation. For an n^{th} order system (i.e., it can be represented by an n^{th} order differential equation) with r inputs and m outputs the size of each of the matrices is as follows:
Note several features:
For systems with a single input and single output (i.e., most of the systems we will consider) these variables become (with r=1 and m=1):
where
Advantages of this representation include:
Consider an 4^{th} order system represented by a single 4^{th} order differential equation with input x and output z.
We can define 4 new variables, q1 through q4.
but
We can now rewrite the 4^{th} order differential equation as 4 first order equations
This is compactly written in state space format as
with
For this problem a state space representation was easy to find. In many cases (e.g., if there are derivatives on the right side of the differential equation) this problem can be much more difficult. Such cases are explained in the discussion of transformations between system representations.
Another important point is that the state space representation is not unique. As a simple example we could simply reorder the variables from the example above (the new state variables are labeled q_{new}). This results in a new state space representation
In the previous case careful examination of the original and modified state space system reveals that they represent the same system. However we can make entirely new state variables by forming linear combination of the original state variables in which this equality is not obvious. Consider the state variable q_{new} defined as follows:
In this case the new state space variables are given by (the details of how these matrices are determined are not important for this discussion. They are given here if you are interested):
This new state space system is quite different from the original one, and it is not at all obvious that they represent the same system. (It can be shown that the systems are identical by transforming the state space representation to a transfer function. Techniques for doing so are discussed elsewhere.)
A n^{th} order linear physical system can be represented using a state space approach as a single first order matrix differential equation:
The first equation is called the state equation and it has a first order derivative of the state variable(s) on the left, and the state variable(s) and input(s), multiplied by matrices, on the right. The second equation is called the output equation and it has the output on the left and the state variable(s) and input(s), multiplied by matrices, on the right. No other terms are allowed in the equation. In these equations:
For a single input, single output system (the case that interests us the most):
The state space representation is not unique; many (actually an infinite number) of state space systems can be used to represent any linear physical system.
Another, powerful, way to develop a state space model is directly from the free body diagrams. If you choose as your state variables those quantities that determine the energy in the system, a state space system is often easy to derive. For example, in a mechanical system you would choose extension of springs (potential energy, ½kx²) and the velocity of masses (kinetic energy, ½mv²); for electrical systems choose voltage across capacitors, ½Ce² (e=voltage)) and current through inductors (½Li²). This is best illustrated by several examples, two rotating and one electrical.
Derive a state space model for the system shown. The input is f_{a} and the output is z.
We can write free body equations for the system at x and at y.
Freebody Diagram | Equation |
There are three energy storage elements, so we expect three state equations. The energy storage elements are the spring, k_{2}, the mass, m, and the spring, k_{1}. Therefore we choose as our state variables x (the energy in spring k_{2} is ½k_{2}x²), the velocity at x (the energy in the mass m is ½mv², where v is the first derivative of x), and y (the energy in spring k_{1} is ½k_{1}(z-x)² , so we could pick z-x as a state variable, but we'll just use z (since x is already a state variable; recall that the choice of state variables is not unique). Our state variables become:
Now we want equations for their derivatives. The equations of motion from the free body diagrams yield
or
with the input u=f_{a}, and the output y=z.
This technique does not always easily yield a set of state equations (read about some examples here). In some cases it is easier to develop a transfer function model and convert this to a state space model. Transfer functions are discussed elsewhere.
The energy variables for rotating systems are potential energy stored in springs (½K_{r}θ²) and kinetic energy stored in inertial elements (½Jω²).
Derive a state space model for the system shown. The input is τ_{a} and the output is θ_{1}.
We can write free body equations for the system at θ_{1} and θ_{2}
Freebody Diagram | Equation |
There are three energy storage elements, so we expect three state equations. Energy is stored as potential energy in the spring (½K_{r}θ_{1}²) and kinetic energy in the two flywheels (½J_{1}α_{1}², ½J_{2}α_{2}²). Our state variable equations become:
Now we want equations for their derivatives. The equations of motion from the free body diagrams yield
or
with the input u=τ_{a}, and the output y=θ_{1}.
To develop a state space system for an electrical system, try choosing the voltage across capacitors, and current through inductors as state variables. Recall that
so if we can write equations for the voltage across an inductor, it becomes a state equation when we divide by the inductance (i.e., if we have an equation for e_{inductor} and divide by L, it becomes an equation for di_{inductor}/dt which is one of our state variables). Likewise if we can write an equation for the current through the capacitor and divide by the capacitance it becomes a state equation for e_{capacitor}. This is best illustrated by an example.
Derive a state space model for the system shown. The input is i_{a} and the output is e_{2}.
There are three energy storage elements, so we expect three state equations. Try choosing i_{1}, i_{2} and e_{1} as state variables. Now we want equations for their derivatives. The voltage across the inductor L_{2} is e_{1} (which is one of our state variables)
so our first state variable equation is
If we sum currents into the node labeled n1 we get
This equation has our input (ia) and two state variable (iL2 and iL1) and the current through the capacitor. So from this we can get our second state equation
Our third, and final, state equation we get by writing an equation for the voltage across L_{1} (which is e_{2}) in terms of our other state variables
We also need an output equation:
So our state space representation becomes
This technique does not always easily yield a set of state equations. In some cases it is easier to develop a transfer function model and convert this to a state space model. Transfer functions are discussed elsewhere.
There are several cases when it is not so straightforward to develop a state space model from a system diagram. Some of these are discussed here.
The state space representation of a system is a common and extremely powerful method of representing a system mathematically. This page only discusses how to develop the state space representation, the solution of state space problems are discussed elsewhere.
Since state space is equivalent to the other representations, there must be a way to transform from one representation to another. These methods are discussed here.