Sei sulla pagina 1di 46

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
2 friction
dx d
f Bu ma f B m x
dt dt 2

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

a dx adt xt at C INFINITE curves (for all Initial Conditions (ICs)).


dx
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


General form:
ax'bx c, Autonomous

x'kx u
0.1
Numerical Solution: k=5, u=0.5
0.08

k 0.06
Gain

u
1 x 0.04
u Dx s x
u Integrator Scope
0.02

0
0 1 2 3 4

Autumn 2008
Analytic solution: Step input

k const
e
kdt
ekt

ekt x' kx ektu ekt x ' ektu


e kt x ' dt e ktudt

e kt x e ktudt c x e kt e ktudt e kt c
t
xe kt
x0 e kt
udt1
e kt1

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 ke jt
y ' k~

e kt ~yekt ' kek jt ~


y e kt
k
k jt
ek jt ~
y
k
k jt
e jt

1
j t tan k
1 j t tan
1
~
y e
Re y Re
~ 1
e k
1
2
1 2

k2

2
k

1

cos t tan 1 k
1
2

k2

Autumn 2008
Response to a sinusoidal input

Gain
1 total
s total
Sine Wave Integrator Scope

1
k eu s
steady state
Clock Product Integrator1
Gain2 Math Product1 Scope1
Function

-k eu

Gain1 Math Scope3


Function1
0.25
Steady
state Overall Transient
0.1
Transient
0.2
Gain3 Scope2
0.15

0.1

0.05

-0.05

-0.1

-0.15

-0.2
0 2 4 6 8 10

Autumn 2008
Second order ODEs

d 2x
Second order ODEs: f ( x' , x, t )
dt 2
d 2x dx
2
a at C1 x 0.5at 2 C1t C2 So I am expecting 2 arbitrary constants
dt dt

x' ' Ax' Bx u u=0 => Homogeneous ODE Lets try a x e rt

x' ' Ax' Bx 0 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 x C1x1 C2 x2
r x1 , x2
2

Autumn 2008
Overdamped system

A A2 4 B Roots are real and unequal


r A2 4 B
2

x1 e r1t x2 e r2t x C1x1 C2 x2 C1e r1t C2e r2t

x' '4x'3x 0 x e rt 1.5

Overall solution
r 2 4r 3 0 r 3r 1 0

x C1e3t C2et x' 3C1e3t C2et


1
x2
x0 1 x' 0 0 0.5

x0 C1 C2 1

x' 0 3C1 C2 0 0

3t
x1
x 0.5e 3 e t
2 -0.5
0 1 2 3 4 5 6

Autumn 2008
Critically damped system

A A2 4 B A2 4 B Roots are real and equal


r
2
x1 e rt x2 tert

x C1 x1 C2 x2 1

0.9 e-t
C1e rt C2tert 0.8
te-t
0.7 overall

0.6
A=2, B=1, x(0)=1, x(0)=0 =>
c1=c2=1 0.5

0.4

0.3

0.2

0.1

0
0 2 4 6 8 10

Autumn 2008
Underdamped system

A A2 4 B A2 4 B
r Roots are complex Underdamped system
2 A0

x e rt ea bj t e at bjt e at e jbt e cos(bt ) j sin( bt )


at
r=a+bj

Theorem: If x is a complex solution to a real ODE then Re(x) and Im(x) are
the real solutions of the ODE:
x c1x1 c2 x2 c1eat cos(bt) c2eat sin(bt)
x1 e at cos(bt), x2 e at sin(bt)
eat c1 cos(bt) c2 sin(bt) eat G cosbt

, & tan 1 c2
c1
G
c1
cos tan 1 c2
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) e at G cosbt

1.5 1.5
C1cos(bt)
1 1 eat
C1cos(bt)+C2sin(bt) C1cos(bt)+C2sin(bt)
0.5 0.5

0 0

-0.5 -0.5
C2sin(bt)

-1 Overall
-1

-1.5 -1.5
0 2 4 6 8 10 0 2 4 6 8 10

