Document

advertisement
EEE8013
Revision lecture 1
Ordinary Differential Equations
Autumn 2008
Modeling
Model:
f(t)
Ordinary Differential Equations (ODE):
x(t)
F  ma  f  f friction  ma
friction
dx
d 2x
 f  Bu  ma  f  B  m 2
dt
dt
Dynamics:
Properties of the system, we have to solve/study the ODE.
Autumn 2008
First order systems: Study approaches
First order ODEs: dx  f ( x, t )
dt
Analytic:
Explicit formula for x(t) (a solution – separate variables, integrating factor)
which satisfies dx  f ( x, t )
dt
dx
 a   dx   adt  xt   at  C INFINITE curves (for all Initial Conditions (ICs)).
dt
Autumn 2008
First order linear equations
First order linear equations - (linear in x and x’)
a(t ) x'b(t ) x  c(t ), Non autonomous

Autonomous
ax'bx  c,
General form:
x'kx  u
0.1
Numerical Solution: k=5, u=0.5
0.08
0.06
k
Gain
u
u
u
Dx
1
s
0.04
x
x
Integrator
Scope
0.02
0
0
Autumn 2008
1
2
3
4
Analytic solution: Step input
kdt
e
k const
 e kt
 
ekt x'kx  ektu  ekt x '  ektu
 
  e kt x ' dt   e kt udt
 e kt x   e kt udt  c  x  e kt  e kt udt  e kt c
xe
 kt
x0  e
 kt
t
kt1
e
 udt1
0
Autumn 2008
Response to a sinusoidal input
y1 ' ky1  k cos t 
y2 ' ky2  k sin  t   jy2 ' kjy2  kj sin  t 
jy2 ' kjy2  y1 ' ky1  kj sin  t   k cos t 
 y1 ' jy2 '  k  y1 
jy2   k cos t   j sin  t 
~
y ' k~
y  ke jt
e kt 
~
y
~yekt '  kek  jt 
1  

k 
j  t  tan


e 
1
1 
2
k2
~
y ekt 
k
k
y
e jt 
ek  jt   ~
k  jt
k  jt




1 
1
j t  tan  
~
k

Re y   Re
e
2
 1  

2
k



1 
Autumn 2008
 k 
