26
Estimation and the Kalman Filter David Johnson

Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Estimation and the Kalman Filter

David Johnson

Page 2: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

The Mean of a Discrete Distribution

• “I have more legs than average”

Page 3: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Gaussian Definition

-

Univariate

Multivariate

2

2)(

2

1

2

2

1)(

:),(~)(

x

exp

Nxp

)()(2

1

2/12/

1

)2(

1)(

:)(~)(

μxΣμx

Σx

Σμx

t

ep

,Νp

d

Page 4: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Back to the non-evolving case

• Two different processes measure the same thing

• Want to combine into one better measurement

• Estimation

Page 5: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Estimation

What is meant by estimation?

Data + noise

Data + noise

Data + noise

Estimator Estimation

Hz ŷStochastic process estimate

Page 6: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

A Least-Squares Approach

• We want to fuse these measurements to obtain a new estimate for the range

• Using a weighted least-squares approach, the resulting sum of squares error will be

• Minimizing this error with respect to yields

222

111

),0(

),0(

vrRNrz

vrRNrz

n

iii zrwe

1

2)ˆ(

0)ˆ(2)ˆ(ˆˆ 11

2

n

iii

n

iii zrwzrw

rr

e

Page 7: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

A Least-Squares Approach• Rearranging we have

• If we choose the weight to be

we obtain

0ˆ11

n

iii

n

ii zwrw

n

ii

n

iii

w

zwr

1

iii Rw

112

221

11

21

2

21

2

2

1

1

11ˆ z

RR

Rz

RR

R

RR

Rz

Rz

r

Page 8: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

• For merging Gaussian distributions, the update rule is

A Least-Squares Approach

22

21

22

212

322

21

22

21

22

21

23

111

Show for N(0,a) N(0,b)

Page 9: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

What happens when you move?

),(~),(~ 22

2

abaNYbaXY

NX

derive

Page 10: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Moving

• As you move– Uncertainty grows– Need to make new measurements– Combine measurements using Kalman gain

Page 11: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

The Kalman Filter

“an optimal recursive data processing algorithm”

OPTIMAL:-Linear dynamics-Measurements linear w/r to state-Errors in sensors and dynamics must be zero-mean (un-bias) white Gaussian

RECURSIVE:-Does not require all previous data-Incoming measurements ‘modify’ current estimate

DATA PROCESSING ALGORITHM:The Kalman filter is essentially a technique of estimation given a system model and concurrent measurements

(not a function of frequency)

Page 12: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

The Discrete Kalman Filter

Estimate the state of a discrete-time controlled process that is governed by the linear stochastic difference equation:

with a measurement:

The random variables wk and vk represent the process and measurement noise (respectively). They are assumed to be independent (of each other), white, and with normal probability distributions

In practice, the process noise covariance and measurement noise covariancematrices might change with each time step or measurement.

(PDFs)

Page 13: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

The Discrete Kalman Filter

First part – model forecast: prediction

“prior” estimate

Process noisecovariance

Statetransition

Stateprediction

Error covarianceprediction

Controlsignal

Prediction is based only the model of the system dynamics.

Page 14: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

The Discrete Kalman Filter

Second part – measurement update: correction

“posterior” estimate

statecorrection

“prior” stateprediction

Kalmangain

actualmeasurement

predictedmeasurement

update error covariance matrix (posterior)

Page 15: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

The Discrete Kalman Filter

The Kalman gain, K: “Do I trust my model or measurements?”

RHPH

HPK

Tk

Tk

k

variance of the predicted states= ------------------------------------------------------------

variance of the predicted + measured states

measurement sensitivity matrix

measurementnoise covariance

As measurement error covariance, R, approaches zero, the actual measurement, zk is “trusted” more and more. is trusted less and less

But, as the “prior” (predicted) estimate error covariance, P, approaches zero, the actual measurement is trusted less, and predicted measurement, is trusted more and more

Page 16: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Estimate a constant voltage

• Measurements have noise

• Update step is

• Measurement step is

Page 17: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Results

Page 18: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Variance

Page 19: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Parameter tuning

Page 20: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

More tuning

Page 21: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

• The Extended Kalman (EKF) is a sub-optimal extension of the original KF algorithm• The EKF allows for estimation of non-linear processes or measurement relationships• This is accomplished by linearizing the current mean and covariance estimates

(similar to a first order Taylor series approximation)• Suppose our process and measurement equations are the non-linear functions

The Extended Kalman Filter (EKF)

),(

),,(1

kkk

kkkk

vxhz

wuxfx

kkk

kkkk

vxHz

wuBxAx

1

Kalman Filter Extended Kalman Filter

Page 22: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Linearity Assumption Revisited

Page 23: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

Non-linear Function

Page 24: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

EKF Linearization (1)

Page 25: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

EKF Linearization (2)

Page 26: Estimation and the Kalman Filter David Johnson. The Mean of a Discrete Distribution “I have more legs than average”

EKF Linearization (3)