Autumn 2008
Undamped

A0 Undamped system x' '0 Bx 0 r 2e rt 0 Be rt 0 r 2 B

x c1 cos(bt ) c2 sin( bt ) G cosbt A=0, B=1, x(0)=1, x(0)=0 =>c1=1, c2=0:

0.8

0.6
0.4 Overall
0.2

-0.2

-0.4

-0.6

-0.8

-1
0 2 4 6 8 10

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 jb

a a

Critical or Stable
overdamped

underdamped Unstable

Autumn 2008
Natural frequency, damping frequency, damping factor

A 2n , B n2 x' '2n x'n2 x 0

is the damping factor and n is the natural frequency of the system.

A A2 4 B 2n 2n 2 4n2 r n 2n2 n2
r
2 2

Case 1:
0
n2
2
n2 1 1
2 => Overdamped system implies that 1

r1, 2 n 2n2 n2 x C1er1t C2e r2t

Autumn 2008
Natural frequency, damping frequency, damping factor

Case 2:
2n2 n2 2 1 1 => Critically damped system implies that 1

r n x C1e n t C2te n t

Case 3:
0
n2
2
n2 1 1 => Underdamped systems implies 1
2

d n 1 2
r1, 2 n j n2 2
n2 n jn 1 2
n jd

x e n t G cosd t d called damped frequency or pseudo-frequency


Case 4:
No damping the frequency of the
0 r j n x G cosn t
oscillations = natural frequency

Autumn 2008
Summary

Autumn 2008
Stability revised

If 0 then cases 1-3 are the same but with k 0


jd j d

n
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
R
If u(t)=R=cosnt => x P
B

Then all the solutions of the NHODE are x xP 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' ' x' x 2 xP 2 x 2 c1x1 c2 x2 2 eat c1 cos(bt) c2 sin(bt)

x(0)=1, x(0)=0 => c1=-1, c2=-1/sqrt(3)


2.5

1.5
Particular solution
Overall
1

Homogeneous solution
0.5

-0.5

-1
0 2 4 6 8 10

Autumn 2008
State Space


x n f x, x' , x' ' ,...x n 1
Very difficult to be studied => so we use computers
m x F B x kx
Computers are better with 1st order ODE
x1 x
1 nth => n 1st

x2 x
Powerful tools from the linear algebra

x1 x x2 0 1 x 0
x1 k B 1

1 x2 F
x2 x F Bx2 kx1 x 2 m m m
m

0 Use sensors: Output = x =>


1 x 0
x1 k 1
F X AX BU
x2 1
B
m x
x 2 m m y x 1 0 1 y CX DU
x2

Autumn 2008
State Space


X AX BU Input
X AX BU
Output

y CX DU U y CX DU y

U1 y1

U1
X AX BU y2

Uq y CX DU yp

u1 y1
U X AX BU Y u y X(t ) At X(t ) B(t )U(t )
U , Y
2 2
y CX DU y3 Y(t ) C(t ) X(t ) D(t )U(t )

u q yp

Autumn 2008
Block Diagram

X(t ) At 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 )


dt
U DX X Y
B C
Y(t ) CX(t ) DU(t )
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 systems states can be written in a vector form as:

x1 x1 , 0, , 0T x 2 0, x2 , , 0T ... x n 0, 0, , xn T

A standard orthogonal basis (since they are linear independent)


for an n-dimensional vector space called state space.

2 3
R R
x2

x3
x1 x2
1
x

Matlab definition

Autumn 2008
Solution

x2 7 x2 6x2 0
x1 2 2 x1
x1 2 x1 2 x2

2 5 x2 x2 2 x1 5 x2

x 2 r 2 7r 6 0
x1
1
x2 5 x2
2 xa Cet
x1 x2 5 x2
1
2 xb De 6t
1
x2 5 x2 2 1 x2 5 x2 2 x2
2 2
1 5
x2 x2 x2 5 x2 2 x2
2 2
x2 5 x2 2 x2 10 x2 4 x2
x2 7 x2 6 x2 0