cos t  tan1 
1
2
k2
Response to a sinusoidal input
k
Gain
1
s
Sine Wave
Clock
Integrator
Gain2
Math
Function
-k
Gain1
Scope
1
s
eu
k
total
total
Product
steady state
Integrator1
Product1
Scope1
eu
Math
Function1
Scope3
0.25
0.1
Gain3
0.2
Transient
Steady
state
Overall
Transient
Scope2
0.15
0.1
0.05
0
-0.05
-0.1
-0.15
-0.2
0
Autumn 2008
2
4
6
8
10
Second order ODEs
d 2x
 f ( x ' , x, t )
Second order ODEs:
dt 2
dx
d 2x

 at  C1  x  0.5at2  C1t  C2

a
2
dt
dt
So I am expecting 2 arbitrary constants
x' ' Ax' Bx  u
u=0 => Homogeneous ODE
x' ' Ax' Bx  0
x  e rt
Let’s try a x  e rt
x '  re rt x' '  r 2 e rt
x' ' Ax' Bx  0  r 2 e rt  Are rt  Be rt  0  r 2  Ar  B  0
 A  A2  4 B
r
 x1 , x2
2
Autumn 2008
x  C1x1  C2 x2
Overdamped system
 A  A2  4 B
r
2
x1  e r1t
A  4B
2
Roots are real and unequal
x2  e r2t x  C1 x1  C2 x2  C1e r1t  C2e r2t
x' '4 x'3x  0 x  e rt
1.5
Overall solution
 r 2  4r  3  0  r  3r  1  0
x  C1e3t  C2e t x'  3C1e3t  C2et
x0  1
x' 0  0
x' 0   3C1  C 2  0
x  0.5e
x2
0.5
x0   C1  C 2  1
3t
1
0
 3 e t
2
x1
-0.5
0
1
Autumn 2008
2
3
4
5
6
Critically damped system
 A  A2  4 B
r
2
A2  4B
Roots are real and equal
x1  e rt x2  te rt
x  C1x1  C2 x2 
C1e rt  C2te rt
1
e-t
0.9
0.8
te-t
0.7
A=2, B=1, x(0)=1, x’(0)=0 =>
c1=c2=1
overall
0.6
0.5
0.4
0.3
0.2
0.1
0
0
2
Autumn 2008
4
6
8
10
Underdamped system
 A  A2  4 B
r
2
r=a+bj
A2  4B
A0
Roots are complex
x  e rt  ea bj t  e at bjt
Underdamped system
at
 e at e jbt  e cos(bt)  j sin( bt)
Theorem: If x is a complex solution to a real ODE then Re(x) and Im(x) are
the real solutions of the ODE:
x1  e at cos(bt), x2  e at sin( bt)
G
x  c1x1  c2 x2  c1eat cos(bt)  c2eat sin( bt)
 eat c1 cos(bt)  c2 sin( bt)  eatG cosbt   
, &   tan 1  c2 
 c1 
c
cos tan 1  2  
 c1  

c1
Autumn 2008
Underdamped system, example
A=1, B=1, x(0)=1, x’(0)=0 => c1=1, c2=1/sqrt(3)
eat c1 cos(bt)  c2 sin( bt)
1.5
eatG cosbt   
1.5
C1cos(bt)
1
C1cos(bt)+C2sin(bt)
0.5
C1cos(bt)+C2sin(bt)
0.5
0
0
-0.5
-0.5
C2sin(bt)
-1
-1.5
0
eat
1
-1
2
4
6
8
10
-1.5
0
Autumn 2008
Overall
2
4
6
8
10
Undamped
A0
Undamped system
x' '0  Bx  0  r 2e rt  0  Be rt  0  r 2   B
x  c1 cos(bt)  c2 sin( bt)  G cosbt    A=0, B=1, x(0)=1, x’(0)=0 =>c1=1, c2=0:
1
0.8
0.6
0.4
Overall
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
0
2
4
6
Autumn 2008
8
10
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
jb
a
a
Critical or
overdamped
Stable
underdamped
Unstable
Autumn 2008
Natural frequency, damping frequency, damping factor
A  2n , B  n2
x' '2 n x'n2 x  0
 is the damping factor and  n is the natural frequency of the system.
 A  A2  4 B  2 n 
r

2
2 n 2  4n2
2
r   n   2n2  n2
Case 1:

n2
2
 n2
 0
  1   1
2
r1, 2   n   2n2  n2
=> Overdamped system implies that
x  C1er1t  C2er2t
Autumn 2008
 1
Natural frequency, damping frequency, damping factor
Case 2:
 2n2  n2   2  1    1
r  n
x  C1en t  C2te n t
Case 3:

n2
2
=> Critically damped system implies that   1
 n2
 0
   1    1 => Underdamped systems implies   1
2
r1, 2   n  j
n2

n2
2
x  e n t G cosd t   
  n  jn 1  
d
2
 d  n 1 2

  n  jd
called damped frequency or pseudo-frequency
Case 4:
 0
r   j n
x  G cosn t   
No damping the frequency of the
oscillations = natural frequency
Autumn 2008
Summary
Autumn 2008
Stability revised
If   0 then cases 1-3 are the same but with k  0
jd
 n
j d
  n
Critical or
overdamped
Stable
underdamped
Unstable
Autumn 2008
NonHomogeneous (NH) differential equations
x' ' Ax' Bx  u
 u=0 => Homogeneous => x1 & x2.
 Assume a particular solution of the nonhomogeneous ODE: xp
If u(t)=R=cosnt => x P 
R
B
Then all the solutions of the NHODE are
x  x P  c1 x1  c2 x2
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
x  2  c1x1  c2 x2  2  eat c1 cos(bt)  c2 sin( bt)
x' ' x' x  2  x P  2
x(0)=1, x’(0)=0 => c1=-1, c2=-1/sqrt(3)
2.5
2
1.5
Particular solution
Overall
1
Homogeneous solution
0.5
0
-0.5
-1
0
2
4
Autumn 2008
6
8
10
State Space

x n   f x, x' , x' ' ,...x n 1
Very difficult to be studied => so we use computers
Computers are better with 1st order ODE
1
nth
=> n

m x  F  B x  kx

x1  x  x2


x1  x 


x2  x 
1st
Powerful tools from the linear algebra



x2  x 
1
F  Bx2  kx1 
m
   0
 x1    k
   
 x 2   m
   0
 x1    k
   
 x 2   m
1   x  0 
B  1   
   x2  F 
 m
m

1   x  0 
1
B

F  X  AX  BU
   x2   1 
 m
m
Autumn 2008
Use sensors: Output = x =>
 x1 
y  x  1 0   y  CX  DU
 x2 
State Space

X  AX  BU
y  CX  DU
Input
U
U1
U1
Uq
U

X  AX  BU
y  CX  DU

X  AX  BU
y  CX  DU

X  AX  BU
y  CX  DU
Output
y
y1
y2
yp
Y
 u1 
 y1 
u 
y 
2
2
U   , Y   

 y3 
 
 
u q 
yp 
Autumn 2008

X(t )  At X(t )  B(t )U(t )
Y(t )  C(t ) X(t )  D(t )U(t )
Block Diagram

X(t )  At X(t )  B(t )U(t )
Y(t )  C(t ) X(t )  D(t )U(t )
•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)

