Autumn 2008
EEE8013
Revision lecture 1
Ordinary Differential Equations
Autumn 2008
Model:
Ordinary Differential Equations (ODE):
Modeling
f(t)
x(t)
friction
ma
F 

Dynamics:
Properties of the system, we have to solve/study the ODE.
2
2
dt
x
d
m
dt
dx
B
f 


ma
f
f friction 


ma
Bu
f 


Autumn 2008
First order ODEs:
First order systems: Study approaches
)
,
( t
x
f
dt
dx

Analytic:
Explicit formula for x(t) (a solution – separate variables, integrating factor)
which satisfies )
,
( t
x
f
dt
dx

a
dt
dx
 INFINITE curves (for all Initial Conditions (ICs)).
  C
at
t
x 



 
 adt
dx
Autumn 2008
First order linear equations
First order linear equations - (linear in x and x’)
General form:







Autonomous
c
bx
ax
autonomous
Non
t
c
x
t
b
x
t
a
,
'
),
(
)
(
'
)
(
u
kx
x 

'
Numerical Solution: k=5, u=0.5
u
u Scope
1
s
Integrator
k
Gain
x
x
Dx
u
0 1 2 3 4
0
0.02
0.04
0.06
0.08
0.1
Autumn 2008
Analytic solution: Step input
kt
const
k
kdt
e
e



    u
e
x
e
u
e
kx
x
e kt
kt
kt
kt



 '
'
  
 
 udt
e
dt
x
e kt
kt
'
c
e
udt
e
e
x
c
udt
e
x
e kt
kt
kt
kt
kt 






 

  




t
kt
kt
kt
udt
e
e
x
e
x
0
1
1
0
Autumn 2008
Response to a sinusoidal input
 
t
k
ky
y 
cos
' 1
1 
  
t
k
ky
y 
sin
' 2
2 

   
t
k
t
kj
ky
y
kjy
jy 
 cos
sin
'
' 1
1
2
2 



        
 
t
j
t
k
jy
y
k
jy
y 
 sin
cos
'
' 2
1
2
1 




t
j
ke
y
k
y 

 ~
'
~

kt
e    
t
j
k
kt
ke
e
y 


'
~  
t
j
k
kt
e
t
j
k
k
e
y 




~
 












k
t
j
e
k
y



1
tan
2
2
1
1
~
   
 

















k
t
j
e
k
y



1
tan
2
2
1
1
Re
~
Re
 
t
kj
kjy
jy 
sin
' 2
2 





 t
j
e
t
j
k
k
y 

~
 
 
k
t
k



1
2
2
tan
cos
1
1 


Autumn 2008
Response to a sinusoidal input
Sine Wave
Scope3
Scope2
Scope1
Scope
Product1
Product
eu
Math
Function1
eu
Math
Function
1
s
Integrator1
1
s
Integrator
0.1
Gain3
k
Gain2
-k
Gain1
k
Gain
Clock
total
total
steady state
Transient
0 2 4 6 8 10
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25
Transient
Steady
state Overall
Autumn 2008
Second order ODEs
Second order ODEs: )
,
,
'
(
2
2
t
x
x
f
dt
x
d

u
Bx
Ax
x 

 '
'
' u=0 => Homogeneous ODE
0
'
'
' 

 Bx
Ax
x
rt
e
x  rt
re
x 
' rt
e
r
x 2
'
' 







 0
0
'
'
' 2 rt
rt
rt
Be
Are
e
r
Bx
Ax
x 0
2


 B
Ar
r
2
1
2
,
2
4
x
x
B
A
A
r 



 2
2
1
1 x
C
x
C
x 

rt
e
x 
a
dt
x
d

2
2



 1
C
at
dt
dx
2
1
2
5
.
0 C
t
C
at
x 

 So I am expecting 2 arbitrary constants
Let’s try a
Autumn 2008
Overdamped system
B
A 4
2

2
4
2
B
A
A
r




Roots are real and unequal
t
r
e
x 1
1  t
r
e
x 2
2  t
r
t
r
e
C
e
C
x
C
x
C
x 2
1
2
1
2
2
1
1 



0
3
'
4
'
' 

 x
x
x
t
t
e
C
e
C
x 


 2
3
1
  1
0 
x   0
0
' 
x
  1
0 2
1 

 C
C
x
t
t
e
C
e
C
x 



 2
3
1
3
'
  0
3
0
' 2
1 


 C
C
x
t
t
e
e
x 




2
3
5
.
0 3
   0
1
3
0
3
4
2







 r
r
r
r
rt
e
x 
0 1 2 3 4 5 6
-0.5
0
0.5
1
1.5
Overall solution
x
2
x
1
Autumn 2008
Critically damped system
B
A 4
2

2
4
2
B
A
A
r



 Roots are real and equal
rt
e
x 
1
rt
te
x 
2
rt
rt
te
C
e
C
x
C
x
C
x
2
1
2
2
1
1




A=2, B=1, x(0)=1, x’(0)=0 =>
c1=c2=1
0 2 4 6 8 10
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
e-t
te-t
overall
Autumn 2008
Underdamped system
B
A 4
2

2
4
2
B
A
A
r



 Roots are complex Underdamped system
r=a+bj
0

A
jbt
at
e
e

Theorem: If x is a complex solution to a real ODE then Re(x) and Im(x) are
the real solutions of the ODE:
)
sin(
),
cos( 2
1 bt
e
x
bt
e
x at
at


)
sin(
)
cos( 2
1
2
2
1
1 bt
e
c
bt
e
c
x
c
x
c
x at
at























 
 1
2
1
1
2
1
1
tan
&
,
tan
cos
c
c
c
c
c
G 
  bjt
at
t
bj
a
rt
e
e
e
x 



  
)
sin(
)
cos( bt
j
bt
eat


   




 bt
G
e
bt
c
bt
c
e at
at
cos
)
sin(
)
cos( 2
1
Autumn 2008
Underdamped system, example
A=1, B=1, x(0)=1, x’(0)=0 => c1=1, c2=1/sqrt(3)
0 2 4 6 8 10
-1.5
-1
-0.5
0
0.5
1
1.5
C1
cos(bt)
C2
sin(bt)
C1
cos(bt)+C2
sin(bt)
0 2 4 6 8 10
-1.5
-1
-0.5
0
0.5
1
1.5
C1
cos(bt)+C2
sin(bt)
eat
Overall
 
)
sin(
)
cos( 2
1 bt
c
bt
c
eat
  


bt
G
eat
cos
Autumn 2008
Undamped
0

A Undamped system 0
0
'
' 

 Bx
x
 




 bt
G
bt
c
bt
c
x cos
)
sin(
)
cos( 2
1 A=0, B=1, x(0)=1, x’(0)=0 =>c1=1, c2=0:
0 2 4 6 8 10
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Overall
B
r
Be
e
r rt
rt






 2
2
0
0
Autumn 2008
Stability
In all previous cases if the real part is positive then the solution will diverge to
infinity and the ODE (and hence the system) is called unstable.
jb
a
Critical or
overdamped
underdamped
jb
a
Stable
Unstable
Autumn 2008
Natural frequency, damping frequency, damping factor
2
,
2 n
n B
A 
 
 0
'
2
'
' 2


 x
x
x n
n 

 is the damping factor and n
 is the natural frequency of the system.
 
2
4
2
2
2
4 2
2
2
n
n
n
B
A
A
r


 







2
2
2
n
n
n
r 


 



1
1
0
2
2
2
2












n
n
2
2
2
2
,
1 n
n
n
r 


 



=> Overdamped system implies that 1


t
r
t
r
e
C
e
C
x 2
1
2
1 

Case 1:
Autumn 2008
Natural frequency, damping frequency, damping factor
1
1
2
2
2
2




 



 n
n => Critically damped system implies that 1


n
r 

 t
t n
n te
C
e
C
x 
 


 2
1
1
1
0
2
2
2
2












n
n => Underdamped systems implies 1


2
2
2
2
2
,
1 1 





 






 n
n
n
n
n j
j
r
d
n j
n
d









 2
1
 




 
t
G
e
x d
t
n cos d
 called damped frequency or pseudo-frequency
n
j
r 

  

 
 t
G
x n
cos
0


No damping the frequency of the
oscillations = natural frequency
Case 2:
Case 3:
Case 4:
Autumn 2008
Summary
Autumn 2008
Stability revised
0


If then cases 1-3 are the same but with 0

k
d
j
n


Critical or
overdamped
underdamped
Stable
Unstable
d
j
n


Autumn 2008
NonHomogeneous (NH) differential equations
u
Bx
Ax
x 

 '
'
'
 u=0 => Homogeneous => x1 & x2.
 Assume a particular solution of the nonhomogeneous ODE: xp
If u(t)=R=cosnt =>
B
R
xP 
Then all the solutions of the NHODE are 2
2
1
1 x
c
x
c
x
x P 


So we have all the previous cases for under/over/un/critically damped systems
plus a constant R/B.
If complementary solution is stable then the particular solution
is called steady state.
Autumn 2008
Example
2
2
'
'
' 



 P
x
x
x
x  
)
sin(
)
cos(
2
2 2
1
2
2
1
1 bt
c
bt
c
e
x
c
x
c
x at






x(0)=1, x’(0)=0 => c1=-1, c2=-1/sqrt(3)
0 2 4 6 8 10
-1
-0.5
0
0.5
1
1.5
2
2.5
Overall
Homogeneous solution
Particular solution
Autumn 2008
State Space
   
 
1
,...
'
'
,
'
, 
 n
n
x
x
x
x
f
x
Very difficult to be studied => so we use computers
Computers are better with 1st order ODE
1 nth => n 1st
Powerful tools from the linear algebra
kx
x
B
F
x
m 













x
x
x
x
2
1






































m
F
x
x
m
B
m
k
x
x 0
1
0
2
1
2
1


 x
x1 2
x




 x
x2  
1
2
1
kx
Bx
F
m



F
m
x
x
m
B
m
k
x
x






































1
0
1
0
2
1
2
1
U
B
AX
X 



Use sensors: Output = x =>
  DU
y
x
x
x
y 









 CX
2
1
0
1
Autumn 2008
State Space
DU
y
U





CX
B
AX
X Input Output
U y
DU
y
U





CX
B
AX
X
U1 y1
DU
CX
BU
AX
X





y
U1
Uq
y2
yp
DU
CX
y
BU
AX
X





U Y


























p
q y
y
y
y
u
u
u
3
2
1
2
1
, Y
U

 
)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
t
t
t
t
t
t
t
t
t
t
U
D
X
C
Y
U
B
X
A
X





