Upload
buithu
View
222
Download
4
Embed Size (px)
Citation preview
SYSTEMSYSTEMIDENTIFICATIONIDENTIFICATION
Ali KarimpourAssociate Professor
Ferdowsi University of Mashhad
References are appeared in the last slide.
Last update: 09.12.2014 (1393/09/18)
Lecture 7
Ali Karimpour Dec 2014
2
Lecture 7
Recursive estimation methodsRecursive estimation methodsTopics to be covered include:
Introduction.
The Recursive Least-Squares Algorithm.
The Recursive IV Method.
Recursive Prediction-Error Methods.
Recursive Pseudolinear Regressions.
Lecture 7
Ali Karimpour Dec 2014
3
Topics to be covered include:
Introduction.
The Recursive Least-Squares Algorithm.
The Recursive IV Method.
Recursive Prediction-Error Methods.
Recursive Pseudolinear Regressions.
Recursive estimation methods
Lecture 7
Ali Karimpour Dec 2014
4
Introduction
In many cases it is necessary, or useful, to have a model of the system available in real time.
The reason for parameter varying system:
• Aging.
• Changing the dynamic of process.
• Changing the ambient of process.
Type of data in system identification:
• Batch data.
• Sequential data.
Offline identification.
Online identification.
Both Online and offline identification can be used in Real-time identification.
Lecture 7
Ali Karimpour Dec 2014
5
Introduction
In many cases it is necessary, or useful, to have a model of the system available in real time.The need for such real-time model is required in order to:
• Which input should be applied at the next sampling instant?
• How should the parameters of a matched filter be tuned?
• What are the best predictions of the next few output?
• Has a failure occurred and, if so, of what type?
Adaptive
Adaptive control, adaptive filtering, adaptive signal processing, adaptive prediction.
Lecture 7
Ali Karimpour Dec 2014
6
Introduction
The real-time computation of the model must completedduring one sampling interval.
Identification techniques that comply with this requirement will be called:
• Recursive identification methods.
• On-line identification. • Real-time identification.
• Adaptive parameter estimation. • Sequential parameter estimation.
• Recursive identification methods. Used in this Course.
Apart from the use of recursive methods in adaptive schemes, they are important since:
• They will carry their own estimate of the parameter variance.
Data collected from the system and processed until a sufficient degree of accuracy reached.
• This algorithms will also quite competitive with off-line situations.
Lecture 7
Ali Karimpour Dec 2014
7
Introduction
Algorithm format
General identification method: ),(ˆ tt ZtF
))(),(),1((ˆˆ))(),(),1(()1()(
1 tutytXQ
tutytXQtXtX
ttt
Xt
This form cannot be used in a recursive algorithm, since it cannot be completed in one sampling instant.
Instead following recursive algorithm must comply:
Minimizing argument of some function or…
Information state
Since the information in the latest pair of measurement { y(t) , u(t) } normally is small compared to the pervious information so there is a more suitable form
Small numbers reflecting the relative information value in the latest measurement.
))1((ˆ))(),(),1(,()(
tXh
tutytXtHtX
t
Lecture 7
Ali Karimpour Dec 2014
8
Introduction
Mean derive from a recursive procedure
?1 NN
N
NN xNN
N 111
Lecture 7
Ali Karimpour Dec 2014
9
Topics to be covered include:
Introduction.
The Recursive Least-Squares Algorithm.
The Recursive IV Method.
Recursive Prediction-Error Methods.
Recursive Pseudolinear Regressions.
Recursive estimation methods
Lecture 7
Ali Karimpour Dec 2014
10
The Recursive Least-Squares Algorithm
LS Criterion: The estimate for the weighted least squares is:
Where
Let us try to utilize the relationship of parameters at time t and t+1
2
1)()(minarg)(ˆ
t
k
T kkyt
Yt TT 1)(̂
)()()(ˆ tbtPt
1
1
1 )()()(
t
k
TT kktP
t
k
T kyktYttb1
)()()()()(
Lecture 7
Ali Karimpour Dec 2014
11
The Recursive Least-Squares Algorithm
LS Criterion: The estimate for the weighted least squares is:
Let us try to utilize the relationship of parameters at time t and t+1
)()()(ˆ tbtPt 1
1
1 )()()(
t
k
TT kktP
t
k
T kyktYttb1
)()()()()(
1
1
11
1)1()1()()()()()1(
t
k
TTt
k
T ttkkkktP
11 )1()1()()1( tttPtP T
)1()1()()()()()1(1
1
1
tytkykkyktb
t
k
t
k
)1()1()()1( tyttbtb
Lecture 7
Ali Karimpour Dec 2014
12
The Recursive Least-Squares Algorithm
LS Criterion: The estimate for the weighted least squares is:
Recursive algorithm:
)()()(ˆ tbtPt 1
1
1 )()()(
t
k
TT kktP
t
k
T kyktYttb1
)()()()()(
11 )1()1()()1( tttPtP T
)1()1()()1( tyttbtb ................
)(ˆ)1()1()1()1()(ˆ)1(ˆ tttyttPtt T
)1(
)|1(ˆ)1()1()1()(ˆ)1(ˆ
t
ttytyttPtt
Lecture 7
Ali Karimpour Dec 2014
13
The Recursive Least-Squares Algorithm
Ordinary LS Criterion:
Recursive algorithm: Yt TT 1)(̂
11 )1()1()()1( tttPtP T
)1(
)|1(ˆ)1()1()1()(ˆ)1(ˆ
t
ttytyttPtt
Benefits of recursive algorithm?
Order of complexity.Ordinary LS: O(d2t)
Recursive LS: O(d3)
Problem of recursive LS?
Lecture 7
Ali Karimpour Dec 2014
14
The Recursive Least-Squares Algorithm
11 )1()1()()1( tttPtP T
Version with Efficient Matrix Inversion
To avoid inverting at each step, let remember matrix inversion lemma:
)1()()1(1)()1()1()()()1(
ttPt
tPtttPtPtPT
T
)1(
)|1(ˆ)1()1()1()(ˆ)1(ˆ
t
ttytyttPtt
Mor
e ef
ficie
nt
recu
rsiv
e LS
111111 DABDACBAABCDA
Lecture 7
Ali Karimpour Dec 2014
15
The Recursive Least-Squares Algorithm
Ordinary LS Criterion:
Recursive algorithm: Yt TT 1)(̂
11 )1()1()()1( tttPtP T
)1()1()1()(ˆ)1(ˆ tttPtt
Order of complexity?
Ordinary LS: O(d2t) Recursive LS: O(d3)
More efficient recursive algorithm:
)1()()1(1)()1()1()()()1(
ttPt
tPtttPtPtPT
T
)1()1()1()(ˆ)1(ˆ tttPtt
More efficient recursive LS: O(d2)
Lecture 7
Ali Karimpour Dec 2014
16
The Recursive Least-Squares Algorithm
Initial values?
More efficient recursive algorithm:
)1()()1(1)()1()1()()()1(
ttPt
tPtttPtPtPT
T
)1()1()1()(ˆ)1(ˆ tttPtt
1- Try estimation on a set of batch data,
?)0(?)0(ˆ P
2- Start with arbitrary initials,
1000100)0(0)0(ˆ IP
Lecture 7
Ali Karimpour Dec 2014
17
The Recursive Least-Squares Algorithm
Exercise 7-1: Try to find 6000 suitable data from following system,
y(t)+ay(t-1)=bu(t-1)+e(t) e(t) is WGN (variance is 0.1)
a) Suppose a=0.7 and b=2 try to find parameters through ordinary LS and recursive LS.
b) Draw parameters variation versus iteration and explain the convergence behavior.
c) Suppose a=0.7 and b=2 in first 3000 samples and suddenly they change to a=1 and b=3 in the next 3000 samples. Draw parameters variation versus iteration and explain the convergence behavior in first and in second part.
d) What happened in part ‘c’ and why?
Lecture 7
Ali Karimpour Dec 2014
18
The Recursive Least-Squares Algorithm
Draw back of recursive LS:
2
1)()(minarg)(ˆ
t
k
T kkyt
Using forgetting factor:
2
1)()(minarg)(ˆ
t
k
Tkt kkyt
999.095.0
QYQt TT 1)(̂
New estimation is:
021 ,...,, ttdiagQ
)1()()1(1)()1()1()()()1(
ttPt
tPtttPtPtPT
T
0)( tP
Modification for time-varying parameters
Lecture 7
Ali Karimpour Dec 2014
19
The Recursive Least-Squares Algorithm
Forgetting factor
11
The number of data kept in the memory can roughly be calculated as:
noise. toeSusceptibl
.capability trackingParameter
λ is chosen as a trade-off between noise sensitivity and parameter tracking capability.
Lecture 7
Ali Karimpour Dec 2014
20
The Recursive Least-Squares Algorithm
Exercise 7-2: Show that recursive least square with forgetting factor is derived by:
2
1)()(minarg)(ˆ
t
k
T kkyt
Using forgetting factor:
2
1)()(minarg)(ˆ
t
k
Tkt kkyt
999.095.0
QYQt TT 1)(̂
New estimation is:
021 ,...,, ttdiagQ
)1()()1()()1()1()()1(
ttPttPttItPtP
T
T
)1()1()1()(ˆ)1(ˆ tttPtt
Lecture 7
Ali Karimpour Dec 2014
21
The Recursive Least-Squares Algorithm
Multivariable case
Now for MIMO
Remember SISO
)1()()1()()1()1()()1(
ttPttPttItPtP
T
T
)1()1()1()(ˆ)1(ˆ tttPtt
2
1)()(minarg)(ˆ
t
k
Tkt kkyt
Exercise 7-3: Show that recursive least square with forgetting factor is derived by:
)()()()()(minarg)(ˆ 1
1kkykkkyt T
Tt
k
Tkt
)()1()1()()1()1()1()()(1)1( 1 tPtttPttttPtPtP TT
)1()1()1()1()(ˆ)1(ˆ 1 ttttPtt
Lecture 7
Ali Karimpour Dec 2014
22
The Recursive Least-Squares Algorithm
Recursive LS.
Draw back?
)1()()1()()1()1()()1(
ttPttPttItPtP
T
T
)1()1()1()(ˆ)1(ˆ tttPtt
2
1)()(minarg)(ˆ
t
k
Tkt kkyt
1- A single forgetting factor can be chosen for the complete model.
2- A “blow-up” can also be happen for constant λ and low excitation.
Lecture 7
Ali Karimpour Dec 2014
23
Use of state estimation to use in feedback loop
x x
M
G
u y
F
H
r
States are not available!
x Estate Estimator
x̂
Condition for xx ˆ
Kalman filterA common application is for state-feedback control.
Lecture 7
Ali Karimpour Dec 2014
Discrete Kalman filter:
If the pair {A, C} is observable . Then the eigenvalues of A-kC can arbitrarily be assigned.
24
( 1) ( ) ( )( )
x t Ax t Bu ty Cx t
ˆ( ) ( ) ( )
ˆ ˆ ˆ( 1) ( 1) ( ) ( ) ( ( ) ( ))
( 1) ( ) ( ) ( ) ( ) (0)e t x t x t t
x t x t A x t x t kC x t x t
e t A kC e t e t A kC e
Kalman filter
Lecture 7
Ali Karimpour Dec 2014
25
Kalman filter in presence of noise
{w(t)} and {v(t)} are assumed to be sequences of white noise independent random variables with zero mean and
1
2
12
( ) ( )
( ) ( )
( ) ( )
T
T
T
E w t w t R
E v t v t R
E w t v t R
(0 ) (0 ) ( ) 0
(0 ) (0 ) ( ) 0
T
T
E x x w t
E x x v t
( 1) ( ) ( ) ( ) (( ) ( ) ( )x t Ax t Bu t w ty t Cx t v t
ˆ ˆ ˆ( 1) ( ) ( ) ( ) ( ) (x t Ax t Bu t K y t Cx t
( 1) ( ) ( ) (e t Le t t
Kalman filter:
Lecture 7
Ali Karimpour Dec 2014
We show that
26
Kalman filter in presence of noise
( 1) ( ) ( ) (e t Le t t L A KC
( ) ( ) ( )t K v t w t Where
The gain matrix K must be chosen such that:
First part of e(t) goes to zero by suitable K but second part?
)()()( minimize and0 teteEtPeE T
Lecture 7
Ali Karimpour Dec 2014
27
Kalman filter in presence of noise
( 1) ( ) ( ) ( )E e t E Le t t LE e t
( 1) ( ) ( ) (e t Le t t L A KC
( ) ( ) ( ) (TP t E e t e t
2 12 12 1( 1) ( ) (T T T TP t A KC P t A KC KRK R K KR R
( ) ( ) ( )t K v t w t
)()()( minimize and0 teteEtPeE T
P(t+1) can be rewritten as:
Lecture 7
Ali Karimpour Dec 2014
28
Kalman filter in presence of noise
P(t+1) can be rewritten as
1
1
12 2
1
2 12 2
1
12 2 12
( 1) ( )
( ) ( )
( ) ( ) ( )
( ) ( ) ( ) (22)
T
T T
TT T T
TT T T
P t AP t A R
K R AP t C R CP t C
R CP t C K R AP t C R CP t C
R AP t C R CP t C R AP t C
Minimizing error covariance matrix leads to:1
12 2( ) ( ) ( )T TK t AP t C R CP t C R
1
1
12 2 12
( 1) ( )
( ) ( ) ( )
T
TT T T
P t AP t A R
R AP t C R CP t C R AP t C
And finally P(t+1) can be rewritten as
Lecture 7
Ali Karimpour Dec 2014
29
Kalman filter in presence of noise
{w(t)} and {v(t)} are assumed to be sequences of white noise independent random variables with zero mean and
1
2
12
( ) ( )
( ) ( )
( ) ( )
T
T
T
E w t w t R
E v t v t R
E w t v t R
(0 ) (0 ) ( ) 0
(0 ) (0 ) ( ) 0
T
T
E x x w t
E x x v t
( 1) ( ) ( ) ( ) (( ) ( ) ( )x t Ax t Bu t w ty t Cx t v t
ˆ ˆ ˆ( 1) ( ) ( ) ( ) ( ) (x t Ax t Bu t K y t Cx t
Kalman filter:
1
12 2( ) ( ) ( )T TK t AP t C R CP t C R
1
1
12 2 12
( 1) ( )
( ) ( ) ( )
T
TT T T
P t AP t A R
R AP t C R CP t C R AP t C
Lecture 7
Ali Karimpour Dec 2014
30
The Recursive Least-Squares Algorithm
Exercise 7-6: Consider following system.
a) Let r1=0.5 and r2=0.25 and x(0)=[10 10]T draw x(t).
)()(]01[)(
)()(995.00599.0
)1(
tvtxty
twtxtx
t.independen areand)}()({)}()({
2
1
vwrtvtvEIrtwtwE
T
T
b) Design a Kalman filter and let [0 0]T as initial value for filter.
c) Draw estimated states and true states in the same figure.
d) Repeat parts a, b, and c for r1=0 and r2=0.
Lecture 7
Ali Karimpour Dec 2014
( 1) ( ) ( ) ( ) (( ) ( ) ( )x t Ax t Bu t w ty t Cx t v t
31
The Recursive Least-Squares Algorithm
Recursive least square by Kalman Filter Interpretation The Kalman Filter for estimating the state of system
Kalman Filter
The linear regression model can be cast to above form as:
)()()()()()1(
tetttytt
T
)(ˆ tx
IA )(tC T
0B 01 R
)}()({2 teteER T
Exercise 7-5: Show that recursive least square for MIMO system can be derived from Kalman filter by suitable assumption.
Hint: let λ=1 and Λ=R2
Lecture 7
Ali Karimpour Dec 2014
( 1) ( ) ( ) ( ) (( ) ( ) ( )x t Ax t Bu t w ty t Cx t v t
32
The Recursive Least-Squares Algorithm
The Kalman Filter for estimating the state of system
Kalman Filter
The linear regression model can be cast to above form as:
)()()()()()()1(tetttytwtt
T
)(ˆ tx
IA )(tC T
0B1R
)}()({2 teteER T
Coping with Time-varying Systems
Exercise 7-6: Derive the Kalman filter for above mention system and compare it with recursive least square with forgetting factor.
)](ˆ)()()[()(ˆ)1(ˆ tttytKtt T 1
2 ])()()()[()( RttPttPtK T 1
1
2 )()()]()()()[()()()1( RttPttPtRttPtPtP T
Lecture 7
Ali Karimpour Dec 2014
33
The Recursive Least-Squares Algorithm
Kalman Filter Interpretation
Kalman filter interpretation gives important information, as well as some practical hints:
Lecture 7
Ali Karimpour Dec 2014
34
The Recursive Least-Squares Algorithm
Recursive LS.
Draw back?1- A single forgetting factor can be chosen for the complete model. 2- A “blow-up” can also be happen for constant λ and low excitation.Kalman filter
)](ˆ)()()[()(ˆ)1(ˆ tttytKtt T 1
2 ])()()()[()( RttPttPtK T
1
1
2 )()()]()()()[()()()1( RttPttPtRttPtPtP T 1- Different weight on different parameter.
2- No “blow-up” can be happen in the case of low excitation.
)()1()1()()1()1()1()()(1)1( 1 tPtttPttttPtPtP TT
)1()1()1()1()(ˆ)1(ˆ 1 ttttPtt
Lecture 7
Ali Karimpour Dec 2014
35
Topics to be covered include:
Introduction.
The Recursive Least-Squares Algorithm.
The Recursive IV Method.
Recursive Prediction-Error Methods.
Recursive Pseudolinear Regressions.
Recursive estimation methods
Lecture 7
Ali Karimpour Dec 2014
36
The Recursive IV Method
The recursive instrumental variable method is:
Remember SISO recursive LS
)1()()1()()1()1()()1(
ttPttPttItPtP
T
T
)1()1()1()(ˆ)1(ˆ tttPtt
2
1)()(minarg)(ˆ
t
k
Tkt kkyt
)1()()1()()1()1()()1(
ttPttPttItPtP
T
T
)1()1()1()(ˆ)1(ˆ tttPtt
Lecture 7
Ali Karimpour Dec 2014
37
Topics to be covered include:
Introduction.
The Recursive Least-Squares Algorithm.
The Recursive IV Method.
Recursive Prediction-Error Methods.
Recursive Pseudolinear Regressions.
Recursive estimation methods
Lecture 7
Ali Karimpour Dec 2014
38
Recursive Prediction-Error Methods Analogous to the weighted LS case, let us consider a weighted quadratic prediction-error criterion
Where
so we have
the gradient with respect to θ is
Lecture 7
Ali Karimpour Dec 2014
39
Recursive Prediction-Error Methods Analogous to the weighted LS case, let us consider a weighted quadratic prediction-error criterion
Remember the general search algorithm developed for PEM as:
For each iteration i, we collect one more data point, so
now define
As an approximation let:
Lecture 7
Ali Karimpour Dec 2014
40
Recursive Prediction-Error Methods Analogous to the weighted LS case, let us consider a weighted quadratic prediction-error criterion
As an approximation let:
With above approximation and taking μ(t)=1, we thus arrive at the algorithm:
But this terms are not recursive.
Lecture 7
Ali Karimpour Dec 2014
42
Recursive Prediction-Error Methods
Family of recursive prediction error methods
• According to the model structure
• According to the choice of R
Wide family of methods
We shall call “RPEM”
For example, the linear regression
If we consider R(t)=I
Where the gain could be a given sequence or normalized as
This is recursive least square method
This scheme has been widely used, under the name least mean squares (LMS)
Lecture 7
Ali Karimpour Dec 2014
43
Recursive Prediction-Error Methods Example 7-1 Recursive Maximum Likelihood
)()()()()()( teqCtuqBtyqA
Tcba nttntutuntytyt ),(...),1()(...)1()(...)1(),(
Tnnn cbacccbbbaaa ......... 212121
Consider ARMAX model
where
and
Remember chapter 10
By rule 11.41
This scheme is known as recursive maximum likelihood (RML)
Lecture 7
Ali Karimpour Dec 2014
44
Recursive Prediction-Error Methods Projection into DM
In off-line minimization this must be kept in mind as a constraint.
The model structure is well defined only for giving stable predictors. MD
The same is true for the recursive minimization.
m
m
DiftDiftttRttt
~)1(ˆ
~~)()()()()1(ˆ)(ˆ1
Experience shows that the test typically take place in the few samples in the beginning.
Lecture 7
Ali Karimpour Dec 2014
45
Topics to be covered include:
Introduction.
The Recursive Least-Squares Algorithm.
The Recursive IV Method.
Recursive Prediction-Error Methods.
Recursive Pseudolinear Regressions.
Recursive estimation methods
Lecture 7
Ali Karimpour Dec 2014
46
Recursive Pseudolinear Regressions
Consider the pseudo linear representation of the prediction
And recall that this model structure contains, among other models, the general linear SISO model:
A bootstrap method for estimating θ was given by (Chapter 10, 10.64)
By Newton - Raphson method
Lecture 7
Ali Karimpour Dec 2014
47
Recursive Pseudolinear Regressions By Newton - Raphson method
By rule 11.41
Lecture 7
Ali Karimpour Dec 2014
48
Recursive Pseudolinear Regressions Family of RPLRsThe RPLR scheme represents a family of well-known algorithms when applied to different special cases of
The ARMAX case is perhaps the best known of this. If we choose
This scheme is known as extended least squares (ELS).Other special cases