Lecture 8 The Kalman filter

Similar documents
Probability and Random Variables. Generation of random variables (r.v.)

Understanding and Applying Kalman Filtering

Lecture 13 Linear quadratic Lyapunov theory

19 LINEAR QUADRATIC REGULATOR

Introduction to Kalman Filtering

1 Short Introduction to Time Series

Lecture 5 Least-squares

An Introduction to the Kalman Filter

Impulse Response Functions

EE 570: Location and Navigation

Real-Time Embedded Convex Optimization

Nonlinear Systems and Control Lecture # 15 Positive Real Transfer Functions & Connection with Lyapunov Stability. p. 1/?

7. LU factorization. factor-solve method. LU factorization. solving Ax = b with A nonsingular. the inverse of a nonsingular matrix

Kalman Filter Applied to a Active Queue Management Problem

LINES AND PLANES CHRIS JOHNSON

Kalman and Extended Kalman Filters: Concept, Derivation and Properties

WEB APPENDIX. Calculating Beta Coefficients. b Beta Rise Run Y X

Content. Professur für Steuerung, Regelung und Systemdynamik. Lecture: Vehicle Dynamics Tutor: T. Wey Date: , 20:11:52

Introduction to Time Series Analysis. Lecture 1.

Abstract: We describe the beautiful LU factorization of a square matrix (or how to write Gaussian elimination in terms of matrix multiplication).

8. Linear least-squares

CCNY. BME I5100: Biomedical Signal Processing. Linear Discrimination. Lucas C. Parra Biomedical Engineering Department City College of New York

Time Series and Forecasting

TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAA

LQG-Balanced Truncation Low-Order Controller for Stabilization of Laminar Flows

Dynamic data processing

Stability of the LMS Adaptive Filter by Means of a State Equation

Recent Results on Approximations to Optimal Alarm Systems for Anomaly Detection

Estimating an ARMA Process

The Bivariate Normal Distribution

Lecture 18: The Time-Bandwidth Product

General Framework for an Iterative Solution of Ax b. Jacobi s Method

3. Reaction Diffusion Equations Consider the following ODE model for population growth

SYSTEMS OF REGRESSION EQUATIONS

CONTROL SYSTEMS, ROBOTICS, AND AUTOMATION - Vol. V - Relations Between Time Domain and Frequency Domain Prediction Error Methods - Tomas McKelvey

ELECTRICITY REAL OPTIONS VALUATION

Trend and Seasonal Components

LS.6 Solution Matrices

Lecture notes: single-agent dynamics 1

Linear-Quadratic Optimal Controller 10.3 Optimal Linear Control Systems

Chapter 8 - Power Density Spectrum

Epipolar Geometry. Readings: See Sections 10.1 and 15.6 of Forsyth and Ponce. Right Image. Left Image. e(p ) Epipolar Lines. e(q ) q R.

Chapter 1. Vector autoregressions. 1.1 VARs and the identi cation problem

Solving Mass Balances using Matrix Algebra

Robust output feedbackstabilization via risk-sensitive control

Lecture 8: Signal Detection and Noise Assumption

Particle Filter-Based On-Line Estimation of Spot (Cross-)Volatility with Nonlinear Market Microstructure Noise Models. Jan C.

How To Find A Policy Search For A Program

Regression III: Advanced Methods

Multiple Linear Regression in Data Mining

ITSM-R Reference Manual

Solutions to Linear First Order ODE s

Stochastic Gradient Method: Applications

Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model

5.3 The Cross Product in R 3

min ǫ = E{e 2 [n]}. (11.2)

Econometrics Simple Linear Regression

Summary of Formulas and Concepts. Descriptive Statistics (Ch. 1-4)

Scott C. Douglas, et. Al. Convergence Issues in the LMS Adaptive Filter CRC Press LLC. <

IN this paper, we consider the detection of correlated random

Controller Design in Frequency Domain

