System Identification white-box) Real-time parameter estimation 1. Introduction Combination(grey-box) 2. Least squares and regression Experiment planning 3. Dy namical sys .Choiceof modelstructure ems Transfer functions 4. Experiment al conditions es po nse 5. Examples State models 6. Conclusions Parameter estimat ion Inverse pro blems Valid at ion Identification Techniq ues Transient response Real-time Parameter Estimation Correlat ion a nalysis Int roduct ion Paramet ric met hods 2. Least squares and reg ression Maximum likelihood ml Experiment al co ndit ions Ident ifi cat ion for cont rol e Related areas 6. Conclusions Numerical a nalysi plication C K. J. Ast ro m and B. Wittenmark
Real-time Parameter Estimation 1. Introduction 2. Least squares and regression 3. Dynamical systems 4. Experimental conditions 5. Examples 6. Conclusions System Identication How to get models? { Physics (white-box) { Experiments (black-box) { Combination (grey-box) Experiment planning Choice of model structure { Transfer functions { Impulse response { State models Parameter estimation { Statistics { Inverse problems Validation Identication Techniques Nonparametric methods { Frequency response { Transient response { Correlation analysis { Spectral analysis Parametric methods { Least squares LS { Maximum likelihood ML Identication for control Related areas { Statistics { Numerical analysis { Econometrics { Many applications Real-time Parameter Estimation 1. Introduction 2. Least squares and regression 3. Dynamical systems 4. Experimental conditions 5. Examples 6. Conclusions c K. J. Åström and B. Wittenmark 1
Good Methods are adopted by Least Squares and Regression Mat hematics . ion St atis · The Ls problem Interpret at io n Phys Geo met ric Econo mics Stat istic ● Recursive Continuous time models Cont rol Signal processing THEORIA The least st quare Met hod MOTVS CORPORVM The pro blem The Orbit of Ceres The pro blem solver Karl Fried rich gauss COELESTIV M most probable system of values of the unknown quantities, in w hich the sum of the squares SECTIONIBVS CONICIS S(LEM AMBIENT!VAL of the differences between the o bserved and A TORE computed values, multiplied by numbers t hat measure the deg ree of precisio n, is a CAROL.O FRIDERICO GAVSS minimum In co nclus io n, the principle that the sum of the bserved and co m put ed quant iti minimum, may be co nsidered inde pendently of t he calculus of probabilit E#am::=:ri…Capt,d An observat io n: Ot her criteria co uld be used #: But of all these principles ours is the most simple; by the ot hers we should be led into the C K. J. Ast ro m and B. Wittenmark
Least Squares and Regression Introduction The LS problem Interpretation { Geometric { Statistic Recursive Calculations Continuous time models Good Methods are adopted by Everybody Mathematics Statistics Numerical analysis Physics Economics Biology Medicine Control Signal processing The Least Squares Method The problem: The Orbit of Ceres The problem solver: Karl Friedrich Gauss The principle: \Therefore, that will be the most probable system of values of the unknown quantities, in which the sum of the squares of the dierences between the observed and computed values, multiplied by numbers that measure the degree of precision, is a minimum." In conclusion, the principle that the sum of the squares of the dierences between the observed and computed quantities must be a minimum, may be considered independently of the calculus of probabilities. An observation: Other criteria could be used. \But of all these principles ours is the most simple; by the others we should be led into the most complicated calculations." c K. J. Åström and B. Wittenmark 2
Mat hematical formulation Solving the Ls Problem The regress io n model Mini mize wit h respect to 8 y(t)=91(t)61+2(t)62+…+9n(t)6n V(6,+) 2∑(2=5>()-=76)2 Bi-unk now n parameters 0A0-b0+2c pPi-known funct ions reg ression variables Some not at io ns A=∑yi)92(a) φ(t)={(t)y2()…gn(t ∑)y(l)c=∑y2() Y(t)=[v(1)y(2).…y(t) E(t)=[(1)e(2).(t The parameter a that minimizes the loss φ(1) function are given by the normal equations Φ(t)= If the mat rix A is nonsingular, the mini mum is uniq ue and given by P(t) (乎(t)乎(t) e(a)=y()-y()=y()-92(a) How to construct the eq uat io ns Example continued Model bo 61 b2 b3 ple y()=b+b1(t)+b212(t)+e(t 1.110450.11 0.031 1.130.370.14-0.0030.027 (m)=[1u(t)u2(t Estimated models y(t) Model 2: y(t) bo +b1u Model 3: y(t) +b1+ Model 4: y(t)=bo+b1u+b2u4+b30 C K. J. Ast ro m and B. Wittenmark
Mathematical Formulation The regression model y(t) = '1(t)1+'2(t)2++'n(t)n = '(t)T y { observed data i { unknown parameters 'i { known functions regression variables Some notations 'T (t) = '1(t) '2(t) : : :'n(t) T = 1 2 : : :n Y (t) = y(1) y(2) :::y(t)T E(t) = "(1) "(2) :::"(t)T (t) = 0 B @ 'T (1) . . . 'T (t) 1 C A P (t) = Xt i=1 '(i)'T (i)1 = T (t)(t)1 "(i) = y(i) y^(i) = y(i) ' T (i) Solving the LS Problem Minimize with respect to V (; t) = 1 2 Xt i=1 "(i)2 = 1 2 Xt i=1 y(i) 'T (i) 2 = 1 2 T A bT + 1 2 c where A = Xt i=1 '(i)' T (i) b = Xt i=1 '(i)y(i); c = Xt i=1 y 2 (i) The parameter ^ that minimizes the loss function are given by the normal equations A^ = b If the matrix A is nonsingular, the minimum is unique and given by ^ = A1b = P b How to construct the equations! An Example y(t) = b0 + b1u(t) + b2u2 (t) + e(t) = 0:1 'T (T ) = 1 u(t) u2 (t) T = [b0 b1 b2] Estimated models Model 1 : y(t) = b0 Model 2 : y(t) = b0 + b1u Model 3 : y(t) = b0 + b1u + b2u2 Model 4 : y(t)= b0 + b1u + b2u2 + b3u3 Example Continued Model ^ b0 ^ b1 ^ b2 ^ b3 V 1 3:85 34:46 2 0:57 1:09 1:01 3 1:11 0:45 0:11 0:031 4 1:13 0:37 0:14 0:003 0:027 0 2 4 6 0 2 4 6 8 Input Output 0 2 4 6 0 2 4 6 8 Input Output 0 2 4 6 0 2 4 6 8 Input Output 0 2 4 6 0 2 4 6 8 Input Output c K. J. Åström and B. Wittenmark 3
Geometric Interpretation Statistical Interpretation E y(t)=p2(+)e°+e(t) true paramet ers e(t-independent rando m variables wit h zero mean and variance g HfΦΦ is no nsing ular,then 2V(,t)/(t-n) is an unbiased estimate of a2 When is E as small as possible n - number of parameters in g0 (p)(y-6y2-62 ng)=0 t number of data The normal eq uat io ns Recursive Least squares The Ls estimate is given by 8(t)=P(t p()y()+p(t)y(t) ∑)( Recursive Least squares P(t)-1=P(t-1)-1+g(t)y2(t) But e Want to avoid repeating all calculations if dat dat sively ∑p()y(i)=P(t-1)-(t-1) . Does t here exist a recursive formula t hat expresses 8(t)in terms of A(t-1) P(t)-1e(t-1)-p(t)y2(t)(t-1) The e(t)=6(t-1)-P(t)yp(t)(t)(t-1)+P(t)y(t)y(t) e(t-1)+P(t)y((t)-yr(e(t-1) 6(t-1)+K(t)(t) Want r C K. J. Ast ro m and B. Wittenmark
Geometric Interpretation E θ 1ϕ1 θ 2ϕ2 ϕ2 ϕ1 ˆ Y Y E = Y ' 11 ' 22 'nn When is E as small as possible? ('i)T y 1'1 2'2 n'n = 0 The normal equations! Statistical Interpretation y(t) = ' T (t) 0 + e(t) 0 { \true" parameters e(t) { independent random variables with zero mean and variance 2 If T is nonsingular, then E ^ = 0 cov ^ = 2 (T )1 = 2P s 2 = 2V (^ ; t)=(t n) is an unbiased estimate of 2 n { number of parameters in 0 t { number of data Recursive Least Squares Idea: Want to avoid repeating all calculations if data new data arrives recursively Does there exist a recursive formula that expresses ^ (t) in terms of ^ (t 1)? Recursive Least Squares The LS estimate is given by ^ (t) = P (t) Xt i=1 '(i)y(i) + '(t)y(t)! P (t) = Xt i=1 '(i)'T (i)!1 P (t)1 = P (t 1)1 + '(t)'T (t) But Xt1 i=1 '(i)y(i) = P (t 1)1 ^ (t 1) = P (t)1 ^ (t 1) '(t)'T (t)^ (t 1) The estimate at time t can now be written as ^ (t) = ^ (t 1) P (t)'(t)'T (t)^ (t 1) + P (t)'(t)y(t) = ^ (t 1) + P (t)'(t) y(t) 'T (t)^ (t 1) = ^ (t 1) + K(t)"(t) Want recursive equation for P (t) not for P (t)1 c K. J. Åström and B. Wittenmark 4
Recursion for P(t) The mat rix inversio n lem ma gives The mat rix Inversion lemma Let A, C, and(C+ da B)be nonsingular P(t) y(l)9() i=1 square mat rices. then ∑)()+叫(ty"(t) (A+BCD A-1-A-B(C-1+DA-1B)-1DA-1 P(t-1)-1+y()9r(+) P(t-1)-P(t-1)(t Prove by direct substitution (I+92(t)P(t-1)(t)y2(t)P(t-1) Given a we can get the Lhs inverse Hence What about the inverse on the rhs? K(t=P(tp(t) =P(-1)p(t)(I+g7(t)P(t-1)() Recursive Least-squares rls Time-v ary ing paramet ers 6(t)=6(t-1)+K(t)(y(t)-y(t)(t-1) Loss funct io n wit h disco unting K(t)=P(tp(t) P(t-1)y(t)(I+p2(t)P(t-1)(t) v(,t)=∑x-(v(i)-f(i)2 P(t)=P(t-1)-P(t-1)p() (I+φ()P(t-1)(t)-p°(t)P(t-1) The ls estimate then becomes (I-K(t)y2(t)P(t-1) Intuitive int erpret at ion 6(t)=6(t-1)+K(t)(y(t)-yr(t)(t-1) k(t= P(tp(t) . Kalman filte I nterpret ation of 0 and P P(t-1)(t)(x+p(t)P(t-1)(t)-2 P(t)=(I-K(t)p(t+)P(t-1) C K. J. Ast ro m and B. Wittenmark
The Matrix Inversion Lemma Let A, C, and (C1 + DA1B) be nonsingular square matrices. Then (A + BCD)1 = A1 A1B(C1 + DA1B)1DA1 Prove by direct substitution Given A1 we can get the LHS inverse What about the inverse on the RHS? Recursion for P (t) The matrix inversion lemma gives P (t) = Xt i=1 '(i)'T (i)!1 = Xt1 i=1 '(i)' T (i) + '(t)' T (t)!1 = P (t 1)1 + '(t)'T (t)1 = P (t 1) P (t 1)'(t) I + 'T (t)P (t 1)'(t)1 'T (t)P (t 1) Hence K(t) = P (t)'(t) = P (t 1)'(t) I + 'T (t)P (t 1)'(t)1 Recursive Least-Squares RLS ^ (t) = ^ (t 1) + K(t)y(t) 'T (t)^ (t 1) K(t) = P (t)'(t) = P (t 1)'(t) I + 'T (t)P (t 1)'(t)1 P (t) = P (t 1) P (t 1)'(t) I + 'T (t)P (t 1)'(t)1 'T (t)P (t 1) = I K(t)'T (t)P (t 1) Intuitive interpretation Kalman lter Interpretation of and P Initial values (P (0) = r I ) Time-varying Parameters Loss function with discounting V (; t) = 1 2 X t i=1 ti y(i) ' T (i) 2 The LS estimate then becomes ^ (t) = ^ (t 1) + K(t)y(t) 'T (t)^ (t 1) K(t) = P (t)'(t) = P (t 1)'(t) I + 'T (t)P (t 1)'(t)1 P (t) = I K(t)'T (t) P (t 1) = c K. J. Åström and B. Wittenmark 5