Mathematics for Engineers

State equations


What are state equations?


Suppose that we start with the equation that we saw before,

\ddot{x}=a

where a is now a function of time and each 'dot' means differentiation with respect to time.

By introducing the velocity v, we can break this down into two first-order equations

dx/dt = v

and

dv/dt = a

The usefulness becomes clearer when we look at a system where acceleration a is affected by x and v.

If we have a spring and a mass, we can write the acceleration as

a = - x k/m

so

ẍ + x k/m = 0

and we can spot solutions with the sines and cosines of t root(k/m).

But suppose that we add some damping, so that

a = - b x - c v

i.e. we have the familiar second order equation

ẍ + c ẋ + b x =0.

Suppose that instead of the second order equation we look at the pair of first-order equations

dx/dt =              v

dv/dt = - b x - c v

If we define a vector x to be (x, v)' we can write the equations in matrix form as

\begin{bmatrix}\dot{x}\\\dot{v}\end{bmatrix}
=\begin{bmatrix}0&1\\-b&-c\end{bmatrix}\begin{bmatrix}x\\v\end{bmatrix}

or

= A x

So how does that help?

If we can start x off as an eigenvector of A, then it will satisfy

= λ x and the solution will be

x = x(t=0) eλt

We can express any initial x as a combination of the eigenvectors, and so the solution will be of the form

x = a1 eλ1t + a2 eλ2t + a3 eλ3t   ....

For the simple problems it might look complicated, but when we get onto problems with multiple masses, springs and dampers it is all worth while.


Simulation

The concept of state variables arose in the days when simulations used operational amplifiers full of valves.  But they are just as useful today for simulating a system on a digital computer.

All the equations are now first order, so the rate-of-change of each variable is expressed as a function of all the variables and the inputs.  If we define a small time-step dt, we can say that the new value of x after the time step is

x + ẋ dt

Of course this is an approximation, but if we halve dt and then run the simulation again we can decide if dt is small enough.  If there is any significant difference between the simulations, halve it again.

The method works even if the equation is nonlinear, so that you can simulate systems that you cannot solve mathematically.