MISSING DATA TECHNIQUES WITH SAS. IDRE Statistical Consulting Group

Vector Spaces; the Space R n

Covariance and Correlation

Signal processing tools for largescale network monitoring: a state of the art

State Space Models and Inverse FORM - A Review

Master s thesis tutorial: part III

Example: Credit card default, we may be more interested in predicting the probabilty of a default than classifying individuals as default or not.

IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 51, NO. 7, JULY G. George Yin, Fellow, IEEE, and Vikram Krishnamurthy, Fellow, IEEE

Analysis of Mean-Square Error and Transient Speed of the LMS Adaptive Algorithm

Exploratory Factor Analysis

Statistical machine learning, high dimension and big data

Time Series Analysis III

Computer exercise 2: Least Mean Square (LMS)

The Solow Model. Savings and Leakages from Per Capita Capital. (n+d)k. sk^alpha. k*: steady state Per Capita Capital, k

Differentiation of vectors

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

11. Time series and dynamic linear models

State Space Time Series Analysis

3 Signals and Systems: Part II

Linear Threshold Units

Interactive applications to explore the parametric space of multivariable controllers

IEOR 6711: Stochastic Models, I Fall 2012, Professor Whitt, Final Exam SOLUTIONS

Optimal linear-quadratic control

Background 2. Lecture 2 1. The Least Mean Square (LMS) algorithm 4. The Least Mean Square (LMS) algorithm 3. br(n) = u(n)u H (n) bp(n) = u(n)d (n)

Network quality control

Part 4 fitting with energy loss and multiple scattering non gaussian uncertainties outliers

SOLVING LINEAR SYSTEMS

7 Gaussian Elimination and LU Factorization

INDIRECT INFERENCE (prepared for: The New Palgrave Dictionary of Economics, Second Edition)

UNIVERSITY OF CALIFORNIA, SAN DIEGO Electrical & Computer Engineering Department ECE Fall 2010 Linear Systems Fundamentals

Time series Forecasting using Holt-Winters Exponential Smoothing

How to assess the risk of a large portfolio? How to estimate a large covariance matrix?

Microeconomic Theory: Basic Math Concepts

Kristine L. Bell and Harry L. Van Trees. Center of Excellence in C 3 I George Mason University Fairfax, VA , USA kbell@gmu.edu, hlv@gmu.

SIXTY STUDY QUESTIONS TO THE COURSE NUMERISK BEHANDLING AV DIFFERENTIALEKVATIONER I

Advanced Signal Processing and Digital Noise Reduction

Vehicle Tracking in Occlusion and Clutter

C21 Model Predictive Control

Lecture 7: Finding Lyapunov Functions 1

Transcription:

EE363 Winter 2008-09 Lecture 8 The Kalman filter Linear system driven by stochastic process Statistical steady-state Linear Gauss-Markov model Kalman filter Steady-state Kalman filter 8 1

Linear system driven by stochastic process we consider linear dynamical system x t+1 = Ax t + Bu t, with x 0 and u 0, u 1,... random variables we ll use notation x t = E x t, Σ x (t) = E(x t x t )(x t x t ) T and similarly for ū t, Σ u (t) taking expectation of x t+1 = Ax t + Bu t we have x t+1 = A x t + Bū t i.e., the means propagate by the same linear dynamical system The Kalman filter 8 2

now let s consider the covariance x t+1 x t+1 = A(x t x t ) + B(u t ū t ) and so Σ x (t + 1) = E (A(x t x t ) + B(u t ū t )) (A(x t x t ) + B(u t ū t )) T = AΣ x (t)a T + BΣ u (t)b T + AΣ xu (t)b T + BΣ ux (t)a T where Σ xu (t) = Σ ux (t) T = E(x t x t )(u t ū t ) T thus, the covariance Σ x (t) satisfies another, Lyapunov-like linear dynamical system, driven by Σ xu and Σ u The Kalman filter 8 3

