exam 2015 - eth zürich - homepage | eth zürich

22
Final Exam 3 August 2015 Recursive Estimation (151-0566-00) R. D’Andrea Solutions Exam Duration: 150 minutes Number of Problems: 7 Permitted aids: Two one-sided A4 pages. Use only the provided solution sheets for your solutions. Do not write on the problem descriptions.

Upload: others

Post on 16-Oct-2021

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam 3 August 2015

Recursive Estimation (151-0566-00) R. D’Andrea

Solutions

Exam Duration: 150 minutes

Number of Problems: 7

Permitted aids: Two one-sided A4 pages.

Use only the provided solution sheets for your solutions.

Do not write on the problem descriptions.

Page 2: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 2 Final Exam – Recursive Estimation

Problem 1 8 Points

For each of the statements below, state whether they are True or False. If the statement is False,you must provide a (brief) explanation or counter-example.For four or fewer correct answers, you receive zero points. For each correct answer in excess offour, you receive two points.

a) “For any given dynamic system, a particle filter with a finite, but sufficiently large numberof particles will provide a better estimate than a Kalman filter.”

b) “For any given linear system, the Kalman filter provides an exact estimate of the state’sconditional mean and variance.”

c) “For any given linear, time-invariant system, any stable, linear, time-invariant state ob-server combined with any stabilizing, linear, time-invariant state-feedback controller willresult in a stable closed-loop system.”

d) “For any given linear system, the Kalman filter is (among the class of linear, unbiasedestimators) the estimator that minimizes the mean squared error.”

e) “For any given conditional probability density function of a continuous random variable,the maximum likelihood estimate is unique.”

f) “For any given conditional probability density function of a continuous random variable,the minimum mean squared error estimate is unique.”

g) “An associated steady-state Kalman filter exists only if a linear, time invariant system isobservable.”

h) “If two random variables are independent, they are also conditionally independent whenconditioned on a third random variable.”

Page 3: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 3

Solution 1

a) False. For a linear system with Gaussian noise and Gaussian initial value distribution theKalman filter provides an exact estimate while the particle filter is only an approximation.b) False. The Kalman filter only provides an exact estimate if the noise and initial valuedistribution are Gaussian.c) True.d) True.e) False. For example, for a bi-modal distribution with equal peaks the maximum likelihoodestimate will contain both peaks.f) True.g) False. Detectable systems may also have steady-state Kalman filters, consider the unobserv-able system x(k) = 0.5x (k − 1) + v(k− 1) with measurement z(k) = 0 where v(k− 1) is processnoise with the usual assumptions.h) False. Let x and y be independent, and define z = x+ y. Conditioned on z, x and y are nolonger independent.

Page 4: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 4 Final Exam – Recursive Estimation

Problem 2 11 Points

a) Show that for any discrete random variables a, b, and c the following properties hold

A1) E [a(b+ c)] = E [ab] + E [ac]

A2) E [ab] = E [ba]

A3) E[a2]≥ 0

A4) E[a2]

= 0 if and only if a = 0 with probability one.

(4 points)

Given is the joint probability density function of the continuous random variables x ∈ [0, 1],y ∈ [0, 1]:

fxy(x, y) := cx2y,

where c is a positive constant.

b) Determine the value of c. (1 point)

c) Calculate the probability density functions fx and fy. Are x and y independent?

(2 points)

d) Let the random variable w be defined by w := log y, where log denotes the natural loga-rithm. Calculate the probability density function fw. (1 point)

e) Let the random variable z be defined by z := x + y2. Calculate the probability densityfunction fz. (3 points)Hint: Calculate the probability density function fz|x first.

Page 5: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 5

Solution 2

a) A1) By definition

E [a(b+ c)] =∑a∈A

∑b∈B

∑c∈C

a(b+ c)fabc(a, b, c)

=∑a∈A

∑b∈B

∑c∈C

abfabc(a, b, c) +∑a∈A

∑b∈B

∑c∈C

acfabc(a, b, c)

=∑a∈A

∑b∈B

abfab(a, b) +∑a∈A

∑c∈C

acfac(a, c)

= E [ab] + E [ac] .

A2) This follows immediately from the definition:

