Lecture 3

SYSTEMS
Identification
Ali Karimpour
Assistant Professor
Ferdowsi University of Mashhad
Reference: “System Identification Theory For The User”
Lennart Ljung
lecture 3
Lecture 3
Simulation and prediction
Topics to be covered include:



Simulation.
Prediction.
Observers.
2
Ali Karimpour Nov 2009
lecture 3
Simulation
Suppose the system description is given by
y (t )  G (q)u (t )  H (q)e(t )
Undisturbed output is
Let
u  (t ) ,
t  1, 2 , 3 , .....
y  (t )  G(q)u  (t )
Let (by a computer)
Disturbance is
e (t ) ,
t  1, 2 , 3 , .....
v (t )  H (q)e (t )
Output is
y  (t )  G(q)u  (t )  H (q)e (t )
Models used in, say, flight simulators or nuclear power station training simulators
are of course more complex, but still follow the same general idea.
3
Ali Karimpour Nov 2009
lecture 3
Prediction (Invertibility of noise model)
Disturbance is

v(t )  H (q )e(t )   h(k )e(t  k )
k 0
H must be stable so:

 h( k )  
k 0
Invertibility of noise model
v(t )  H (q)e(t )
if v(t ) is known
e(t )  ?
~
e(t )  H (q)v(t )
With

~
 h (k )  
k 0
?
H (q)

~
H (q)
4
Ali Karimpour Nov 2009
lecture 3
Prediction (Invertibility of noise model)
Invertibility of noise model
v(t )  H (q)e(t )
~
e(t )  H (q)v(t )
?

H (q)
~
H (q)

v(t )  H (q )e(t )   h(k )e(t  k )
Lemma 3_1 Consider v(t) defined by
k 0
Assume that filter H is stable and let:

H ( z )   h( k ) z  k
k 0
Assume that 1/H(z) is stable and:
Define H-1(q) by

~
1
  h (k ) z  k
H ( z ) k 0

~
H (q)   h (k )q k
1
k 0
Then
H-1(q)
is inverse of H(q) and
~
e(t )  H 1 (q)v(t )  H (q)v(t )
5
Ali Karimpour Nov 2009
lecture 3
Prediction (Invertibility of noise model)
Proof

H ( z )   h( k ) z  k


 
~
~
( k  s )
1   h(k )h ( s ) z
  h(k )h (l  k ) z l
k 0

~
1
  h (k ) z  k
H ( z ) k 0
k 0 s 0
k 0 l  k
Let k  s  l
1, if l  0
~
h(k )h (l  k )  

k 0
0, if l  0

~
e(t )  H (q)v(t )



~
~
  h (k )v(t  k )   h (k ) h( s )e(t  k  s )
k 0
k 0

s 0

 
~
~
  h (k )h( s )e(t  k  s )   h (k )h(l  k )e(t  l )  e(t )
k 0 s 0
k 0 l  k
Let k  s  l
6
Ali Karimpour Nov 2009
lecture 3
Prediction (Invertibility of noise model)
Example 3.1 A moving average process
Let
v(t )  e(t )  ce(t  1)
That is
H (q)  1  cq 1
This is a moving average of order 1, MA(1). Then
zc
H ( z )  1  cz 
z
1
If |c| < 1 then the inverse filter is determined as

z
H ( z ) 
  ( c ) k z  k
z  c k 0
1
So e(t) is:

e(t )   (c) k v(t  k )
Exercise(3E.1): Let
Compute
H-1(q).
k 0
H (q)  1  1.1q 1  0.3q 2
7
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of v)
Now we want to predict v(t) based on the pervious observation


k 0
k 1
v(t )   h(k )e(t  k )  e(t )   h(k )e(t  k )
Now the knowledge of v(s), s ≤t-1 implies the knowledge of e(s), s ≤t-1 according to
inevitability. Also we have