consider special case Σ xu (t) = 0, i.e., x and u are uncorrelated, so we have Lyapunov iteration Σ x (t + 1) = AΣ x (t)a T + BΣ u (t)b T, which is stable if and only if A is stable if A is stable and Σ u (t) is constant, Σ x (t) converges to Σ x, called the steady-state covariance, which satisfies Lyapunov equation Σ x = AΣ x A T + BΣ u B T thus, we can calculate the steady-state covariance of x exactly, by solving a Lyapunov equation (useful for starting simulations in statistical steady-state) The Kalman filter 8 4

Example we consider x t+1 = Ax t + w t, with A = [ 0.6 0.8 0.7 0.6 ], where w t are IID N(0, I) eigenvalues of A are 0.6 ± 0.75j, with magnitude 0.96, so A is stable we solve Lyapunov equation to find steady-state covariance Σ x = [ 13.35 0.03 0.03 11.75 ] covariance of x t converges to Σ x no matter its initial value The Kalman filter 8 5

two initial state distributions: Σ x (0) = 0, Σ x (0) = 10 2 I plot shows Σ 11 (t) for the two cases 120 100 80 Σ11(t) 60 40 20 0 0 10 20 30 40 50 60 70 80 90 100 t The Kalman filter 8 6

(x t ) 1 for one realization from each case: (xt)1 (xt)1 15 10 5 0 5 10 15 0 10 20 30 40 50 60 70 80 90 100 15 10 5 0 5 10 15 0 10 20 30 40 50 60 70 80 90 100 t The Kalman filter 8 7

Linear Gauss-Markov model we consider linear dynamical system x t+1 = Ax t + w t, y t = Cx t + v t x t R n is the state; y t R p is the observed output w t R n is called process noise or state noise v t R p is called measurement noise v w x y C z 1 A The Kalman filter 8 8

Statistical assumptions x 0, w 0, w 1,..., v 0, v 1,... are jointly Gaussian and independent w t are IID with E w t = 0, E w t wt T = W v t are IID with Ev t = 0, Ev t vt T = V E x 0 = x 0, E(x 0 x 0 )(x 0 x 0 ) T = Σ 0 (it s not hard to extend to case where w t, v t are not zero mean) we ll denote X t = (x 0,..., x t ), etc. since X t and Y t are linear functions of x 0, W t, and V t, we conclude they are all jointly Gaussian (i.e., the process x, w, v, y is Gaussian) The Kalman filter 8 9

Statistical properties sensor noise v independent of x w t is independent of x 0,..., x t and y 0,..., y t Markov property: the process x is Markov, i.e., x t x 0,..., x t 1 = x t x t 1 roughly speaking: if you know x t 1, then knowledge of x t 2,..., x 0 doesn t give any more information about x t The Kalman filter 8 10

Mean and covariance of Gauss-Markov process mean satisfies x t+1 = A x t, Ex 0 = x 0, so x t = A t x 0 covariance satisfies Σ x (t + 1) = AΣ x (t)a T + W if A is stable, Σ x (t) converges to steady-state covariance Σ x, which satisfies Lyapunov equation Σ x = AΣ x A T + W The Kalman filter 8 11

Conditioning on observed output we use the notation ˆx t s = E(x t y 0,... y s ), Σ t s = E(x t ˆx t s )(x t ˆx t s ) T the random variable x t y 0,..., y s is Gaussian, with mean ˆx t s and covariance Σ t s ˆx t s is the minimum mean-square error estimate of x t, based on y 0,..., y s Σ t s is the covariance of the error of the estimate ˆx t s The Kalman filter 8 12

