Module 3F2: Systems and Control Lecture Notes 1: State-Space Systems
Module 3F2: Systems and Control Lecture Notes 1: State-Space Systems
1 Introduction
By way of introduction to the material of these lectures on state space models of dynamical
systems and control the pendulum laboratory experiment will be first described and then some
basic matrix manipulation results will be reviewed.
The dynamic equations for this laboratory experiment are (assuming that the moments of
inertia of the pendulum about its centre of mass is negligible and ignoring friction):
We can consider the input to be the amplifier input voltage, output current or the resulting
torque, T , which are just related by scaling factors. We will take the input to be
u = T /(aM + I/a),
3
ω12 = g/L
−1
ω02 = ω12 1 + M/m + I/(ma2 )
ω12
⇒ M/m + I/(ma2 ) =
ω02 − ω12
Recall that ω1 is the natural frequency of the pendulum when the cart is fixed, and it can be
shown that ω0 is the natural frequency of the pendulum when no force acts on the cart.
With this notation equations (1.1) and (1.2) become:
2
ω02 ω1 1 2
− cos(x3 /L) ẋ u − sin(x3 /L)x
ω02 −ω12 2 = ω02 −ω12 L 4
(1.3)
ẋ4 2
− cos(x3 /L) 1 −Lω1 sin(x3 /L)
Solving this equation for ẋ2 and ẋ4 together with the trivial identities ẋ1 = x2 and ẋ3 = x4 give
the nonlinear first order vector differential equation:
ω12
where defining α(x3 ) = sin2 (x3 /L) + ω02 −ω12
we have,
x2
1 ω12 1 2 2
α(x3 ) ω 2 −ω 2
u − L sin(x3 /L)x4 − Lω 1 sin(x3 /L) cos(x3 /L)
f (x, u) = 0 1
x4
1 ω12 2 2
ω ω
α(x3 ) ω02 −ω12
cos(x3 /L)u − L1 sin(x3 /L) cos(x3 /L)x24 − ω20−ω12 L sin(x3 /L)
0 1
The equation (1.4) is a standard form that is a common starting point for analysis.
Equilibrium States
A state, xe , and input ue are said to be an equilibrium state and input if the system remains in
this condition when released from this initial state, x(0) = xe and u(t) = ue for t ≥ 0. Hence in
(1.4) we need f (xe , ue ) = 0, so that ẋ(t) = 0 and hence remains zero.
Hence in this example x2e = x4e = 0 and (1.3) immediately gives that sin(x3e /L) = 0 and
ue = 0. There are therefore the two obvious equilibria with the pendulum vertically down,
x3e = 0, or vertically up, x3e = Lπ. In both cases the carriage position, x1 , can be arbitrary.
4
Linearization
Given an equilibrium condition we can linearize the equations about this point and obtain a
good approximation for the system behaviour near the equilibrium. Linearizing about the
equilibrium with x3 = 0 and for example x1 = 0, gives
x2
u − (ω 2 − ω 2 )x
0 1 3
ẋ(t) ≈
x4
2
u − ω0 x3
0 1 0 0 x1 0
0
0 −(ω02 − ω12 ) 0 x2 1
= + u (1.5)
0 0 0 1 x3
0
0 0 −ω02 0 x4 1
| {z } |{z}
A B
= Ax + Bu (1.6)
This is the standard form for a LINEAR dynamical system that we will study in some detail
using matrix techniques.
System Poles
To solve the state equations to get time histories we can take the Laplace transform of (1.6)
giving:
Therefore the transfer functions from the input to the states have a common denominator,
d(s), whose roots will be the system poles. Moreover the roots of d(s) = 0 are the Eigenvalues
of the matrix A.
State Feedback
Suppose we can measure the four states and make the input, u, a linear function of the
measured states:
u = w − k1 x1 − k2 x2 − k3 x3 − k4 x4
h i
= w − kx, where k = k1 k2 k3 k4
The closed loop poles will now be the eigenvalues of the matrix (A − Bk) which can in fact be
made arbitrary by suitable choice of the feedback gain vector.
6
2.1 States
The essence of a dynamical system is its memory, i.e. the present output, y(t) depends on past
inputs, u(τ ), for τ ≤ t.
The states may depend on u(τ ) and x(τ ) for τ ≤ t. However for any to < t1 , x(t1 ) can always
be determined from x(to ) and u(τ ), to ≤ τ ≤ t1 . [NB this is the definition of system state] That
is x(to ) summarizes the effect on the future of inputs and states prior to to .
The output, y at time t, is a memoryless function of x(t) and u(t).
7
The most general class of dynamical system that we will consider is described by the set of first
order ordinary differential equations -
dxi = fi (x1 (t), x2 (t), ...xn (t), u1 (t), ...um (t), t), i = 1, 2, ...n.
S dt
y (t) = gj (x1 (t), ...xn (t), u1 (t), ...um (t), t) j = 1, 2, ...p.
j
S is the standard form for a state-space dynamical system model. Or a vector form -
ẋ(t) = f (x(t), u(t), t)
S
y(t) = g(x(t), u(t), t)
Note that S has only first order ode’s, but we can use a standard technique to convert high
order o.d.e’s to first order vector o.d.e.’s, by the use of auxiliary variables.
Ex:
...
y +6y ÿ + 5(ẏ)3 + 12 sin(y) = cos(t)
ẋ(t) = f (x(t), t)
x2
f (x, t) =
x3
−6x1 x3 − 5x32 − 12 sin(x1 ) + cos(t)
8
ẋ(t) = Ax(t) + Bu(t)
S
y(t) = Cx(t) + Du(t)
Method 1: Choose system states, x1 , x2 , ...xn by considering the independent ‘energy storage
devices’ or ‘memory elements’,
e.g.
electrical circuits - current in L or voltage on C.
mechanics - positions and velocities of masses (linear and angular).
chemical engineering - temperature, pressure, volume, concentration.
Then use the basic physical laws derive expressions involving ẋi , e.g.
• V = Ldi/dt, i = Cdv/dt
d(posn )
• m × accn = force; = velocity.
dt
d(volume)
• = flow = function of pressure.
dt
In a negative feedback configuration the amplifier acts so as to make the +ve and -ve inputs
have essentially equal voltages.
C ẋ = (Vi − x1 )/R1 ; C2 ẋ2 = x1 /R2
1 1
Vo = x1 + x2
Linear operation until the amplifier saturates when quite different equations may hold.
If the amplifier output saturates at ±Vs , then for |x1 + x2 | ≥ Vs
we will have: C2 ẋ2 = (±Vs − x2 )/R2 .
10
This implies a velocity field in the state space which can give a good qualitative idea of the
system’s behaviour in simple cases.
Ex n=2
The velocity field can be sketched by drawing an arrow in the direction f (x) for many values of
x. Equilibrium points (or singular points) where f (xe ) = 0, may be stable or unstable.
Ex.
dx1
−L = x1 R + x2
dt
dx2
C = x1
dt
d x1 −R/L −1/L x1
=
dt x2 1/C 0 x2
2.5
1.5
0.5
−0.5
−1
−1.5
−2
−2.5
−2.5 −2 −1.5 −1 −0.5 0 0.5 1 1.5 2 2.5
−4 −1
(ii) Let R = 4, L = 1, C = 1 ⇒ A =
1 0
2.5
1.5
0.5
−0.5
−1
−1.5
−2
−2.5
−2 −1.5 −1 −0.5 0 0.5 1 1.5 2
The MATLAB code to produce these two sets of state-plane trajectories is as follows:
% A=[-.5 -1; 1 0]; % for underdamped example
A=[-4 -1; 1 0]; % for overdamped example
hold off
[x,y]=meshgrid(-2:.2:2,-2:.2:2);
xdot=A(1,1)*x+A(1,2)*y;
ydot=A(2,1)*x+A(2,2)*y;
Suppose we have a nonlinear (time invariant) dynamical system in state space form -
ẋ = f (x, u)
S
y = g(x)
∂fi ∂fi ∂fi
= fi (xe , ue ) + δx1 + δx2 + ... + δxn
∂x1 x ∂x2 x ∂xn x
e ,ue e ,ue e ,ue
∂fi ∂fi
+ δu1 + ... + δum + Remainder
∂u1 x ∂um x
e ,ue e ,ue
˙ ∼
δx = Aδx + Bδu
where
∂f1 ∂f1 ∂f1
∂x1 ∂x2 ··· ∂xn
∂f2 ∂f2
∂f ∂x1 ··· ∂xn
A= (xe , ue ) = .. ..
∂x
. .
∂fn ∂fn
∂x1 ··· ∂xn x=xe ,u=ue
∂f1 ∂f1 ∂f1
∂u1 ∂u2 ··· ∂um
∂f
.. ..
B= (xe , ue ) = . .
∂u
∂fn ∂fn
∂u1 ··· ∂um x=xe ,u=ue
∂g(xe )
Similarly δy = Cδx where C= ∂x .
˙
δx = Aδx + Bδu
δy = Cδx
which will accurately predict the system behaviour for x and u close to xe and ue respectively.
14
Quite often a system’s equations cannot easily be written as ẋ = f (x, u) but can be written as
The linearized model can be derived without solving for ẋ as follows. Since (xe , ue ) gives an
equilibrium we have,
F (0, xe , ue ) = 0
∂F ˙ ∂F ∂F
δx + δx + δu ≃ 0
∂ ẋ (0,x ,u ) ∂x (0,x ,u ) ∂u (0,x ,u )
e e e e e e
| {z } | {z } | {z }
L M N
˙ + M δx + N δu ≃ 0
Lδx =⇒ ˙ ≃ −L−1 M δx − L−1 N δu
δx
As mentioned above the linearized equations will accurately predict the behaviour of the
nonlinear system for x and u close to their equilibrium values. When the states and inputs are
far away from the equilibrium values then the behaviour can be quite different, e.g.
• many equilibria with some stable and some unstable (e.g. inverted pendulum).
• limit cycles.
• divergence.
Example: Van der Pol oscillator
ẋ = x
1 2
ẋ2 = −x1 + (1 − x2 )x2
1
-1
-2
-3
-2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5
Note that if we were to change the signs on the ẋ1 and ẋ2 terms then this will just change the
directions of the arrows in the state space. Hence the origin would then be a stable equilibrium
and the limit cycle would be unstable (i.e. if perturbed from the limit cycle then it would
either decay to the origin or diverge to infinity).
16
gives
and
G(s) = D + C(sI − A)−1 B
This can only happen when the matrix (sI − A) becomes singular, ie when
det(sI − A) = 0
Mij = (−1)i+j det(M with i-th row and j-th column deleted)
−1 1
Hence (sI − A) = N (s) where α(s) = det (sI − A)
α(s)
= sn + α1 sn−1 + · · · + αn−1 s + αn
and N (s) = N1 sn−1 + N2 sn−2 + · · · + Nn−1 s + Nn
1
The transfer function can therefore be written as G(s) = α(s) (CN (s)B + Dα(s)) with
(CN (s)B + Dα(s)) being a matrix of polynomials in s.
20
Cayley-Hamilton Theorem
An + α1 An−1 + · · · + αn I = 0
since
α(s)I = (sI − A) N1 sn−1 + N2 sn−2 + · · · + Nn
sn : An I = An N1
sn−1 : An−1 α1 I = An−1 N2 − An−1 AN1
.. ..
. .
s : Aαn−1 I = ANn − A2 Nn−1
s0 : αn I = −ANn
=⇒
x(t) = L−1 (sI − A)−1 x0 = Φ(t)x0
where
n o
−1
Φ(t) = L−1 (sI − A)
X
= L−1 Ak s−(k+1)
k≥0
= I + At + A2 t2 /2! + · · · + Ak tk /k! + · · ·
def
= eAt
21
Note that
d
Φ(t) = AeAt = eAt A
dt
(check by differentiating series expansion of Φ(t)).
Hence with x(t) = Φ(t)x0 ,
d d
x(t) = {Φ(t)x0 } = AeAt x0 = A {Φ(t)x0 } = Ax(t)
dt dt
Φ(0) = I
x(0) = x0
and the differential equation and initial condition are satisfied as required.
Φ(t) is called the state transition matrix.
Properties of eAt
A = T −1 ĀT
then A2 = T −1 ĀT T −1ĀT = T −1 Ā2 T
Ak = T −1 Āk T
X∞
hence eAt = Ak tk /k!
k=0
X∞
= T −1 Āk T tk /k!
k=0
∞
!
X
−1 k k
= T Ā t /k! T
k=0
⇒ eAt = T −1 eĀt T
22
ż(t) = T ẋ(t)
= T Ax(t)
= T AT −1 z(t)
= Āz(t)
z(t) = eĀt z(0)
x(t) = T −1 eĀt T x(0)
Aw 1 = w 1 λ1
Aw 2 = w 2 λ2
..
.
Aw n = w n λn .
λ1 0 ... 0
0 λ2 ...
can be written as: A [w 1 , w 2 , ..., wn ] = [w1 , w2 , ..., wn ] .. ..
| {z } | {z } . .
W W
0 . . . λn
| {z }
Λ
A = W ΛW −1
23
∞
X X
eΛt = Λk tk /k! = diag { λki tk /k!}
k=0
= diag {eλi t }.
3) Inverse
5) Integral
Z t ∞
Z tX
Aτ
e dτ = Ak τ k /k! dτ
0 0 k=0
∞
X
k k+1
t
= A τ /(k + 1)! 0
k=0
( ∞
)
X
−1 k+1 k+1
= A A t /(k + 1)! − 0
k=0
−1 At
= A e − A−1 if det(A) 6= 0.
If det(A) = 0 then the above formula is not valid and the integration needs to be done directly.
e.g. A = 0.
Let I1 , I2 , I3 be the moments of inertia of a rigid body rotating in free space, about its 3
principal axes, and w1 , w2 , w3 the corresponding angular velocities. Then in the absence of
externally applied torques EULER’S EQUATIONS OF MOTION are:-
I1 ẇ1 = (I2 − I3 )w2 w3
I2 ẇ2 = (I3 − I1 )w3 w1 nonlinear state space equations
I3 ẇ3 = (I1 − I2 )w1 w2
Suppose I1 = 6, I2 = 2, I3 = 5 then
ẇ1 = − 21 w2 w3
1
ẇ2 = − 2 w3 w1
4
ẇ3 = 5 w1 w2
0 − 12 w3 − 12 w2
∂f
1
δ̇w ≃ δw =
− 2 w3 0 − 12 w1
δw.
∂w
4 4
5 w2 5 w1 0
case (a)
0 0 0
˙ ∼
⇒ δw − 12 w̄1
= 0 0 δw.
4
0 5 w̄1 0
d δw2 ∼ 0 − 21 w̄1 δw2
⇒ δw1 (t) ≃ δw1 (0)& =
dt δw3 4
5 w̄1 0 δw3
p
and the state trajectories are ellipses (with the ratio of the principal axes = 8/5 ≃ 1.26.
26
case (b)
0 0 − 12 w̄2
˙ ≃
δw 0 0 0 δw
4
5 w̄2 0 0
d δw1 0 − 12 w̄2 δw1
δw2 ≃ δw2 (0)& ≃
dt δw3 4
5 w̄2 0 δw2
case (c)
0 − 12 w̄3 0
˙ ≃ − 1 w̄3
δw 2 0 δw
0
0 0 0
d δw1 1 0 1 δw1
δw3 (t) ≃ δw3 (0), = − w̄3
dt δw2 2 1 0 δw2
and
δw1 1 δw1 (0) + δw2 (0)
= e− 21 w̄3 t
δw2 1 2
1 δw1 (0) − δw2 (0)
+ e 12 w̄3 t
−1 2
27
The trajectories in the 3-dimensional state space can thus be sketched as follows on a
particular ellipsoid V (w1 , w2 , w3 ) = const.
0.6
0.4
0.2
−0.2
−0.4
−0.6
0.5
0.6
0.4
0 0.2
0
−0.2
−0.5 −0.4
−0.6
and
Z t
y(t) = CeAt x0 + Du(t) + CeA(t−τ ) Bu(τ ) dτ
| {z } 0
| {z }
initial condition response
input response
Dδ(t) + CeAt B t≥0
Let H(t) =
0 t<0
then if x0 = 0,
Z t
y(t) = H(t − τ )u(τ )dτ = H(t) ∗ u(t)
0
Consider a linear time-invariant system that is asymptotically stable. What is the response
due to sinusoidal input at each of the inputs? Let
uj (t) = Aj cos(ωo t + θj ), j = 1, 2, · · · , m
then
yi (t) → Bi cos(ωo t + φi ) as t → ∞
where
Bi ejφi = gi1 (jωo )A1 ejθ1 + gi2 (jωo )A2 ejθ2 + · · · + gim (jωo )Am ejθm
i.e. the sum of the sinusoidal responses from each input. The rate at which the steady state is
achieved depends on how quickly the impulse response tends to zero, which in turn depends on
the pole positions.
29
4.7 Stability of ẋ = Ax
x(t) → 0
→ ∞
or remains bounded ?
but since x(t) = eAt x0 the question becomes whether the elements of eAt → 0, → ±∞ or
remain bounded as t → ∞?
Consider
and
If we factor α(s) as
where λi will be the eigenvalues of A and n1 + n2 + .. + nr = n = dim (A), then the partial
fraction expansion gives
ni
r X
−1
X Ci,k
(sI − A) =
i=1 k=1
(s − λi )k
Let λi = σi + jωi then eλi t = eσi t ejωi t = eσi t
3 cases
(i) σi < 0, tk−1 eλi t → 0, k = 1, 2, 3, ...
(ii) σi > 0, tk−1 eλi t → ∞, k = 1, 2, 3, ...
(iii) σi = 0
(a) tk−1 eλi t = 1 k=1
k−1 λ t
(b) t e i → ∞ k = 2, 3,.
Hence x(t) → 0 as t → ∞ for all x0 if and only if all λi satisfy Re(λi ) < 0. (i.e. case i)).
Also x(t) remains bounded as t → ∞ for all x0 if and only if Re(λi ) ≤ 0 and in partial fraction
expansion of (sI − A)−1 there are no terms of the form Ci,k /(s − jωi )k with k ≥ 2. (i.e. case (i)
or (iii)(a).).
31