v(t )  e(t )   h(k )e(t  k )  e(t )  m(t  1)
k 1
Suppose that the PDF of e(t) be denoted by fe(x) so:
P( x  e(t )  x  x)  f e ( x)x
Now we want to know fv(x) so:
f v ( x)x  P( x  v(t )  x  x vt 1 )  P( x  e(t )  m(t 1)  x  x vt 1 )
 P( x  m(t 1)  e(t )  x  m(t 1)  x vt 1 )  f e ( x  m(t  1))8x
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of v)
f v ( x)x  f e ( x  m(t  1))x
So the (posterior) probability density function of v(t), given observation
up to time t-1, is
f v ( x)  f e ( x  m(t  1))
vˆ(t )  ?
1- Maximum a posteriori prediction (MAP): Use the value for which PDF
has its maximum.
Let vˆ(t )  arg max  f v ( x) 
x
2- Conditional expectation: Use the mean value of the distribution in
question.
Let vˆ(t )  vˆ(t | t  1)
We use mostly the blocked one.
Exercise: Show that conditional expectation minimizes the mean square error of
the prediction error.
9
Exercise (3E.4)
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of v)
v(t )  e(t )  m(t  1)
vˆ(t | t  1)  ?




vˆ(t | t  1)  m(t  1)   h(k )e(t  k )   h(k )q k  e(t )  H (q) 1e(t )
k 1
 k 1


H (q)  1
~

v(t )  1  H 1 (q) v(t )    h (k )v(t  k )
H (q)
k 1


Exercise(3T.1): Suppose that A(q) is inversely stable and monic. Show that A-1(q) is
monic.

Conditional expectation
Alternative formula
~
vˆ(t | t  1)    h (k )v(t  k )
k 1

H (q)vˆ(t | t  1)   h(k )v(t  k )
k 1
10
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of v)
Conditional expectation

~
vˆ(t | t  1)    h (k )v(t  k )
k 1
Alternative formula

H (q)vˆ(t | t  1)   h(k )v(t  k )
k 1
Example 3.2 A moving average process
Let
v(t )  e(t )  ce(t  1)
That is
H (q)  1  cq 1

~
vˆ(t | t  1)    h (k )v(t  k )
k 1

vˆ(t | t  1)   (c) k v(t  k )
k 1

H (q)vˆ(t | t  1)   h(k )v(t  k )
k 1
vˆ(t | t  1)  cvˆ(t  1 | t  2)  cv(t  1)
11
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of v)
Conditional expectation

~
vˆ(t | t  1)    h (k )v(t  k )
k 1
Alternative formula

H (q)vˆ(t | t  1)   h(k )v(t  k )
k 1
Example 3.3
Let

v(t )   a k e(t  k )
a 1
k 0

That is
H ( z )   a k z k 
k 0

~
vˆ(t | t  1)    h (k )v(t  k )
1
1  az 1

H 1 ( z )  1  az 1
vˆ(t | t  1)  av(t  1)
k 1
12
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of y)
Let
y (t )  G (q)u (t )  v(t )
Suppose v(s) is known for s ≤ t-1 and u(s) are known for s ≤ t . Since
y (t )  G (q)u (t )  v(t )
yˆ (t | t  1)  G (q)u (t )  vˆ(t | t  1)
yˆ (t | t  1)  G (q)u (t )  vˆ(t | t  1)

 G(q)u(t )  1  H

(q) y(t )  G(q)u(t )
 G(q)u (t )  1  H 1 (q) v(t )

1

yˆ (t | t  1)  H 1 (q)G(q)u(t )  1  H 1 (q) y(t )
H (q) yˆ (t | t 1)  G(q)u(t )  H (q) 1y(t )


~
yˆ (t | t  1)   l (k )u (t  k )    h (k ) y (t  k )
k 1
k 1
13
Ali Karimpour Nov 2009
lecture 3
Prediction (One-step-ahead prediction of y)
The prediction error
y(t )  yˆ (t | t  1)   H 1 (q)G(q)u(t )  y(t )  e(t )
So the variable e(t) is the part of y(t) that can not be predicted from past data. It
is also called innovation at time t.
Unknown initial condition