State estimation we focus on two state estimation problems: finding ˆx t t, i.e., estimating the current state, based on the current and past observed outputs finding ˆx t+1 t, i.e., predicting the next state, based on the current and past observed outputs since x t, Y t are jointly Gaussian, we can use the standard formula to find ˆx t t (and similarly for ˆx t+1 t ) ˆx t t = x t + Σ xt Y t Σ 1 Y t (Y t Ȳt) the inverse in the formula, Σ 1 Y t, is size pt pt, which grows with t the Kalman filter is a clever method for computing ˆx t t and ˆx t+1 t recursively The Kalman filter 8 13

Measurement update let s find ˆx t t and Σ t t in terms of ˆx t t 1 and Σ t t 1 start with y t = Cx t + v t, and condition on Y t 1 : y t Y t 1 = Cx t Y t 1 + v t Y t 1 = Cx t Y t 1 + v t since v t and Y t 1 are independent so x t Y t 1 and y t Y t 1 are jointly Gaussian with mean and covariance [ ] ˆxt t 1, Cˆx t t 1 [ Σt t 1 Σ t t 1 C T CΣ t t 1 CΣ t t 1 C T + V ] The Kalman filter 8 14

now use standard formula to get mean and covariance of which is exactly the same as x t Y t : (x t Y t 1 ) (y t Y t 1 ), ˆx t t = ˆx t t 1 + Σ t t 1 C T ( CΣ t t 1 C T + V ) 1 (yt Cˆx t t 1 ) Σ t t = Σ t t 1 Σ t t 1 C T ( CΣ t t 1 C T + V ) 1 CΣt t 1 this gives us ˆx t t and Σ t t in terms of ˆx t t 1 and Σ t t 1 this is called the measurement update since it gives our updated estimate of x t based on the measurement y t becoming available The Kalman filter 8 15

Time update now let s increment time, using x t+1 = Ax t + w t condition on Y t to get x t+1 Y t = Ax t Y t + w t Y t = Ax t Y t + w t since w t is independent of Y t therefore we have ˆx t+1 t = Aˆx t t and Σ t+1 t = E(ˆx t+1 t x t+1 )(ˆx t+1 t x t+1 ) T = E(Aˆx t t Ax t w t )(Aˆx t t Ax t w t ) T = AΣ t t A T + W The Kalman filter 8 16

Kalman filter measurement and time updates together give a recursive solution start with prior mean and covariance, ˆx 0 1 = x 0, Σ 0 1 = Σ 0 apply the measurement update ˆx t t = ˆx t t 1 + Σ t t 1 C T ( CΣ t t 1 C T + V ) 1 (yt Cˆx t t 1 ) Σ t t = Σ t t 1 Σ t t 1 C T ( CΣ t t 1 C T + V ) 1 CΣt t 1 to get ˆx 0 0 and Σ 0 0 ; then apply time update ˆx t+1 t = Aˆx t t, Σ t+1 t = AΣ t t A T + W to get ˆx 1 0 and Σ 1 0 now, repeat measurement and time updates... The Kalman filter 8 17

Riccati recursion we can express measurement and time updates for Σ as Σ t+1 t = AΣ t t 1 A T + W AΣ t t 1 C T (CΣ t t 1 C T + V ) 1 CΣ t t 1 A T which is a Riccati recursion, with initial condition Σ 0 1 = Σ 0 Σ t t 1 can be computed before any observations are made thus, we can calculate the estimation error covariance before we get any observed data The Kalman filter 8 18

Comparison with LQR in LQR, Riccati recursion for P t (which determines the minimum cost to go from a point at time t) runs backward in time we can compute cost-to-go before knowing x t in Kalman filter, Riccati recursion for Σ t t 1 (which is the state prediction error covariance at time t) runs forward in time we can compute Σ t t 1 before we actually get any observations The Kalman filter 8 19