E [ab] =∑a∈A

∑b∈B

abfab(a, b) =∑b∈B

∑a∈A

bafab(a, b) = E [ba] .

A3) To be a valid probability density function, the PDF of the discrete random variable a ∈ Asatisfies fa(a) ≥ 0, ∀a ∈ A. Thus, a2fa(a) ≥ 0,∀a ∈ A and by the law of the unconsciousstatistician,

E[a2]

=∑a∈A

a2fa(a) ≥ 0.

A4)“⇒” Suppose E[a2]

= 0 holds. This implies that fa(a) = 0, ∀a ∈ A \ {0}. From∑a∈A fa(a) = 1 it follows that fa(0) = 1, that is, a = 0 with probability one.

“⇐” Consider the random variable with fa(a) = 1 for a = 0 and fa(a) = 0 otherwise. Thisimplies that

E[a2]

=∑a∈A

a2fa(a) = 0.

(4 points)

b) The probability density function needs to integrate up to one, and since x ∈ [0, 1], y ∈ [0, 1]we have that

1 =

∫ 1

0

∫ 1

0fxy(x, y)dxdy =

∫ 1

0

∫ 1

0cx2ydxdy = c

1

6.

This implies that c = 6. (1 point)

c) The PDF of x and y are obtained by

fx(x) =

∫ 1

0fxy(x, y)dy =

∫ 1

06x2ydy =

{3x2 x ∈ [0, 1]

0 otherwise

fy(y) =

∫ 1

0fxy(x, y)dx =

∫ 1

06x2y dx =

{2y y ∈ [0, 1]

0 otherwise.

The random variables x and y are independent because fxy(x, y) = fx(x)fy(y).

(2 points)

Page 6: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 6 Final Exam – Recursive Estimation

d) Applying the change of variables formula yields

fw(w) =fy(exp w)

(exp w)−1 =

{2 exp 2w exp w ∈ [0, 1]

0 otherwise

=

{2 exp 2w w ∈ (−∞, 0]

0 otherwise.

(1 point)e) We do the change of variables in two steps. First we calculate fz|x. Then we invoke marginal-ization to calculate fz(z) as

fz(z) =

∫ 1

0fz|x(z|x)fx(x)dx.

For a fixed x we define z = g(y) := x+ y2. Therefore by the change of variables formula,

fz|x(z|x) =fy|x(g−1(z)|x)dgdy (g−1(z))

. (1)

Independence of the random variables x and y yields

fy|x(y|x) = fy(y) =

∫ 1

0fxy(x, y)dx =

{2y y ∈ [0, 1]

0 otherwise.(2)

Moreover, the denominator of (1) can be simplified to

dg

dy(g−1(z)) = 2g−1(z) = 2

√z − x.

Therefore, combining equations (1) and (2) yields

fz|x(z|x) =

{1√z − x ∈ [0, 1]

0 otherwise

=

{1 z − x ∈ [0, 1]

0 otherwise.

Moreover, we have that

fx(x) =

∫ 1

0fxy(x, y)dy =

{3x2 x ∈ [0, 1]

0 otherwise.

Thus, marginalization yields

fz(z) =

∫ 1

0fz|x(z|x)fx(x)dx

=

{∫ z0 3x2dx 0 ≤ z ≤ 1∫ 1z−1 3x2dx 1 ≤ z ≤ 2.

Solving the two integrals results in

fz(z) =

{z3 0 ≤ z ≤ 1

1− (z − 1)3 1 ≤ z ≤ 2.

(1 point for correct change of variables, calculation of fz|x),(1 point for marginalization),(1 point for correct calculation of the integrals).

Page 7: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 7

Problem 3 10 Points

Consider a particle moving on the corners of an equilateral triangle. The corners of the triangleare denoted by {1, 2, 3}. If the particle is located at corner 1 at time instant k, its state x(k)takes the value 1. Similarly, if the particle is located at corner 2 or 3 at time instant k, its statex(k) takes the value 2 or 3, respectively. From one time step to the next the particle can eithermove clockwise, counterclockwise, or stay at its position. The particle moves counterclockwisewith probability 1/4, clockwise with probability 1/2, and does not move at all with probability1/4.The process dynamics are illustrated by the following graph

3

1 2

0.50.25

0.25

0.5

0.25

0.250.5

0.250.25

where the edge weights represent the transition probabilities.

a) Assume that x(0) = 1. Calculate the probability density function of x(1) and x(2).

(2 points)

For parts b)-d): Assume that fx(0) is unknown. Let the vector a(k) ∈ R3 be defined by

a(k) =

fx(k)(1)

fx(k)(2)

fx(k)(3)

.

b) Show that the following relationship holds

a(k) = Aa(k − 1),

where A ∈ R3×3, i.e. show that the probability density function fx(k) depends linearly onfx(k−1). Determine the elements of the matrix A. (3 points)

c) Using the result from b), derive a formula for fx(k) as a function of a(0) and A. (1 point)

d) Calculate fx(27), given that x(0) is uniformly distributed. Justify your answer. (1 point)

The exercise continues on the next page.

Page 8: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 8 Final Exam – Recursive Estimation

For part e): Measurements z(k) of the state x(k) are obtained. The measurement z(k) is exact(i.e. z(k) = x(k)) with probability 1/2, and it takes the value of a neighboring corner withprobability 1/4. For instance, if x(k) = 1 then z(k) = 1 with probability 1/2, z(k) = 2 withprobability 1/4, and z(k) = 3 with probability 1/4.Assume that at time instant k = 10 the probability density function of x is given by