X(t )  AX(t )  BU(t )
Y(t )  CX(t )  DU(t )
U
B
DX
  dt
A
Autumn 2008
X
C
Y
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:
x1  x1 , 0, , 0T
x2  0, x2 , , 0T ...
x n  0, 0, , xn T
2
R
x3
x2
A standard orthogonal basis (since they are linear independent)
 for an n-dimensional vector space called state space.
R
x2
x
1
x1
3
Matlab definition
Autumn 2008
Solution
 
 x1    2 2   x1 
    2  5  x2 
 x 2 
 x1  2 x1  2 x2 



 x2  2 x1  5 x2 
1
x2  5 x2  
2
1
x1  x2  5 x2  
2
1
x2  5 x2   2 1 x2  5 x2   2 x2 
2
2
1
5
x2  x 2   x2  5 x2  2 x2 
2
2
x2  5 x2  2 x2  10x2  4 x2 
x2  7 x 2  6 x2  0 
x1 
Autumn 2008
x2  7 x2  6 x2  0
r 2  7r  6  0
xa  Cet
xb  De 6t
Solution II
 
 x1    2 2   x1 
    2  5  x2 
 x 2 
a1  t
X   e
a2 
a1  t
X    e
 a2 

a1 
a1   2a1  2a2 
 2 2  a1  t
X     e t  
e

a    2a  5a 
 a 
a
2

5

 2 
 2
 2  1
2 

How can we solve that ???
Assume  is a parameter => A homogeneous linear system
 2   a1  2a2  0


2a1   5   a2  0 
2
2
2
5
 0  2  7  6  0
(This last equation is the characteristic equation of the system, why???).
Autumn 2008
Solution III
  1
2  7  6  0   1
2  6
1  1
 a1  2a2  0


2a1  4a2  0 
I assume that a2=1 so a1=2
 1  6
4a1  2a2  0 


2
a


a

0
 1

2
a
2
 1:  1    
 
a2  1 
 2
X1 (t )    e t
1 
I assume that a1=2 so a2=-2
 2
1 
Xt   C1   e t  C 2   e 6t
1 
  2
Matlab example
Autumn 2008
1
X 2 (t )    e 6t
  6
General Solution