Observer form we can express KF as ˆx t+1 t = Aˆx t t 1 + AΣ t t 1 C T (CΣ t t 1 C T + V ) 1 (y t Cˆx t t 1 ) = Aˆx t t 1 + L t (y t ŷ t t 1 ) where L t = AΣ t t 1 C T (CΣ t t 1 C T + V ) 1 is the observer gain ŷ t t 1 is our output prediction, i.e., our estimate of y t based on y 0,..., y t 1 e t = y t ŷ t t 1 is our output prediction error Aˆx t t 1 is our prediction of x t+1 based on y 0,..., y t 1 our estimate of x t+1 is the prediction based on y 0,..., y t 1, plus a linear function of the output prediction error The Kalman filter 8 20

Kalman filter block diagram v t w t x t y t C z 1 A L t e t z 1 ˆx t t 1 C ŷ t t 1 A ˆx t t 1 The Kalman filter 8 21

Steady-state Kalman filter as in LQR, Riccati recursion for Σ t t 1 converges to steady-state value ˆΣ, provided (C, A) is observable and (A, W) is controllable ˆΣ gives steady-state error covariance for estimating x t+1 given y 0,..., y t note that state prediction error covariance converges, even if system is unstable ˆΣ satisfies ARE ˆΣ = AˆΣA T + W AˆΣC T (C ˆΣC T + V ) 1 C ˆΣA T (which can be solved directly) The Kalman filter 8 22

steady-state filter is a time-invariant observer: ˆx t+1 t = Aˆx t t 1 + L(y t ŷ t t 1 ), ŷ t t 1 = Cˆx t t 1 where L = AˆΣC T (C ˆΣC T + V ) 1 define state estimation error x t t 1 = x t ˆx t t 1, so and y t ŷ t t 1 = Cx t + v t Cˆx t t 1 = C x t t 1 + v t x t+1 t = x t+1 ˆx t+1 t = Ax t + w t Aˆx t t 1 L(C x t t 1 + v t ) = (A LC) x t t 1 + w t Lv t The Kalman filter 8 23

thus, the estimation error propagates according to a linear system, with closed-loop dynamics A LC, driven by the process w t LCv t, which is IID zero mean and covariance W + LV L T provided A, W is controllable and C, A is observable, A LC is stable The Kalman filter 8 24

Example system is with x t R 6, y t R x t+1 = Ax t + w t, y t = Cx t + v t we ll take Ex 0 = 0, Ex 0 x T 0 = Σ 0 = 5 2 I; W = (1.5) 2 I, V = 1 eigenvalues of A: 0.9973 ± 0.0730j, 0.9995 ± 0.0324j, 0.9941 ± 0.1081j (which have magnitude one) goal: predict y t+1 based on y 0,..., y t The Kalman filter 8 25

first let s find variance of y t versus t, using Lyapunov recursion Ey 2 t = CΣ x (t)c T + V, Σ x (t + 1) = AΣ x (t)a T + W, Σ x (0) = Σ 0 18000 16000 14000 12000 Ey 2 t 10000 8000 6000 4000 2000 0 0 20 40 60 80 100 120 140 160 180 200 t The Kalman filter 8 26

now, let s plot the prediction error variance versus t, Ee 2 t = E(ŷ t t 1 y t ) 2 = CΣ t t 1 C T + V, where Σ t t 1 satisfies Riccati recursion, initialized by Σ 1 2 = Σ 0, Σ t+1 t = AΣ t t 1 A T + W AΣ t t 1 C T (CΣ t t 1 C T + V ) 1 CΣ t t 1 A T 20.5 20 19.5 E e 2 t 19 18.5 18 17.5 17 0 20 40 60 80 100 120 140 160 180 200 prediction error variance converges to steady-state value 18.7 t The Kalman filter 8 27

now let s try the Kalman filter on a realization y t top plot shows y t ; bottom plot shows e t (on different vertical scale) 300 200 100 yt 0 100 200 300 0 20 40 60 80 100 120 140 160 180 200 30 20 10 t et 0 10 20 30 0 20 40 60 80 100 120 140 160 180 200 t The Kalman filter 8 28