fx(10)(x) =

1/6 x = 1

1/3 x = 2

1/2 x = 3.

e) Given that the measurement z(10) = 1 is observed, calculate the probability density func-tion fx(10)|z(10)(x|1), with x ∈ {1, 2, 3}. (3 points)

Page 9: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 9

Solution 3

a) The initial condition x(0) = 1 is given, and therefore we have that

fx(1)(1) = 0.25, fx(1)(2) = 0.25, fx(1)(3) = 0.5.

Invoking the marginalization rule it follows that

fx(2)(x) =3∑y=1

fx(2)|x(1)(x|y)fx(1)(y).

This yields

fx(2)(1) = fx(2)|x(1)(1|1)fx(1)(1) + fx(2)|x(1)(1|2)fx(1)(2) + fx(2)|x(1)(1|3)fx(1)(3)

= 0.25 · 0.25 + 0.5 · 0.25 + 0.25 · 0.5 =5

16

and likewise

fx(2)(2) = 0.25 · 0.25 + 0.25 · 0.25 + 0.5 · 0.5 =3

8

fx(2)(3) = 0.25 · 0.5 + 0.5 · 0.25 + 0.25 · 0.25 =5

16.

(1 point for fx(1), 1 point for fx(2))

b) We introduce the matrix A ∈ R3×3, containing the elements

Aij = fx(k)|x(k−1)(i, j), i = 1, 2, 3, j = 1, 2, 3.

Inserting the values from the problem statement yields

A =

0.25 0.5 0.250.25 0.25 0.50.5 0.25 0.25

.

Using the total probability theorem we can rewrite fx(k)(x) as

fx(k)(x) =

3∑y=1

fx(k)|x(k−1)(x|y)fx(k−1)(y) =

3∑y=1

Axyfx(k−1)(y), x = 1, 2, 3,

which can be interpreted as matrix vector multiplication. This yields a(k) = Aa(k − 1), asrequired. (3 points)

c) We have a(k) = Aa(k − 1) = A2a(k − 2) = · · · = Aka(0). (1 point)

d) In the case that x(0) is uniformly distributed we have that a(0) = (1/3, 1/3, 1/3)T.This is an eigenvector of the matrix A with corresponding eigenvalue 1, which implies thata(27) = A27a(0) = a(0). Thus fx(27)(x) = 1/3 for x = 1, 2, 3. (1 point)

Page 10: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 10 Final Exam – Recursive Estimation

e) Applying Bayes theorem yields

fx(10)|z(10)(x|1) =fz(10)|x(10)(1|x)fx(10)(x)∑3x=1 fz(10)|x(10)(1|x)fx(10)(x)

.

(1 point)From the problem statement we can infer that