k 1
k 1
~
yˆ (t | t  1)   l (k )u (t  k )    h (k ) y (t  k )
Since only data over the interval [0 , t-1] exist so
t
t
k 1
k 1
~
yˆ (t | t  1)   l (k )u (t  k )    h (k ) y (t  k )
The exact prediction involves time-varying filter coefficients and can be computed
14
Ali Karimpour Nov 2009
using the Kalman filter.
lecture 3
Prediction (k-step-ahead prediction of y)
First of all we need k-step-ahead prediction of v


v(t )   h(l )e(t  l )
v(t  k )   h(l )e(t  k  l )
l 0
l 0
k 1

v(t  k )   h(l )e(t  k  l )   h(l )e(t  k  l )
l 0
Unknown
at t
l k
Known
at t
~
v(t  k )  H k (q)e(t  k )  H k (q)e(t )
k 1
where H k (q)   h(l )q
l
l 0

~
H k (q)   h(l )q l  k
l k
k-step-ahead predictor of v

~
~
vˆ(t  k | t )  0   h(l )v(t  k  l )  H k (q)e(t )  H k (q) H 1 (q)v(t )
l k
15
Ali Karimpour Nov 2009
lecture 3
Prediction (k-step-ahead prediction of y)
k-step-ahead prediction of v is:

~
~
vˆ(t  k | t )   h(l )v(t  k  l )  H k (q)e(t )  H k (q) H 1 (q)v(t )
l k
Suppose we have measured y(s) for s≤ t and u(s) is known for s≤ t+k-1. So let
y (t  k )  G (q)u (t  k )  v(t  k )
yˆ (t  k | y , u
t

t  k 1


)  yˆ (t  k | t )  G(q)u(t  k )  vˆ(t  k | t )
~
 G(q)u(t  k )  H k (q) H 1 (q)v(t )
~
 G(q)u(t  k )  H k (q) H 1 (q) y(t )  G(q)u(t )
~
~
yˆ (t  k | t )  1  q k H k (q) H 1 (q) G(q)u(t  k )  H k (q) H 1 (q) y(t )


16
Ali Karimpour Nov 2009
lecture 3
Prediction (k-step-ahead prediction of y)


~
~
1
yˆ (t  k | t )  1  q H k (q) H (q) G(q)u(t  k )  H k (q) H 1 (q) y(t )
k
Define



~
~
Wk (q) 1  q H k (q) H 1 (q)  H (q)  q  k H k (q) H 1 (q)  H k (q ) H 1 (q )
k
~
ˆy(t  k | t )  Wk (q)G(q)u(t  k )  H k (q) H 1 (q) y(t )
yˆ (t  k | t )  Wk (q)G(q)u(t  k )  1  Wk (q)y(t  k )
k-step-ahead prediction of y is:
yˆ (t | t  k )  Wk (q)G(q)u(t )  1  Wk (q) y(t )
Exercise: Show that the k-step-ahead prediction of
y (t )  G (q)u (t )  v(t )
Can also viewed as a one-step-ahead predictor associated with the model:
y (t )  G (q)u (t )  Wk1 (q)v(t )
17
Ali Karimpour Nov 2009
lecture 3
Prediction (k-step-ahead prediction of y)
yˆ (t | t  k )  Wk (q)G(q)u(t )  1  Wk (q) y(t )
Define prediction error of k-step-ahead prediction as:

ek (t  k )  y (t  k )  yˆ (t  k | t )
Exercise: Show that prediction error of k-step-ahead prediction is a
moving average of e(t+k) , … ,e(t+1)
Exercise(3E.2): Determine the 3-step-ahead prediction for
1
y (t ) 
e(t )
1
1  aq
and


y(t )  1  cq 1 e(t )
respectively. What are the variance of the associated prediction error.
18
Ali Karimpour Nov 2009
lecture 3
Observer
In many cases we ignore noises, so deterministic model is used
y (t )  G (q )u (t )
This description used for “computing,” “guessing,” or “predicting”. So we need
the concept of observer.