X  AX
X  c e et  e  A e  I  Ae  0 I  A  0
The roots of this equation are called eigenvalues
e i i
1  2  2  ...n
Xt   C1e1e1t  C2e2e2t  ... Cnenent
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
Xt   C1e1e1t  C2e2e2t  ... Cnenent
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.
Ci ei eit
e it
ei
Ci
Determines the nature of the time response (stable, fast..)
Determines the extend in which each state contributes to e
Determines the extend in which the IC excites the
e it
To find the eigenvalues and eigenvectors use the command eig()
Autumn 2008
i t
Example
state space
 
 x1    2 2   x1 
    2  5  x2 
 x 2 
1.5
1
e1
x2
0.5
0
0,0
-0.5
-1
-1
e2
-0.5
0
0.5
x1
Autumn 2008
1
1.5
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

x  ax
e At
xt   e at x0

I  A  0
X  AX
X  e At X0
=> No special cases are needed then
e At    At 
1
At 2  1 At 3  ...
2!
3!
 
 x1    2 2   x1 
    2  5  x2 
 x 2 
4 ways to calculate it!!!
Use the command expm (not exp)!
 2 2 
A

 2  5
X(0)=[1 2]
X(5) =?
Autumn 2008
State Transition Matrix
Xt   C1 e1e1t  C2 e 2 e 2t  ...  Cn e n e nt
X  e At X0
1


 e n 



n 

Ae1 e 2  e n   e1 e 2
Aei  e i λi
A  TΛ1
AT  TΛ
e At    At 






2
3
1
At 2  1 At 3  ...    TΛ1 t  1 TΛ1 t  1 TΛ1 t  ...
2!
3!
2!
3!
TΛ1 2  TΛ1 TΛ1   TΛ21
e
At






1
1
 TI  TΛ t  TΛ 21 t 2  TΛ31 t 3  ... 
2!
3!
1
1


 T   Λt  Λt 2  Λt 3  ...1  Te Λt 1
2!
3!


1
1
Autumn 2008
e Λt
e 1t








n t 
e 
State Transition Matrix
X  e At X0  Te Λt 1X0 
X  e1 e 2
X  e1 e 2
e 1t

 e n 


e 1t

 e n 




1

e1 e 2  e n  X0
e nt 
w 
 1 
 w 2 

    X0
e nt   
w n 
n
Xt   e1e w1x10  e2e w 2 x2 0  ...   ei e
1t
2t
i 1
X  e1 e 2
i t
w i xi 0
 w   x (0) 
e1t
 1  1 

 w 2   x2 (0) 

 en 

    

t

e n    


w n   xn (0)
n
Xt    ei eit bi 0
i 1
Xt   C1 e1e1t  C2 e 2 e 2t  ...  Cn e n e nt
Autumn 2008
Solution


x  ax  bu  x  ax  bu
t

e
 at



 d at
e  at  x  ax  
e xt 

 dt

t
t
d a
 a
 at
 a
 dt e x  d   e bud  e xt   x0   e bud
0
0
0
xt   e x0  e
at
t
at
e
 a
t
bud  xt   e x0   e a t  bud
at
0
0
t
Xt   e At X0   e At  BUd
0
Autumn 2008
 e  at bu
SS => TF???

LT
X(t )  AX(t )  BU(t )  sX(s)  X(0)  AX(s)  BU(s) 
sI  AX(s)  BU(s)  X(0) 
X(s)  sI  A1BU(s)  sI  A1 X(0)


Y(s)  CX(s)  DU(s)  Y(s)  C sI  A1 BU(s)  sI  A1 X(0)  DU(s)


Y(s)  CsI  A1 B  D U(s)  CsI  A1 X(0)
CsI  A 1 B  D
TF
CsI  A1 X(0)
Response to ICs
Autumn 2008
SS => TF???
ILT
X( s)  sI  A  BU( s)  sI  A  X(0) 
1
1


X(t )  L sI  A  X(0)