fz(10)|x(10)(1|1) = 1/2, fz(10)|x(10)(1|2) = 1/4, fz(10)|x(10)(1|3) = 1/4.

This implies that

fx(10)|z(10)(1|1) = C · 1/12, fx(10)|z(10)(2|1) = C · 1/12, fx(10)|z(10)(3|1) = C · 1/8,

where C is a normalization constant. (1 point)In order for fx(10)|z(10)(x|1) to be a valid probability density function, it must sum up to one,which implies

3∑x=1

fx(10)|z(10)(x|1) = C7

24= 1.

Hence, C = 24/7 and

fx(10)|z(10)(1|1) = 2/7, fx(10)|z(10)(2|1) = 2/7, fx(10)|z(10)(3|1) = 3/7.

(1 points)

Page 11: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 11

Problem 4 9 Points

Make sure that you define the random variables used in your solution clearly. (2 points)

The endangered butterfly species “Iphiclides maximus” has roughly 1000 individuals, and 200of them have a disease. The disease occurs in two different variants, called V 1 and V 2. Outof the 200 individuals suffering from the disease, 100 of them are infected with variant V 1, and100 are infected with V 2.In order to detect whether an individual is sick, two tests (test A and test B) can be carriedout. Test A has a success rate of detecting sick individuals from group V 1 of 9/10, and a successrate of 8/10 when detecting butterflies infected by V 2. Test B has a success rate of 1/8 fordetecting individuals infected by V 1 and 3/4 for detecting individuals infected by V 2. Theprobability that a healthy butterfly is erroneously diagnosed to be sick by test A (referred to asfalse positive) is 1/10.Test A and test B are conditionally independent and butterflies are selected at random.

a) What is the probability that a butterfly is diagnosed to be sick by test A? (2 points)

b) Given that a butterfly is sick, what is the probability that it is diagnosed as such by test B?

(4 points)

The disease is highly contagious, and to guarantee the continued existence of the species, bi-ologists would like to isolate and kill the sick individuals. To minimize the amount of killedindividuals, a butterfly is only killed if both test A and test B indicate that it is sick.

c) Given that the biologists would like to keep the probability that a healthy individual iskilled below 5%, what is the maximum allowable false positive rate of test B? (1 point)

Page 12: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 12 Final Exam – Recursive Estimation

Solution 4

An individual is either sick and affected by V 1, V 2, or is healthy. We use the random variable Ito describe an average butterfly. The random variable I takes the values {V 1, V 2, H}, H denotesa healthy butterfly. The random variable A describes the outcome of test A, and takes the value1 if the individual is diagnosed to be sick and 0 otherwise. Likewise, the random variable Bdescribes the outcome of the test B, and takes the value 1 if a butterfly is diagnosed to be sickand 0 otherwise. From the problem setting we infer the following properties:

Pr (I = V 1) =100

1000, Pr (I = V 2) =

100

1000, Pr (I = H) = 1− 200

1000,

together with

Pr (A = 1|I = V 1) = 9/10, Pr (B = 1|I = V 1) = 1/8

Pr (A = 1|I = V 2) = 8/10, Pr (B = 1|I = V 2) = 3/4

Pr (A = 1|I = H) = 1/10, Pr (B = 1|I = H) = α,

where the parameter α, with 0 ≤ α ≤ 1, is the unknown false positive rate of test B.

(2 points for parsing the problem setting)

a) Invoking the total probability theorem yields

Pr (A = 1) = Pr (A = 1|I = V 1) Pr (I = V 1) + Pr (A = 1|I = V 2) Pr (I = V 2)

+ Pr (A = 1|I = H) Pr (I = H)

=9

10

1

10+

8

10

1

10+

1

10

4

5

=9 + 16

100=

1

4.

(1 points total probability theorem, 1 point correct answer)

b) We introduce the abbreviation V = V 1 ∨ V 2 to simplify notation, that is I ∈ V if theindividual is sick. We are asked to calculate Pr (B = 1|I = V ), which can be expanded to

Pr (B = 1|I = V ) =Pr (I = V |B = 1) Pr (B = 1)

Pr (I = V )=

(1− Pr (I = H|B = 1))Pr (B = 1)

Pr (I = V ). (3)