Autumn 2008
Block Diagram
 
)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
t
t
t
t
t
t
t
t
t
t
U
D
X
C
Y
U
B
X
A
X





•X is an n x 1 state vector
•U is an q x 1 input vector
•Y is an p x 1 output vector
•A is an n x n state matrix
•B is an n x q input matrix
•C is an p x n output matrix
•D is an p x m feed forward matrix (usually zero)
)
(
)
(
)
(
)
(
)
(
)
(
t
t
t
t
t
t
DU
CX
Y
BU
AX
X





B
U
dt C
DX X Y
A
Autumn 2008
State space rules
The state vector describes the system => Gives its state =>
The state of a system is a complete summary of the system at a particular
point in time.
If the current state of the system and the future input signals are known then it
is possible to define the future states and outputs of the system.
The choice of the state space variables is free as long as some rules are followed:
1. They must be linearly independent.
2. They must specify completely the dynamic behaviour of the system.
3. Finally they must not be input of the system.
Autumn 2008
State space
The system’s states can be written in a vector form as:
 T
x 0
,
,
0
,
1
1 

x   ...
0
,
,
,
0 2
2
T
x 

x  T
n
n x
,
,
0
,
0 

x
A standard orthogonal basis (since they are linear independent)
 for an n-dimensional vector space called state space.
x1
x
2
R
2
x2
x
3
R
3
x
1
Matlab definition
Autumn 2008
Solution



























2
1
2
1
5
2
2
2
x
x
x
x
 
 
   








































0
6
7
4
10
2
5
2
5
2
5
2
1
2
5
2
1
2
5
2
1
5
2
1
5
2
1
5
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
2
2
1
1
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x
x






















0
6
7 2
2
2 

 x
x
x 


0
6
7
2


 r
r
t
a Ce
x 

t
b De
x 6


Autumn 2008
Solution II



























2
1
2
1
5
2
2
2
x
x
x
x t
e
a
a 







2
1
X








































2
1
2
1
2
1
2
1
2
1
5
2
2
2
5
2
2
2
a
a
a
a
a
a
e
a
a
e
a
a t
t


 

X
t
e
a
a 
 







2
1
X
How can we solve that ???
Assume is a parameter => A homogeneous linear system
 
  













0
5
2
0
2
2
2
1
2
1
a
a
a
a


0
6
7
2



 

0
5
2
2
2







(This last equation is the characteristic equation of the system, why???).
Autumn 2008
Solution III











6
1
0
6
7
2
1
2




1
1 













0
4
2
0
2
2
1
2
1
a
a
a
a
I assume that a2=1 so a1=2 :
1














1
2
2
1
a
a t
e
t 







1
2
)
(
1
X
6
1 













0
2
0
2
4
2
1
2
1
a
a
a
a
I assume that a1=2 so a2=-2 t
e
t 6
2
6
1
)
( 








X
  t
t
e
C
e
C
t 6
2
1
2
1
1
2 
















X
Matlab example
Autumn 2008
General Solution
AX
X 

t
e
c 
e
X    0



 e
A
I
e
A
e 
 0

 A
I

The roots of this equation are called eigenvalues
i
e
i

n



 ...
2
2
1 


  t
n
n
t
t n
e
C
e
C
e
C
t 


e
e
e
X 


 ...
2
1
2
2
1
1
negative eigenvalues => stable
positive eigenvalues => unstable
repeated eigenvalues => eigenvectors are
not linearly independent.
Complex eigenvalues => conjugate and the eigenvector will be complex
=>solution will consists of sines, cosines and exponential terms
Autumn 2008
Properties of general solution
  t
n
n
t
t n
e
C
e
C
e
C
t 


e
e
e
X 


 ...
2
1
2
2
1
1
If we start exactly on one eigenvector then the solution will remain on
that forever.
Hence if I have some stable and some unstable eigenvalues it is still
possible (in theory) for the solution to converge to zero if we start
exactly on a stable eigenvector.
t
i
i
i
e
C 
e
t
i
e
Determines the nature of the time response (stable, fast..)
i
e Determines the extend in which each state contributes to
t
i
e
i
C Determines the extend in which the IC excites the
t
i
e
To find the eigenvalues and eigenvectors use the command eig()
Autumn 2008
Example



























2
1
2
1
5
2
2
2
x
x
x
x
-1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
1.5
x1
x
2
state space
0,0
e1
e2
Autumn 2008
Example
Autumn 2008
Example
Autumn 2008
State Transition Matrix
Until now the use of vector ODEs was not very helpful.
We still have special cases 0

 A
I

ax
x 

   
0
x
e
t
x at
 AX
X 

 
0
X
X At
e

t
eA
=> No special cases are needed then
    ...
!
3
1
!
2
1 3
2





 t
t
t
e t
A
A
A
A
Use the command expm (not exp)!



























2
1
2
1
5
2
2
2
x
x
x
x









5
2
2
2
A
X(0)=[1 2]
X(5) =?
4 ways to calculate it!!!
Autumn 2008
 
0
X
X At
e
   t
n
n
t
t n
e
C
e
C
e
C
t 


e
e
e
X 


 ...
2
1
2
2
1
1
i
i
i λ
e
Ae     











n
n
n





1
2
1
2
1 e
e
e
e
e
e
A
TΛ
AT  1


 TΛ
A
   
   
  ...
!
3
1
!
2
1 3
1
2
1
1







 


t
t
t TΛ
TΛ
TΛ
    





 ...
!
3
1
!
2
1 3
2
t
t
t
e t
A
A
A
A
   1
2
1
1 





 TΛ
TΛ
TΛ
  
 2
1
TΛ
      








 



...
!
3
1
!
2
1 3
1
3
2
1
2
1
1
t
t
t
e t
TΛ
TΛ
TΛ
TI
A
    1
1
3
2
...
!
3
1
!
2
1 















 t
e
t
t
t Λ
T
Λ
Λ
Λ
T 










t
t
t
n
e
e
e



1
Λ
State Transition Matrix
Autumn 2008
   


 
0
0 1
X
T
X
X Λ
A t
t
e
e
     
0
1
2
1
2
1
1
X
e
e
e
e
e
e
X 










 n
t
t
n
n
e
e





   
0
2
1
2
1
1
X
w
w
w
e
e
e
X























n
t
t
n
n
e
e





   



n
i
i
t
i b
e
t i
1
0

e
X
      ...
0
0 2
2
2
1
1
1
2
1 

 x
e
x
e
t t
t
w
e
w
e
X 

 
 



n
i
i
i
t
i x
e i
1
0
w
e 
 



































)
0
(
)
0
(
)
0
(
2
1
2
1
2
1
1
n
n
t
t
n
x
x
x
e
e
n




w
w
w
e
e
e
X


  t
n
n
t
t n
e
C
e
C
e
C
t 


e
e
e
X 


 ...
2
1
2
2
1
1
State Transition Matrix
Autumn 2008
Solution
bu
ax
x
bu
ax
x 






at
e
 
 
t
x
e
dt
d
ax
x
e at
at 










 
  
 



t
a
t
a
bud
e
d
x
e
dt
d
0
0


 

bu
e at


    




t
a
at
bud
e
x
t
x
e
0
0 

    

 

t
a
at
at
bud
e
e
x
e
t
x
0
0 

     




t
t
a
at
bud
e
x
e
t
x
0
0 

     




t
t
t
d
e
e
t
0
0 

BU
X
X A
A
Autumn 2008
SS => TF???
LT
t
t
t 



)
(
)
(
)
( BU
AX
X 


 )