X(t )  L1 sI  A1 BU(s)  L1 sI  A1 X(0)
1
1
X(t )  e X(0)
At
Gs   CsI  A1 B  D
The TF is a matrix

e At  L1 sI  A1
G s  
 G11( s) G12 ( s)
G ( s ) G ( s )
21
22
G ( s)  

 

G p1 ( s) G p 2 ( s)

sI  A D  BC
sI  A
 G1q ( s) 
 G2 q ( s) 


 

 G pq ( s)
sI  A
CE of the TF
Y1
Y1
Y
Y2
 G11,
 G12, 2 G21,
 G22...
U1
U2
U1
U2
Autumn 2008
SS => TF???
Example: Find the TF of  x1    0
 x 
 2
1   x1  0
 1  0.5  x   1  2

 2   
Autumn 2008
 x1 
y  1 0 
 x2 
Basic properties of state space
State space transformations
State space representations are not unique
Same input/output properties, => same eigenvalues

X(t )  AX(t )  BU(t )
X  TZ
Z is the new state vector
Y(t )  CX(t )  DU(t )

T is an invertible matrix


Z  T 1X  Z  T 1 X  Z  T1AX(t )  T1BU(t )


~
~
Z  T ATZ  T BU(t )  Z  AZ  BU(t )
1
1
~
~
A  T1AT B  T1B
~
~
Y(t )  CTX  DU(t )  Y(t )  C
X  DU(t )
~
C  CT
~
DD
Autumn 2008
Basic properties of state space
~
~ 1 ~ ~
1
Do these two systems have the TF? G1s   CsI  A B  D G2 s   CsI  A B  D
G1s   CsI  A1B  D


 
 T B  D~ 
~
G1s   C TT1 sI  A1 TT1 B  D 

G1 s   CT TsI  A T1

~
G1 s   C sI  TAT1
1
1
Matlab example
1B~  D~ 
~
~ 1 ~ ~
G1 s   CsI  A  B  D  G 2 s 
Autumn 2008
Observability - Controllability
Observability - Controllability


x  2 x  2u 


y  3x
 2 0 
 2 
X
X


1 u 
0

1


  

y  3 0X


Notice the structure of A and C


x  2 x  2u   3s  21 2  6

s2

y  3x

 2 0 
 2 
1
s

2
0
X
X

u


 2




 0  1
1    3 0
 1  
0
s

1

  

y  3 0X


3
0   2
s  1
2s  1
 2 


0
3
0
 s2 
s  2 1 
6
 0

  3 0 s  2 


 
s  2s  1
s  2s  1
 2  s2
 s  1 
Autumn 2008
Observability - Controllability
There is a pole zero cancellation
sI  A B
C
D
s2
0 
0
0
2
0
0
s  1 1  0  s  2 
1
s 1 1
0 1
0 s 1
0
2
0
0 0
1 0
1
0
 s  1  0  s  1
pzmap(ss_model)

Matlab verification

 x1   2 0   x1  2 
 x    0  1  x   1 u 
 2    
 2 

 x1 
y  3 0 

x
 2

 2 0 
 2 
X
X


1 u 
0

1


  

y  3 0X


The cancellation is due to C=[3 0].

x 1  2 x1  u

x 2   x2  u
y  3 x1
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!!!
Autumn 2008
Observability - Controllability
 2 0 
 2 
X
 X  1 u 
0

1


  

y  3 0X


 2 0 
 2 
X
X


0  u  
0

1


  

y  3 2X


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
0   2
s  1
3 2
s  2 0 
 0

s  1s  2
 3
 s  2 

Minimal realisation.
Difficult task if the system is nonlinear!!!!
Autumn 2008
2   2
6

s  1 0 s  2
Observability - Controllability
 C 
 CA 


2
M O   CA 





 n 1 
CA 

MC  B AB A2B  An 1B
Check the rank
>> rank(obsv(A,C))
>> rank(ctrb(A,B))
Autumn 2008

Download