Applying Bayes theorem a second time we get for Pr (I = H|B = 1)

Pr (I = H|B = 1) =Pr (B = 1|I = H) Pr (I = H)

Pr (B = 1). (4)

Combining (3) and (4) results in

Pr (B = 1|I = V ) =Pr (B = 1)− Pr (B = 1|I = H) Pr (I = H)

Pr (I = V ).

Using marginalization of Pr (B = 1) yields

Pr (B = 1|I = V ) =Pr (B = 1|V 1) Pr (V 1) + Pr (B = 1|V 2) Pr (V 2)

Pr (I = V ),

Page 13: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 13

where the abbreviation Pr (I = X) = Pr (X) with X = V 1, V 2 has been used. Inserting thedata from the problem setting leads to

Pr (B = 1|I = V ) =110

18 + 1

1034

15

=7

16.

(2 points for applying Bayes theorem twice, 1 point for correct formula ofPr (B = 1|I = V ), 1 point for correct answer)

Alternative Solution: We introduce the random variable S, where S = 1 if the butterfly issick (suffering from V 1 or V 2) and S = 0 if the butterfly is healthy. Marginalization yields

Pr (B = 1|S = 0) =∑

v∈{H,V 1,V 2}

Pr (B = 1, I = v|S = 0)

=∑

v∈{H,V 1,V 2}

Pr (B = 1|I = v, S = 0) Pr (I = v|S = 0)

=∑

v∈{V 1,V 2}

Pr (B = 1|I = v) Pr (I = v|S = 0) .

With Pr (I = V 1|S = 0) = Pr (I = V 2|S = 0) = 1/2, this results in

Pr (B = 1|S = 0) =1

8

1

2+

3

4

1

2=

7

16.

d) The probability that a healthy individual is killed is given by Pr (A = 1, B = 1|I = H). Sincetest A and test B are conditional independent, it follows that

Pr (A = 1, B = 1|I = H) = Pr (A = 1|I = H) Pr (B = 1|I = H) .

The requirement that Pr (A = 1, B = 1|I = H) ≤ 1/20 results therefore in

α1

10≤ 1

20

Thus, the maximum allowable false positive rate is α = 1/2.(1 point)

Page 14: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 14 Final Exam – Recursive Estimation

Problem 5 8 Points

Consider the following dynamic system, which models the movement of an object. Thestate x(k) ∈ R2 is driven by the scalar process noise v(k) ∼ N (0, 1), where N (γ,Γ) denotesa Gaussian distribution with mean γ and variance Γ. The noise values {v(·)} are mutuallyindependent. The time index is denoted by k = 0, 1, 2, . . .

The component x1(k) of the state is the object’s position, and the component x2(k) is theobject’s velocity, so that

x(k) =

[x1(k)x2(k)

].

The system dynamics are

x(k) =

[1 0.10 1

]x(k − 1) +

[01

]v(k − 1).

The object’s initial position is known to be exactly x1(0) = 0, i.e. with zero variance. The initialvelocity is known to be random and independent of {v(·)}.

a) Assume the initial velocity has a Gaussian distribution x2(0) ∼ N (2, 1). Compute theprobability density function (PDF) of the object’s state at time k = 1. (3 points)

b) Assume instead that the initial velocity is uniformly distributed with x2(0) ∈ [0, 2].Compute the mean and variance of the object’s state at time k = 1. (3 points)

For part c): at time k = 100, the object’s a priori state is randomly distributed as x(100) ∼N (µ,Σ) where

µ =

[12

]Σ =

[2 11 4

].

A measurement z(k) then becomes available, related to the state as below:

z(k) =[1 0

]x(k) + w(k),

where w(k) ∼ N (0, 1) is a measurement noise, and is independent of both {v(·)} and x(0). Themeasurement at k = 100 is z(100) = 0.

c) Compute the a posteriori mean of the object’s state at time k = 100, using thismeasurement. (2 points)

Page 15: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 15

Solution 5

a) First, we notice that all random variables in the problem are Gaussian, and that the dynamicsare linear. This means that the state x(1) is also Gaussian, so we only need to compute its meanand variance to fully determine the PDF.