G ( z )  b ( a )
As an example let:
k 1

y (t )  b (a)
This means
that
k 1
u (t  k )
k 1
1  aq y(t )  bq
1
1
u(t )
k 1
z
k
bz 1

1  az 1
bq 1
y (t ) 
u (t )
1
1  aq
y (t )  ay (t  1)  bu (t  1)
So we have

yˆ (t | t  1)  b (a) k 1 u (t  k )
k 1
yˆ (t | t  1)  ay (t  1)  bu (t  1)
19
Ali Karimpour Nov 2009
lecture 3
Observer
So we have

yˆ (t | t  1)  b (a) k 1 u (t  k )
(I )

yˆ (t | t  1)  ay (t  1)  bu (t  1)
( II )
k 1
If input output data are lacking prior to time t = 0 , first one suffers from an error, but
second one still is correct for t > 0.
In the other hand first one is un affected by measurement errors in the output, but
second one affected.
So the choice of predictor could be seen as a trade-off between
sensitivity with respect to output measurement errors and rapidly
decaying effects of erroneous initial conditions.
Exercise (3E.3): Show that if
bq 1
y(t ) 
u(t )  H (q)e(t )
1
1  aq
Then for the noise model H(q)=1, (I) is the natural predictor, whereas the noise model

H (q)   (a k )q k
k 0
Leads to the predictor (II)
20
Ali Karimpour Nov 2009
lecture 3
Observer
A family of predictor for
y (t )  G (q )u (t )
So the choice of predictor could be seen as a trade-off between sensitivity with respect
to output measurement errors and rapidly decaying effects of erroneous initial conditions.
To introduce design variables for this trade-off, choose a filter W(q) such that

W (q )  1   wl q 1
l k
Applying it to both sides we have
W (q) y (t )  W (q)G (q)u (t )
Which means that
y(t )  1  W (q)y(t )  W (q)G(q)u(t )
The right hand side of this expression depends only on y(s), s≤t-k, and u(s). s ≤t-1.
So
yˆ (t | t 1)  1  W (q)y(t )  W (q)G(q)u(t )
21
Ali Karimpour Nov 2009
lecture 3
Observer
A family of predictor for
y (t )  G (q )u (t )
y(t )  1  W (q)y(t )  W (q)G(q)u(t )
yˆ (t | t 1)  1  W (q)y(t )  W (q)G(q)u(t )
The trade-off considerations for the choice of W could then be
1. Select W(q) so that both W and WG have rapidly decaying filter coefficients in
order to minimize the influence of erroneous initial conditions.
2. Select W(q) so that measurement imperfections in y(t) are maximally attenuated.
The later issue can be shown in frequency domain. Suppose that
y(t )  yM (t )  v(t )
The prediction error is:
e(t )  y (t )  yˆ (t | t  1)  W (q)v(t )
22
Ali Karimpour Nov 2009
lecture 3
Observer
A family of predictor for
y (t )  G (q )u (t )
y(t )  1  W (q)y(t )  W (q)G(q)u(t )
yˆ (t | t 1)  1  W (q)y(t )  W (q)G(q)u(t )
The prediction error is:
e(t )  y (t )  yˆ (t | t  1)  W (q)v(t )
The spectrum of this error is, according to Theorem 2.2:
i
2
  ( )  W (e )  v ( )
The problem is thus to select W, such that the error spectrum has an acceptable size
and suitable shape.
23
Ali Karimpour Nov 2009
lecture 3
Observer
Fundamental role of the predictor filter
Let
y (t )  G (q)u (t )  H (q)e(t )
Then y predicted as:
y (t )  G (q )u (t )
or


yˆ (t | t  1)  H 1 (q)G(q)u(t )  1  H 1 (q) y(t )
or
yˆ (t | t 1)  1  W (q)y(t )  W (q)G(q)u(t )
They are linear filters since:
y(t )
u(t )
Linear
Filter
yˆ (t | t  1)
24
Ali Karimpour Nov 2009