Autumn 2008
Solution II


x1 2 2 x1 a1 t a1 t

X e X e
2 5 x2 a2 a2
x 2

a 2 2 a1 t a1 2a1 2a2
X 1 e t a e a 2a 5a How can we solve that ???
2
a 2 5 2 2 1 2

Assume is a parameter => A homogeneous linear system

2 a1 2a2 0 2 2
0 2 7 6 0
2a1 5 a2 0 2 5

(This last equation is the characteristic equation of the system, why???).

Autumn 2008
Solution III

1
2 7 6 0 1
2 6

a1 2a2 0
1 1
1
2 a 4 a2 0

1: 1 2
a 2
I assume that a2=1 so a1=2 X1 (t ) e t
a2 1 1

4a1 2a2 0 1
1 6 I assume that a1=2 so a2=-2 X 2 (t ) e 6t
1
2 a a2 0 6

2 1
Xt C1 e t C 2 e 6t
1 2

Matlab example

Autumn 2008
General Solution

X AX X c e e t e A e I Ae 0 I A 0

The roots of this equation are called eigenvalues

1 2 2 ...n
ei
Xt C1e1e 1t C2e 2 e 2t ... Cne n e nt
i

negative eigenvalues => stable repeated eigenvalues => eigenvectors are


positive eigenvalues => unstable 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

Xt C1e1e 1t C2e 2 e 2t ... Cne n e 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 e i e it

eit Determines the nature of the time response (stable, fast..)


ei it
Determines the extend in which each state contributes to e

Ci Determines the extend in which the IC excites the eit


To find the eigenvalues and eigenvectors use the command eig()

Autumn 2008
Example

state space
1.5
x1 2 2 x1
2 5 x2
x 2
1
e1

0.5

x2
0
0,0

-0.5
e2

-1
-1 -0.5 0 0.5 1 1.5
x1

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 I A 0


x ax xt e at x0 X AX X e At X0

e At => No special cases are needed then 4 ways to calculate it!!!

1
e At At At 2 1 At 3 ... Use the command expm (not exp)!
2! 3!

X(0)=[1 2]
x1 2 2 x1 2 2
A
2 5 x2 2 5
x 2 X(5) =?

Autumn 2008
State Transition Matrix

X e At X0 Xt C1 e1e 1t C2 e 2 e 2t ... Cn e n e nt

1
Ae i ei i Ae1 e 2 e n e1 e 2 e n

n

AT T A T1

e At At
1
2!

At 2 1 At 3 ... T1 t 1 T1 t 1 T1 t ...
3! 2!
2

3!
3

T1 2 T T T
1 1 2 1

e At 1
TI T 1
1
1

t T 21 t 2 T31 t 3 ...
2! 3!
e 1t



e t
1 1
T t t 2 t 3 ...1 Te t 1
e n
t
2! 3!

Autumn 2008
State Transition Matrix

X e At X0 Te t 1X0
e 1t

X e1 e 2 e n e1 e 2 e n X0
1

e nt

w w x (0)
e 1t 1 e1t 1 1
w 2 w 2 x2 (0)
X e1 e 2 e n X0 X e1 e 2 e n
e nt e n
t


w n w n xn (0)

Xt e1e w1x10 e2e w 2 x2 0 ... ei e


1t 2t n n
i t
w i xi 0 Xt ei eit bi 0
i 1 i 1

Xt C1 e1e 1t C2 e 2 e 2t ... Cn e n e nt

Autumn 2008
Solution



d at
x ax bu x ax bu e at
e at x ax e xt e at bu
dt


t t t
d a
dt e x d e a
bud e at
x t x 0 e a
bud
0 0 0

t t
xt e x0 e
at at
e
a
bud xt e x0 e a t bud
at

0 0

t
Xt e At X0 e A t BUd
0

Autumn 2008
SS => TF???

LT
X(t ) AX(t ) BU(t ) sX(s) X(0) AX(s) BU(s)