We can compute these directly using the usual Kalman filter equations. We define the usualvariables xp(k), xm(k), Pp(k) and Pp(k). The filter is initialised with

xm(0) =

[02

]Pm(0) =

[0 00 1

].

The system matrices follow directly from the description, and the process noise variance Q is

Q =

[0 00 1

].

The prior update yields

xp(1) = Axm(0)

=

[1 0.10 1

] [02

]=

[0.22

],

(1 point)

Pp(1) = APm(0)AT +Q

=

[1 0.10 1

] [0 00 1

] [1 0

0.1 1

]+

[0 00 1

]=

[0.01 0.10.1 2

].

(1 point)

The distribution is then x(1) ∼ N (xp(1), Pp(1)). (1 point)

b) Because the system is linear, the mean and variance can be computed directly from thedynamics equation. First, we compute the mean velocity, which is E[x2(0) = 1]

E[x(1)] = E[Ax(0) + v(0)] = AE[x(0)] + E[v(0)] = AE[x(0)]

=

[1 0.10 1

] [01

]=

[0.11

].

(1 point)

Page 16: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 16 Final Exam – Recursive Estimation

Next we will compute the variance. The initial variance of the velocity follows as below, wherewe substitute 1

2 for the PDF of x1(0) over the integration interval.

Var[x1(0)] = E[x1(0)2

]− E [x1(0)]2

=

2∫0

x1(0)2

(1

2

)dx1(0)− 12

=1

3

(1 point)From this follows

Pm(0) =

[0 00 1

3

]and

Pp(1) = APm(0)AT +Q

=

[1 0.10 1

] [0 00 1

3

] [1 0

0.1 1

]+

[0 00 1

]=

[1/300 1/301/30 4/3

].

(1 point)c) Again all random variables in the problem are Gaussian, and the measurement equation islinear: this means we can use the tools of the Kalman filter to compute this. We will neglectthe time index (100) throughout this solution, as all variables used share the same time index.First, we compute the Kalman filter gain K:

K = PpHT(HPpH

T +R)−1

=

[2 11 4

] [10

]([1 0

] [2 11 4

] [10

]+ 1

)−1

=

[2/31/3

](1 point)

The mean estimate then follows as

xm = xp +K (z −Hxp)

=

[1/35/3

].

(1 point)

Page 17: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 17

Problem 6 6 Points

You are to design a state estimator for a scalar system with state x(k). You are given thesedynamic equations to use:

x(k) = x(k − 1) + v(k − 1) with v(k) ∼ N (0, 1)

x(0) ∼ N (0, 1) ,

where N (0,Γ) denotes a zero-mean Gaussian distribution with variance Γ, and k = 0, 1, 2, . . .denotes a time index. The system measurement equation is

z(k) = x(k) + w(k) with w(k) ∼ N (0, 6) .

The values x(0), {v(·)}, and {w(·)} are mutually independent.

a) Show that the steady-state Kalman filter gain is K∞ = 13 . (3 points)

For part b): the true system dynamics differ from the ones used to derive the estimator, andare given by

xtrue(k) = (1 + δ)xtrue(k − 1) + v(k − 1) with v(k) ∼ N (0, 1)

z(k) = xtrue(k) + w(k) with w(k) ∼ N (0, 6)

where δ ∈ R is a scalar constant. Define the estimation error as e(k) := xtrue(k)− x(k), where xis the estimate at time k of your steady-state Kalman filter, as computed in part a).

b) For δ = −12 will the error e(k) remain bounded as k tends to infinity? Justify your answer.

(3 points)

Page 18: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 18 Final Exam – Recursive Estimation

Solution 6

a) We first compute the steady-state variance, where below the system matrices have their usualmeanings.

P∞ = AP∞AT +Q−AP∞HT

(HP∞H

T +R)−1

HP∞AT

= P∞ + 1− P 2∞

P∞ + 6

(1 Point)From this follows 0 = P 2

∞ − P∞ − 6 and thus P∞ = 3 or P∞ = −2. (1 Point)We know that only non-negative solutions make sense, so we conclude P∞ = 3. (1 Point)We can now compute the steady-state gain as

K∞ = P∞HT(HP∞H

T +R)−1

=3

9=

1

3.