(
)
(
)
0
(
)
( s
s
s
s BU
AX
X
X
    )
0
(
)
(
)
( 1
1
X
A
I
BU
A
I
X 




 s
s
s
s
  


 )
0
(
)
(
)
( X
BU
X
A
I s
s
s
)
(
)
(
)
( s
s
s DU
CX
Y 
    
  )
(
)
0
(
)
(
)
( 1
1
s
s
s
s
s DU
X
A
I
BU
A
I
C
Y 




 

 
    )
0
(
)
(
)
( 1
1
X
A
C
U
D
B
A
C
Y 





 sI
s
sI
s
  D
B
A
I
C 
 1
s TF
  )
0
(
1
X
A
I
C 

s Response to ICs
Autumn 2008
SS => TF???
   
ILT
s
s
s
s 



 

)
0
(
)
(
)
( 1
1
X
A
I
BU
A
I
X
 
   
  )
0
(
)
(
)
( 1
1
1
1
X
A
I
BU
A
I
X 






 s
L
s
s
L
t
 
  )
0
(
)
( 1
1
X
A
I
X 


 s
L
t
)
0
(
)
( X
X At
e
t 
 
 
1
1 


 A
I
A
s
L
e t
    D
B
A
I
C
G 

 1
s
s A

sI CE of the TF
   
A
I
BC
D
A
I
G




s
s
s
The TF is a matrix













)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
)
(
2
1
2
22
21
1
12
11
s
G
s
G
s
G
s
G
s
G
s
G
s
G
s
G
s
G
s
pq
p
p
q
q







G ...
,
,
, 22
2
2
21
1
2
12
2
1
11
1
1
G
U
Y
G
U
Y
G
U
Y
G
U
Y



Autumn 2008
Example: Find the TF of 2
1
0
5
.
0
1
1
0
2
1
2
1




























x
x
x
x


  






2
1
0
1
x
x
y
SS => TF???
Autumn 2008
Basic properties of state space
State space transformations
State space representations are not unique
Same input/output properties, => same eigenvalues
)
(
)
(
)
( t
t
t BU
AX
X 


)
(
)
(
)
( t
t
t DU
CX
Y 

TZ
X 
T is an invertible matrix
Z is the new state vector
)
(
)
( 1
1
t
t BU
T
AX
T
Z 





 
X
T
Z 1





X
T
Z 1
)
(
~
~
)
(
1
1
t
t U
B
Z
A
Z
BU
T
ATZ
T
Z 








AT
T
A 1
~ 
 B
T
B 1
~ 
 )