sI AX(s) BU(s) X(0) X(s) sI A1 BU(s) sI A1 X(0)


Y(s) CX(s) DU(s) Y(s) C sI A1BU(s) sI A1 X(0) DU(s)


Y(s) CsI A1 B D U(s) CsI A1 X(0)

CsI A1 B D TF

CsI A1 X(0) Response to ICs

Autumn 2008
SS => TF???

ILT
X( s ) sI A BU( s ) sI A X(0)
1 1


X(t ) L1 sI A1 BU(s) L1 sI A1 X(0)
X(t ) L sI A X(0)
1 1

X(t ) e X(0)
At
e At L1 sI A1

Gs CsI A1 B D G s
sI A D BC
sI A sI A CE of the TF
The TF is a matrix
G11 ( s ) G12 ( s ) G1q ( s )
G ( s ) G ( s ) G2 q ( s ) Y1 Y1 Y2 Y2
G (s)
21 22 G11 , G12 , G21 , G22 ...
U1 U2 U1 U2

G p1 ( s ) G p 2 ( s ) G pq ( s )

Autumn 2008
SS => TF???

Example: Find the TF of x1 0 1 x1 0 x


y 1 0 1
x 1 0.5 x 1 2
2 2 x2

Autumn 2008
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 ) T is an invertible matrix
X TZ
Z is the new state vector
Y(t ) CX(t ) DU(t )

Z T1X Z T1 X Z T 1AX(t ) T 1BU(t )
~
1 1 ~
Z T ATZ T BU(t ) Z AZ BU(t )
~ ~
A T1AT B T1B ~
Y(t ) CTX DU(t ) Y(t ) C ~
X DU(t )
~ ~
C CT DD

Autumn 2008
Basic properties of state space

Do these two systems have the TF? G1s CsI A B D G 2 s CsI A B D


1 ~ ~ 1 ~ ~

G1 s CsI A 1 B D


G1 s C TT1 sI A 1 TT1 B D
~


G1 s CT TsI A T 1 T B D~
1 1
Matlab example


G1 s C sI TAT 1
~
1B~ D~
G1 s CsI A B D G 2 s
~ ~ 1 ~ ~

Autumn 2008
Observability - Controllability

Observability - Controllability


2 0 2
x 2 x 2u X X 1 u
0 1 Notice the structure of A and C
y 3x
y 3 0X

x 2 x 2u 3s 21 2 6

y 3x s2

2 0 2 1
X X u s 2 0 2
0 1 1 3 0 0 1
s 1
y 3 0X
s 1 0 2 2s 1 2
3 0 3 0
0 s 2 1 s2
3 0 s 2 6

s 2s 1 s 2s 1 2 s2
s 1

Autumn 2008
Observability - Controllability

There is a pole zero cancellation


s2 0 2
sI A B s 1 1 0 1 0 s 1
0 0 s 1 1 0 s 2 0 2 0
C D 0 0 1 0 1 0
1 0 0
s 1 0 s 1

The cancellation is due to C=[3 0]. 2 0 2


X X 1 u
0 1
pzmap(ss_model) Matlab verification
y 3 0X


x1 2 0 x1 2 x 1 2 x1 u
x 0 1 x 1 u We can influence x2 through U
2 2 but we cannot observe how it behaves
x1 x 2 x2 u
y 3 0
and hence there is no way to feedback
y 3 x1
2
x that signal to a controller!!!

Autumn 2008
Observability - Controllability

2 0 2 2 0 2 s 1 0 2
X X 1 u X 0 u 3 2
s 2 0
X
0 1 0 1 0

y 3 0X y 3 2X s 1s 2

3 2 2 6

In this case we can see how both states behave s 2
s 1 0 s 2
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!!!!

Autumn 2008
Observability - Controllability

C
CA

M O CA
2


MC B AB A2B An 1B


n 1 Check the rank
CA

>> rank(obsv(A,C))
>> rank(ctrb(A,B))

Autumn 2008

Potrebbero piacerti anche