b) We first write the dynamic equations for the true system state, and the filter state:

xtrue(k + 1) = (1 + δ)xtrue(k) + v(k)

=1

2xtrue(k) + v(k)

x(k + 1) = (1−K∞H)Ax(k) +K∞z(k + 1)

=2

3x(k) +

1

3xtrue(k + 1) +

1

3w(k + 1)

We now compute the error dynamics, and substitute the above:

e(k + 1) = xtrue(k + 1)− x(k + 1)

=2

3xtrue(k + 1)− 2

3x(k)− 1

3w(k + 1)

=1

3xtrue(k) +

2

3v(k)− 2

3x(k)− 1

3w(k + 1)

We can now substitute x = xtrue − e to get

e(k + 1) = −1

3xtrue(k) +

2

3e(k) +

2

3v(k)− 1

3w(k + 1)

(1 Point)To determine stability we need to look at the two-state system comprising e(k) and xtrue(k):[

e(k + 1)xtrue(k + 1)

]=

[2/3 −1/30 1/2

] [e(k)

xtrue(k)

]+

[23v(k)− 1

3w(k + 1)v(k)

](1 Point)

This is stable if the eigenvalues of the above dynamics matrix are inside the unit circle. Becausethe matrix is upper triangular, the eigenvalues can be read off directly as 2

3 and 12 , and we

conclude the error does not diverge. (1 Point)

Page 19: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 19

Problem 7 12 Points

Recall the basic particle filtering algorithm we derived in class:

Initialization: Initialize the algorithm by randomly drawing N samples from the proba-bility density function of the initial state, fx(0).

Obtain xnm(0), n = 1, 2, . . . , N . Set k = 1.

Step 1: Simulate the N particles via the process model.

Obtain the a priori particles xnp (k).

Step 2: After a new measurement z(k) at time k, scale each a priori particle by themeasurement likelihood, and obtain a corresponding normalized weight βn for each particle.

Resample to get the a posteriori particles xnm(k) that have equal weights.

Increment the time k and proceed with Step 1.

Now consider the discrete-time process and measurement model

x(k) = x(k−1) + v(k−1)

z(k) = x(k) + w(k),

where x(k) is the scalar system state and v(k−1) is process noise, which is uniformly distributedin the interval [−1, 1]. The measurement z(k) is corrupted by measurement noise w(k) with theprobability density function (PDF)

fw(k)(w) =

12 + 1

4 w w ∈ [−2, 0)12 − 1

4 w w ∈ [0, 2]

0 otherwise,

for all k.

The PDF of the initial state, fx(0), is depicted below:

−1.5 −0.5 0.0 0.5 1.5

x

0.5

f x(0

)(x

)

a) Initialize a particle filter with N = 2 particles. For this calculation, you have access to arandom number generator that generates independent random samples r from a uniformdistribution on the interval [0, 1]. For the calculation of x1

m(0), you obtained the sampler1 = 3/4. For the calculation of x2

m(0), you obtained the sample r2 = 2/5. (3 points)

Page 20: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 20 Final Exam – Recursive Estimation

b) At time k = 3, the posterior particles are x1m(3) = 1/2 and x2

m(3) = −1. Calculate theprior particles x1

p(4) and x2p(4). You have access to the same random number generator

as in part a). For the calculation of x1p(4), you obtained the sample r1 = 1/2. For the

calculation of x2p(4), you obtained the sample r2 = 3/4. (3 points)

c) At time k = 5, the prior particles are x1p(5) = −1 and x2

p(5) = 1. The measurement is

z(5) = 12 . Calculate the probability that the first particle will be chosen at least once

during resampling, i.e. xnm(5) = x1p(5) for some n ∈ {1, 2}. (4 points)

d) At time k = 7, the prior particles are x1p(7) = 2 and x2

p(7) = 4, and the particle weightshave been computed as β1 = 2/5 and β2 = 3/5. Calculate the posterior particles x1

m(7)and x2

m(7). You have access to the same random number generator as in part a). Youobtained r1 = 3/10 and r2 = 1/10. (2 points)

Page 21: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Final Exam – Recursive Estimation Page 21

Solution 7