(
~
~
)
( t
t U
D
X
C
Y 


)
(
)
( t
t DU
CTX
Y 

CT
C 
~
D
D 
~
Autumn 2008
Do these two systems have the TF?     D
B
A
I
C
G 

 1
1 s
s     D
B
A
I
C
G
~
~
~
~ 1
2 



s
s
       


 


D
B
TT
A
I
TT
C
G
~
1
1
1
1 s
s
    D
B
A
I
C
G 

 1
1 s
s
   
  


 


D
B
T
T
A
I
T
CT
G
~
1
1
1
1 s
s
   
  





D
B
TAT
I
C
G
~
~
~ 1
1
1 s
s
     
s
s
s 2
1
1
~
~
~
~
G
D
B
A
I
C
G 




Matlab example
Basic properties of state space
Autumn 2008
Observability - Controllability










x
y
u
x
x
3
2
2
  






















X
X
X
0
3
1
2
1
0
0
2
y
u
Notice the structure of A and C
 
2
6
2
2
3
3
2
2 1












 

s
s
x
y
u
x
x
 
























X
X
X
0
3
1
2
1
0
0
2
y
u
  















1
2
1
0
0
2
0
3
1
s
s
 
  
 
 
  
 










































1
2
2
2
0
3
1
2
2
1
2
0
3
1
2
1
2
2
0
0
1
0
3
s
s
s
s
s
s
s
s
s
s
2
6


s
Observability - Controllability
Autumn 2008
There is a pole zero cancellation
0


D
C
B
A
I
s
pzmap(ss_model) Matlab verification
The cancellation is due to C=[3 0].
We can influence x2 through U
but we cannot observe how it behaves
and hence there is no way to feedback
that signal to a controller!!!




 0
0
0
1
1
1
0
2
0
2
s
s
  0
0
1
1
0
2
0
1
1
0
0
0
0
1
1
2 





s
s
s
1
0
1 




 s
s
  






















X
X
X
0
3
1
2
1
0
0
2
y
u
  










































2
1
2
1
2
1
0
3
1
2
1
0
0
2
x
x
y
u
x
x
x
x
1
2
1
3
2
2
1
x
y
u
x
x
u
x
x









Observability - Controllability
Autumn 2008
  






















X
X
X
0
3
1
2
1
0
0
2
y
u  
  

















2
1
0
2
2
0
0
1
2
3
s
s
s
s
 
























X
X
X
2
3
0
2
1
0
0
2
y
u
     
2
6
0
2
1
2
2
3















 s
s
s
In this case we can see how both states behave
but we can not change U in any way
so that we can influence x2 due to the form of B.
Unobservable & uncontrollable Minimal realisation.
Difficult task if the system is nonlinear!!!!
Observability - Controllability
Autumn 2008

















1
2
n
O
CA
CA
CA
C
M

 
B
A
B
A
AB
B
M 1
2 
 n
C 
Check the rank
>> rank(obsv(A,C))
>> rank(ctrb(A,B))
Observability - Controllability

Design of Linear Control Systems(0).ppt

  • 1.
    Autumn 2008 EEE8013 Revision lecture1 Ordinary Differential Equations
  • 2.
    Autumn 2008 Model: Ordinary DifferentialEquations (ODE): Modeling f(t) x(t) friction ma F   Dynamics: Properties of the system, we have to solve/study the ODE. 2 2 dt x d m dt dx B f    ma f f friction    ma Bu f   
  • 3.
    Autumn 2008 First orderODEs: First order systems: Study approaches ) , ( t x f dt dx  Analytic: Explicit formula for x(t) (a solution – separate variables, integrating factor) which satisfies ) , ( t x f dt dx  a dt dx  INFINITE curves (for all Initial Conditions (ICs)).   C at t x        adt dx
  • 4.
    Autumn 2008 First orderlinear equations First order linear equations - (linear in x and x’) General form:        Autonomous c bx ax autonomous Non t c x t b x t a , ' ), ( ) ( ' ) ( u kx x   ' Numerical Solution: k=5, u=0.5 u u Scope 1 s Integrator k Gain x x Dx u 0 1 2 3 4 0 0.02 0.04 0.06 0.08 0.1
  • 5.
    Autumn 2008 Analytic solution:Step input kt const k kdt e e        u e x e u e kx x e kt kt kt kt     ' '       udt e dt x e kt kt ' c e udt e e x c udt e x e kt kt kt kt kt                  t kt kt kt udt e e x e x 0 1 1 0
  • 6.
    Autumn 2008 Response toa sinusoidal input   t k ky y  cos ' 1 1     t k ky y  sin ' 2 2       t k t kj ky y kjy jy   cos sin ' ' 1 1 2 2                t j t k jy y k jy y   sin cos ' ' 2 1 2 1      t j ke y k y    ~ ' ~  kt e     t j k kt ke e y    ' ~   t j k kt e t j k k e y      ~               k t j e k y    1 tan 2 2 1 1 ~                        k t j e k y    1 tan 2 2 1 1 Re ~ Re   t kj kjy jy  sin ' 2 2        t j e t j k k y   ~     k t k    1 2 2 tan cos 1 1   
  • 7.
    Autumn 2008 Response toa sinusoidal input Sine Wave Scope3 Scope2 Scope1 Scope Product1 Product eu Math Function1 eu Math Function 1 s Integrator1 1 s Integrator 0.1 Gain3 k Gain2 -k Gain1 k Gain Clock total total steady state Transient 0 2 4 6 8 10 -0.2 -0.15 -0.1 -0.05 0 0.05 0.1 0.15 0.2 0.25 Transient Steady state Overall
  • 8.
    Autumn 2008 Second orderODEs Second order ODEs: ) , , ' ( 2 2 t x x f dt x d  u Bx Ax x    ' ' ' u=0 => Homogeneous ODE 0 ' ' '    Bx Ax x rt e x  rt re x  ' rt e r x 2 ' '          0 0 ' ' ' 2 rt rt rt Be Are e r Bx Ax x 0 2    B Ar r 2 1 2 , 2 4 x x B A A r      2 2 1 1 x C x C x   rt e x  a dt x d  2 2     1 C at dt dx 2 1 2 5 . 0 C t C at x    So I am expecting 2 arbitrary constants Let’s try a
  • 9.
    Autumn 2008 Overdamped system B A4 2  2 4 2 B A A r     Roots are real and unequal t r e x 1 1  t r e x 2 2  t r t r e C e C x C x C x 2 1 2 1 2 2 1 1     0 3 ' 4 ' '    x x x t t e C e C x     2 3 1   1 0  x   0 0 '  x   1 0 2 1    C C x t t e C e C x      2 3 1 3 '   0 3 0 ' 2 1     C C x t t e e x      2 3 5 . 0 3    0 1 3 0 3 4 2         r r r r rt e x  0 1 2 3 4 5 6 -0.5 0 0.5 1 1.5 Overall solution x 2 x 1
  • 10.
    Autumn 2008 Critically dampedsystem B A 4 2  2 4 2 B A A r     Roots are real and equal rt e x  1 rt te x  2 rt rt te C e C x C x C x 2 1 2 2 1 1     A=2, B=1, x(0)=1, x’(0)=0 => c1=c2=1 0 2 4 6 8 10 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 e-t te-t overall
  • 11.
    Autumn 2008 Underdamped system B A4 2  2 4 2 B A A r     Roots are complex Underdamped system r=a+bj 0  A jbt at e e  Theorem: If x is a complex solution to a real ODE then Re(x) and Im(x) are the real solutions of the ODE: ) sin( ), cos( 2 1 bt e x bt e x at at   ) sin( ) cos( 2 1 2 2 1 1 bt e c bt e c x c x c x at at                           1 2 1 1 2 1 1 tan & , tan cos c c c c c G    bjt at t bj a rt e e e x        ) sin( ) cos( bt j bt eat            bt G e bt c bt c e at at cos ) sin( ) cos( 2 1
  • 12.
    Autumn 2008 Underdamped system,example A=1, B=1, x(0)=1, x’(0)=0 => c1=1, c2=1/sqrt(3) 0 2 4 6 8 10 -1.5 -1 -0.5 0 0.5 1 1.5 C1 cos(bt) C2 sin(bt) C1 cos(bt)+C2 sin(bt) 0 2 4 6 8 10 -1.5 -1 -0.5 0 0.5 1 1.5 C1 cos(bt)+C2 sin(bt) eat Overall   ) sin( ) cos( 2 1 bt c bt c eat      bt G eat cos
  • 13.
    Autumn 2008 Undamped 0  A Undampedsystem 0 0 ' '    Bx x        bt G bt c bt c x cos ) sin( ) cos( 2 1 A=0, B=1, x(0)=1, x’(0)=0 =>c1=1, c2=0: 0 2 4 6 8 10 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Overall B r Be e r rt rt        2 2 0 0
  • 14.
    Autumn 2008 Stability In allprevious cases if the real part is positive then the solution will diverge to infinity and the ODE (and hence the system) is called unstable. jb a Critical or overdamped underdamped jb a Stable Unstable
  • 15.
    Autumn 2008 Natural frequency,damping frequency, damping factor 2 , 2 n n B A     0 ' 2 ' ' 2    x x x n n    is the damping factor and n  is the natural frequency of the system.   2 4 2 2 2 4 2 2 2 n n n B A A r            2 2 2 n n n r         1 1 0 2 2 2 2             n n 2 2 2 2 , 1 n n n r         => Overdamped system implies that 1   t r t r e C e C x 2 1 2 1   Case 1:
  • 16.
    Autumn 2008 Natural frequency,damping frequency, damping factor 1 1 2 2 2 2           n n => Critically damped system implies that 1   n r    t t n n te C e C x       2 1 1 1 0 2 2 2 2             n n => Underdamped systems implies 1   2 2 2 2 2 , 1 1                n n n n n j j r d n j n d           2 1         t G e x d t n cos d  called damped frequency or pseudo-frequency n j r          t G x n cos 0   No damping the frequency of the oscillations = natural frequency Case 2: Case 3: Case 4:
  • 17.
  • 18.
    Autumn 2008 Stability revised 0   Ifthen cases 1-3 are the same but with 0  k d j n   Critical or overdamped underdamped Stable Unstable d j n  
  • 19.
    Autumn 2008 NonHomogeneous (NH)differential equations u Bx Ax x    ' ' '  u=0 => Homogeneous => x1 & x2.  Assume a particular solution of the nonhomogeneous ODE: xp If u(t)=R=cosnt => B R xP  Then all the solutions of the NHODE are 2 2 1 1 x c x c x x P    So we have all the previous cases for under/over/un/critically damped systems plus a constant R/B. If complementary solution is stable then the particular solution is called steady state.
  • 20.
    Autumn 2008 Example 2 2 ' ' '     P x x x x   ) sin( ) cos( 2 2 2 1 2 2 1 1 bt c bt c e x c x c x at       x(0)=1, x’(0)=0 => c1=-1, c2=-1/sqrt(3) 0 2 4 6 8 10 -1 -0.5 0 0.5 1 1.5 2 2.5 Overall Homogeneous solution Particular solution
  • 21.
    Autumn 2008 State Space      1 ,... ' ' , ' ,   n n x x x x f x Very difficult to be studied => so we use computers Computers are better with 1st order ODE 1 nth => n 1st Powerful tools from the linear algebra kx x B F x m               x x x x 2 1                                       m F x x m B m k x x 0 1 0 2 1 2 1    x x1 2 x      x x2   1 2 1 kx Bx F m    F m x x m B m k x x                                       1 0 1 0 2 1 2 1 U B AX X     Use sensors: Output = x =>   DU y x x x y            CX 2 1 0 1
  • 22.
    Autumn 2008 State Space DU y U      CX B AX XInput Output U y DU y U      CX B AX X U1 y1 DU CX BU AX X      y U1 Uq y2 yp DU CX y BU AX X      U Y                           p q y y y y u u u 3 2 1 2 1 , Y U    ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( t t t t t t t t t t U D X C Y U B X A X     
  • 23.
    Autumn 2008 Block Diagram  ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( t t t t t t t t t t U D X C Y U B X A X      •X is an n x 1 state vector •U is an q x 1 input vector •Y is an p x 1 output vector •A is an n x n state matrix •B is an n x q input matrix •C is an p x n output matrix •D is an p x m feed forward matrix (usually zero) ) ( ) ( ) ( ) ( ) ( ) ( t t t t t t DU CX Y BU AX X      B U dt C DX X Y A
  • 24.
    Autumn 2008 State spacerules The state vector describes the system => Gives its state => The state of a system is a complete summary of the system at a particular point in time. If the current state of the system and the future input signals are known then it is possible to define the future states and outputs of the system. The choice of the state space variables is free as long as some rules are followed: 1. They must be linearly independent. 2. They must specify completely the dynamic behaviour of the system. 3. Finally they must not be input of the system.
  • 25.
    Autumn 2008 State space Thesystem’s states can be written in a vector form as:  T x 0 , , 0 , 1 1   x   ... 0 , , , 0 2 2 T x   x  T n n x , , 0 , 0   x A standard orthogonal basis (since they are linear independent)  for an n-dimensional vector space called state space. x1 x 2 R 2 x2 x 3 R 3 x 1 Matlab definition
  • 26.
    Autumn 2008 Solution                            2 1 2 1 5 2 2 2 x x x x                                                0 6 7 4 10 2 5 2 5 2 5 2 1 2 5 2 1 2 5 2 1 5 2 1 5 2 1 5 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 1 2 2 1 1 x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x                       0 6 7 2 2 2    x x x    0 6 7 2    r r t a Ce x   t b De x 6  
  • 27.
    Autumn 2008 Solution II                            2 1 2 1 5 2 2 2 x x x xt e a a         2 1 X                                         2 1 2 1 2 1 2 1 2 1 5 2 2 2 5 2 2 2 a a a a a a e a a e a a t t      X t e a a           2 1 X How can we solve that ??? Assume is a parameter => A homogeneous linear system                   0 5 2 0 2 2 2 1 2 1 a a a a   0 6 7 2       0 5 2 2 2        (This last equation is the characteristic equation of the system, why???).
  • 28.
    Autumn 2008 Solution III            6 1 0 6 7 2 1 2     1 1              0 4 2 0 2 2 1 2 1 a a a a I assume that a2=1 so a1=2 : 1               1 2 2 1 a a t e t         1 2 ) ( 1 X 6 1               0 2 0 2 4 2 1 2 1 a a a a I assume that a1=2 so a2=-2 t e t 6 2 6 1 ) (          X   t t e C e C t 6 2 1 2 1 1 2                  X Matlab example
  • 29.
    Autumn 2008 General Solution AX X  t e c  e X    0     e A I e A e   0   A I  The roots of this equation are called eigenvalues i e i  n     ... 2 2 1      t n n t t n e C e C e C t    e e e X     ... 2 1 2 2 1 1 negative eigenvalues => stable positive eigenvalues => unstable repeated eigenvalues => eigenvectors are not linearly independent. Complex eigenvalues => conjugate and the eigenvector will be complex =>solution will consists of sines, cosines and exponential terms
  • 30.
    Autumn 2008 Properties ofgeneral solution   t n n t t n e C e C e C t    e e e X     ... 2 1 2 2 1 1 If we start exactly on one eigenvector then the solution will remain on that forever. Hence if I have some stable and some unstable eigenvalues it is still possible (in theory) for the solution to converge to zero if we start exactly on a stable eigenvector. t i i i e C  e t i e Determines the nature of the time response (stable, fast..) i e Determines the extend in which each state contributes to t i e i C Determines the extend in which the IC excites the t i e To find the eigenvalues and eigenvectors use the command eig()
  • 31.
  • 32.
  • 33.
  • 34.
    Autumn 2008 State TransitionMatrix Until now the use of vector ODEs was not very helpful. We still have special cases 0   A I  ax x       0 x e t x at  AX X     0 X X At e  t eA => No special cases are needed then     ... ! 3 1 ! 2 1 3 2       t t t e t A A A A Use the command expm (not exp)!                            2 1 2 1 5 2 2 2 x x x x          5 2 2 2 A X(0)=[1 2] X(5) =? 4 ways to calculate it!!!
  • 35.
    Autumn 2008   0 X XAt e    t n n t t n e C e C e C t    e e e X     ... 2 1 2 2 1 1 i i i λ e Ae                 n n n      1 2 1 2 1 e e e e e e A TΛ AT  1    TΛ A           ... ! 3 1 ! 2 1 3 1 2 1 1            t t t TΛ TΛ TΛ            ... ! 3 1 ! 2 1 3 2 t t t e t A A A A    1 2 1 1        TΛ TΛ TΛ     2 1 TΛ                     ... ! 3 1 ! 2 1 3 1 3 2 1 2 1 1 t t t e t TΛ TΛ TΛ TI A     1 1 3 2 ... ! 3 1 ! 2 1                  t e t t t Λ T Λ Λ Λ T            t t t n e e e    1 Λ State Transition Matrix
  • 36.
    Autumn 2008        0 0 1 X T X X Λ A t t e e       0 1 2 1 2 1 1 X e e e e e e X             n t t n n e e          0 2 1 2 1 1 X w w w e e e X                        n t t n n e e             n i i t i b e t i 1 0  e X       ... 0 0 2 2 2 1 1 1 2 1    x e x e t t t w e w e X          n i i i t i x e i 1 0 w e                                       ) 0 ( ) 0 ( ) 0 ( 2 1 2 1 2 1 1 n n t t n x x x e e n     w w w e e e X     t n n t t n e C e C e C t    e e e X     ... 2 1 2 2 1 1 State Transition Matrix
  • 37.
    Autumn 2008 Solution bu ax x bu ax x        at e    t x e dt d ax x e at at                      t a t a bud e d x e dt d 0 0      bu e at            t a at bud e x t x e 0 0            t a at at bud e e x e t x 0 0             t t a at bud e x e t x 0 0             t t t d e e t 0 0   BU X X A A
  • 38.
    Autumn 2008 SS =>TF??? LT t t t     ) ( ) ( ) ( BU AX X     ) ( ) ( ) 0 ( ) ( s s s s BU AX X X     ) 0 ( ) ( ) ( 1 1 X A I BU A I X       s s s s       ) 0 ( ) ( ) ( X BU X A I s s s ) ( ) ( ) ( s s s DU CX Y         ) ( ) 0 ( ) ( ) ( 1 1 s s s s s DU X A I BU A I C Y               ) 0 ( ) ( ) ( 1 1 X A C U D B A C Y        sI s sI s   D B A I C   1 s TF   ) 0 ( 1 X A I C   s Response to ICs
  • 39.
    Autumn 2008 SS =>TF???     ILT s s s s        ) 0 ( ) ( ) ( 1 1 X A I BU A I X         ) 0 ( ) ( ) ( 1 1 1 1 X A I BU A I X         s L s s L t     ) 0 ( ) ( 1 1 X A I X     s L t ) 0 ( ) ( X X At e t      1 1     A I A s L e t     D B A I C G    1 s s A  sI CE of the TF     A I BC D A I G     s s s The TF is a matrix              ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( ) ( 2 1 2 22 21 1 12 11 s G s G s G s G s G s G s G s G s G s pq p p q q        G ... , , , 22 2 2 21 1 2 12 2 1 11 1 1 G U Y G U Y G U Y G U Y   
  • 40.
    Autumn 2008 Example: Findthe TF of 2 1 0 5 . 0 1 1 0 2 1 2 1                             x x x x            2 1 0 1 x x y SS => TF???
  • 41.
    Autumn 2008 Basic propertiesof state space State space transformations State space representations are not unique Same input/output properties, => same eigenvalues ) ( ) ( ) ( t t t BU AX X    ) ( ) ( ) ( t t t DU CX Y   TZ X  T is an invertible matrix Z is the new state vector ) ( ) ( 1 1 t t BU T AX T Z         X T Z 1      X T Z 1 ) ( ~ ~ ) ( 1 1 t t U B Z A Z BU T ATZ T Z          AT T A 1 ~   B T B 1 ~   ) ( ~ ~ ) ( t t U D X C Y    ) ( ) ( t t DU CTX Y   CT C  ~ D D  ~
  • 42.
    Autumn 2008 Do thesetwo systems have the TF?     D B A I C G    1 1 s s     D B A I C G ~ ~ ~ ~ 1 2     s s               D B TT A I TT C G ~ 1 1 1 1 s s     D B A I C G    1 1 s s              D B T T A I T CT G ~ 1 1 1 1 s s             D B TAT I C G ~ ~ ~ 1 1 1 s s       s s s 2 1 1 ~ ~ ~ ~ G D B A I C G      Matlab example Basic properties of state space
  • 43.
    Autumn 2008 Observability -Controllability           x y u x x 3 2 2                          X X X 0 3 1 2 1 0 0 2 y u Notice the structure of A and C   2 6 2 2 3 3 2 2 1                s s x y u x x                           X X X 0 3 1 2 1 0 0 2 y u                   1 2 1 0 0 2 0 3 1 s s                                                         1 2 2 2 0 3 1 2 2 1 2 0 3 1 2 1 2 2 0 0 1 0 3 s s s s s s s s s s 2 6   s Observability - Controllability
  • 44.
    Autumn 2008 There isa pole zero cancellation 0   D C B A I s pzmap(ss_model) Matlab verification The cancellation is due to C=[3 0]. We can influence x2 through U but we cannot observe how it behaves and hence there is no way to feedback that signal to a controller!!!      0 0 0 1 1 1 0 2 0 2 s s   0 0 1 1 0 2 0 1 1 0 0 0 0 1 1 2       s s s 1 0 1       s s                          X X X 0 3 1 2 1 0 0 2 y u                                              2 1 2 1 2 1 0 3 1 2 1 0 0 2 x x y u x x x x 1 2 1 3 2 2 1 x y u x x u x x          Observability - Controllability
  • 45.
    Autumn 2008                         X X X 0 3 1 2 1 0 0 2 y u                       2 1 0 2 2 0 0 1 2 3 s s s s                           X X X 2 3 0 2 1 0 0 2 y u       2 6 0 2 1 2 2 3                 s s s In this case we can see how both states behave but we can not change U in any way so that we can influence x2 due to the form of B. Unobservable & uncontrollable Minimal realisation. Difficult task if the system is nonlinear!!!! Observability - Controllability
  • 46.
    Autumn 2008                  1 2 n O CA CA CA C M    B A B A AB B M1 2   n C  Check the rank >> rank(obsv(A,C)) >> rank(ctrb(A,B)) Observability - Controllability