a) We sample the given state distribution fx(0)(x) using the algorithm discussed in class andthe given random numbers. The cumulative distribution function (CDF) of x(0) is

Fx(0)(ξ) =

ξ∫−∞

fx(0)(x) dx =

0 ξ < −32

12(ξ + 3

2) ξ ∈ [−32 ,−1

2)12 ξ ∈ [−1

2 ,12)

12 + 1

2(ξ − 12) ξ ∈ [1

2 ,32)

1 ξ ≥ 32 .

(1 point)We now solve Fx(0)(x

1m(0)) = r1 for x1

m(0). Since r1 = 3/4 > Fx(0)(1/2) = 1/2 andr1 = 3/4 < 1, we find that x1

m(0) ∈ [1/2, 3/2). Therefore, we solve

3

4=

1

2+

1

2

(x1m(0)− 1

2

)for x1

m(0) and find x1m(0) = 1. Analogously, we obtain x2

m(0) = −7/10 from r2 = 2/5.

(1 point for each correct answer)

b) We use the process model to simulate the two particles with random samples from theprocess noise distribution fv(k)(v). The CDF of v(k) is

Fv(k)(η) =

0 η < −112(η + 1) η ∈ [−1, 1]

1 η > 1.

(1 point)Solving

r1 = Fv(k)(v1(3)) ⇔ 1

2=

1

2+v1(3)

2

for v1(3), we find v1(3) = 0. Analogously, we obtain v2(3) = 1/2 from r2 = 3/4. Then, weapply the process model and find

x1p(4) = x1

m(3) + v1(3) =1

2+ 0 =

1

2

x2p(4) = x2

m(3) + v2(3) = −1 +1

2= −1

2.

(1 point for each correct answer)

c) We can calculate the probability of a particle being chosen from its normalized weight βn.First, we calculate the measurement likelihood for z(5) = 1

2 and x1p(5) = −1. In order to

apply the change of variables formula, we first define

z(5) = g(w(5), xp(5)) := xp(5) + w(5)

w(5) = h(z(5), xp(5)) := z(5)− xp(5).

Then, we adapt the change of variables formula to conditional PDFs and find

fz(5)|x(5)(z(5)|xp(5)) =fw(5) (h(z(5), xp(5))|xp(5))∣∣∣ dgdw(5) (h(z(5), xp(5)), xp(5))

∣∣∣ .

Page 22: Exam 2015 - ETH Zürich - Homepage | ETH Zürich

Page 22 Final Exam – Recursive Estimation

The derivative is straightforward:

dg

dw(5)(h(z(5), xp(5)), xp(5)) = 1, for all z(5), xp(5).

Therefore, we find

fz(5)|x(5)(z(5)|xp(5)) =fw(5)(h(z(5), xp(5))|xp(5))∣∣∣ dgdw(5) (h(z(5), xp(5)), xp(5))

∣∣∣ = fw(5) (z(5)− xp(5))

where we used the fact that w(5) and xp(5) are independent. (1 point for CoV)Finally, we obtain

fz(5)|x(5)

(1

2| − 1

)= fw(5)

(1

2+ 1

)=

1

8.

For the second particle x2p(5) = 1, we find

fz(5)|x(5)

(1

2|1)

= fw(5)

(1

2− 1

)=

3

8.

The sum of the measurement likelihoods is 1/8 + 3/8 = 1/2 =: α−1. Finally, we obtainthe particle weights

β1 = αfz(5)|x(5)(3|x1p(5)) = 2 · 1

8=

1

4

β2 = αfz(5)|x(5)(3|x2p(5)) = 2 · 3

8=

3

4.

(1 point for each β)The probability of the first particle being chosen at least once can be computed as

Pr(first particle chosen at least once)

= 1− Pr(first particle never chosen)

= 1− (β2)2

= 1− 9

16=

7

16.

(1 point)

d) We resample the prior particles based on the particle weights β1, β2 using the procedurepresented in class. Since β1 > r1 = 3/10, the first particle x2

p(7) is sampled:

x1m(7) = x1

p(7) = 2.

Since β1 > r2 = 1/10, the first particle x1p(7) is sampled again:

x2m(7) = x1

p(7) = 2.

(1 point for each correct answer)