R代写-EE220C
时间:2021-03-11
ME231B/EE220C: HW 5 – Due: 12:00 (midday) on Monday, 19 March – for 81P.
Instructions: You may collaborate with up to 2 other students to solve these problems. Each student must fully participate
in solving all problems, and submit their own solutions written in their own words.
Be explicit in your solutions – points are awarded for clearly defining variables, etc. If your solutions are hard to read (e.g.
illegible), or hard to understand, we reserve the right to assign penalties, up to discarding the solution. This classification is at
the instructor’s discretion, and is not negotiable.
If a solution relies on computer code, you must provide the full listing of the code that you used. You may use any programming
language you like. Any code must be sufficiently well documented (comments) that it can be easily understood.
Submitting: submit your solution using gradescope. You must clearly mark up your solutions. Failure to submit according to
these instructions will be penalized, at our discretion.
Late submissions: you will lose 20 percentage points if your homework is late by less than eight hours. For each additional
hour, you lose an additional 10 percentage points.
Academic conduct: Please see http://sa.berkeley.edu/conduct/integrity/definition. We have no patience for misconduct.
Last update: 2021-03-08 (c) 2021 M.W. Mueller
Problem 0
Complete this statement on top of your solution, leaving only the part that applies: I worked on this solution
by myself. or I collaborated on these solutions with .
Problem 1 (12 P.)
Consider the following system:
x(k) = x(k − 1) + v(k − 1)
z(k) = x(k) + w(k)
where x(0), {v(·)}, {w(·)} are independent, and each is drawn from a uniform distribution in the range
[−1, 1].
At k = 1, you make the observation z(1) = 1.
a. (8P.) Solve the PDF of the state x(1) conditioned on z(1) = 1.
b. (2P.) Compute the Minimum Mean Squared Error estimate for x(1).
c. (2P.) Compute the Maximum A Posteriori estimate for x(1).
Problem 2 (19 P.)
Consider the following system:
x(k) = Ax(k − 1) + v(k − 1)
z(k) = Hx(k) + w(k)
A =
[
0.8 0.6
−0.6 0.8
]
, H =
[
1 0
]
, v(k) ∼ N (0, I) , w(k) ∼ N (0, I) , x(0) ∼ N
(
0,
[
3 0
0 1
])
and x(0), {v(·)}, {w(·)} are independent.
Define y(k) :=
[
1 1
]
x(k).
a. (7P.) Compute the PDF of y(1) given the observation z(1) = 2.22.
b. (4P.) At which time step k (for k ≤ 10) do you have least knowledge about y(k)? For which do
you have the most knowledge? Hint: interpret “little knowledge of something” as “our estimate of
something has large variance”.
Define the estimation error e(k) := x(k)− xˆ(k), where xˆ(k) is the Kalman filter estimate of the state x(k).
c. (4P.)Compute the PDF of e(10).
d. (4P.) Implement a simulation of the system and a Kalman filter that produces an estimate xˆ(k).
Execute this 10,000 times and plot a histogram of the resulting values for e(10) (make two histograms,
one for each component of e(10)). Comment on how this compares to your answer in c.
1 of 4
Problem 3 (6 P.)
Design a Kalman filter for the system given in Problem 1. What is the Kalman filter estimate at time k = 1?
Comment on how this compares to the solution you got for Problem 1.
Problem 4 (10 P.)
Consider the following system:
x(k) = Ax(k − 1) + v(k − 1)
z(k) = Hx(k) + w(k)
where
A =
[
0.8 0.6
−0.6 0.8
]
, H =
[
1 0
]
,E [v(k)] = 0,Var [v(k)] = I
E [w(k)] = 0,Var [w(k)] = I,E [x(0)] = 0,Var [x(0)] =
[
3 0
0 1
]
and x(0), {v(·)}, {w(·)} are independent.
Design an optimal linear estimator for this system (a Kalman filter), and implement a simulation of the
system and a Kalman filter that produces an estimate xˆ(k). For the simulation, draw all of the random
variables from uniform distributions that match the required mean/variance.
Execute this 10,000 times and plot a histogram of the resulting values for e(10) (make two histograms, one for
each component of e(10)). Comment on how this compares to your answers in Problem 2c and Problem 2d.
Also give the ensemble average and variance for each component of e(10) (that is, the average over the
samples from the simulations for each component). Compare that to the estimator’s output, and briefly
discuss.
Problem 5 (34 P.)
In this problem we estimate the behavior of a city’s
water network, where fresh water is supplied by a
desalination plant, and consumed at various points
in the network. The network contains various con-
sumers, and various reservoirs where water is locally
stored.
Our objective is to use noisy information about pro-
duction and consumption levels, and noisy measure-
ments of the amount of water in the reservoirs, to
estimate the state of the network. We will consider 3
networks of increasing complexity.
Let k be a time index, and let d(k) be the fresh water produced by the desalination plant at time k. Each
city district i has a reservoir with current level ri(k), and the district consumes a quantity of water ci(k).
Note that ri(k) and ci(k) both have units of volume. At each time step, we receive a noisy measurement
zi(k) = ri(k) + wi(k) of the reservoir level ri(k), where wi(k) is the measurement error (with w zero-mean,
white, and independent of all other quantities).
a. We will first investigate a very simplified system, with a single reservoir and single consumer (i.e. we
only have one tank level r to keep track of). We will model our consumers as c(k) = m+ v(k), where
m is the typical consumption, and v(k) is a zero-mean uncertainty, assumed white and independent of
all other quantities.
2 of 4
(a-i) (2P.) Write down the model equations for this problem. Make explicit what is the system state,
the measurement, the process noise, and the measurement noise.
(a-ii) (6P.) Design a Kalman filter to estimate the level of the tank. Run the Kalman filter for ten
steps, with the following problem data:
At time k = 0, we know E [r(0)] = 20, with uncertainty Var [r(0)] = 25. The desalination plant
delivers a constant supply of water, so that d(k) = 10 for all k ≥ 0. The consumer is predicted
to use a supply m = 7, and our process uncertainty is Var [v(k)] = 9. Our sensor uncertainty is
Var [w(k)] = 25.
We receive the following sequence of measurements z(k):
time k 1 2 3 4 5 6 7 8 9 10
measurement z(k) 32.1 39.8 45.9 52.0 51.0 63.4 58.1 60.3 76.6 73.0
Using the Kalman filter, estimate the actual volume of water r for k ∈ {1, 2, . . . , 10}. Also provide
the associated uncertainty for your estimate of r. Provide this using graphs.
b. We now extend the previous part by also estimating the consumption, c(k). We model the consumption
as evolving as c(k) = c(k−1) + n(k−1), where n(k−1) is a zero-mean random variable, which is white
and independent of all other quantities.
(b-i) (4P.) Write down the model equations for this, noting that now your state has dimension 2. Make
explicit what is the system state, the measurement, the process noise, and the measurement noise.
(b-ii) (6P.) Again, design a Kalman filter to estimate the level of the tank. Use the same problem data
as before (including as given in subproblem aa-ii), except that now Var [n(k)] = 0.1. Also use
E [c(0)] = 7 with Var [c(0)] = 1.
Using the Kalman filter, estimate the actual volume of water r for k ∈ {1, 2, . . . , 10}, and the
consumption rate c(k). Also provide the associated uncertainty for both. Provide this using
graphs. How do your answers for r compare to the previous case?
c. Now, we extend the system to a more complex network with four reservoirs, and four consumers, as
shown below.
3 of 4
The reservoirs are connected in a network, and an automatic balancing system is in place that pumps
water between the reservoirs. If two reservoirs i and j are connected, there is a balancing flow between
them that is proportional to the difference in volume between the two, so that fij(k) = α (rj(k) − ri(k)).
For example, for reservoirs #1 and #2 in our network, we have the following dynamics:
r1(k) = r1(k−1) + d(k−1) − c1(k−1) + α (r2(k−1) − r1(k−1)) + α (r3(k−1) − r1(k−1))
r2(k) = r2(k−1) − c2(k−1) + α (r1(k−1) − r2(k−1)) + α (r3(k−1) − r2(k−1))
where, as before, ci(k) = ci(k−1) + ni(k−1). Note that the balancing does not change the total
amount of water in the system, it just moves it around. Our sensor uncertainty is Var [wi(k)] =
25 for all tanks, and the consumption uncertainty is Var [ni(k)] = 0.1 for all consumers. Model
the consumers as independent but identically distributed; also model the sensors as independent but
identically distributed.
(c-i) (4P.) Write down the model equations for this problem. Make explicit what is the system state,
the measurement, the process noise, and the measurement noise. Write the solution as a linear
problem, and clearly give terms of the matrices A, H, etc.
(c-ii) (6P.) Design a Kalman filter to estimate the level of all the tanks, and the consumption levels.
Run the Kalman filter for ten steps, with the following problem data:
At time k = 0, we know the following about the tanks and their consumers:
tank number i 1 2 3 4
E [ri(0)] 20 40 60 20
Var [ri(0)] 20 20 20 20
E [ci(0)] 7 7 7 7
Var [ci(0)] 1 1 1 1
The desalination plant delivers a constant supply of water, so that d(k) = 30 for all k ≥ 0. The
balancing is done with α = 0.3.
We receive the following sequence of measurements zi(k):
time k 1 2 3 4 5 6 7 8 9 10
meas. z1(k) 62.6 70.3 73.5 77.2 73.2 94.2 87.4 89.7 90.4 94.2
meas. z2(k) 29.4 44.8 37.3 40.1 44.1 43.8 53.8 49.9 51.9 52.1
meas. z3(k) 35.9 38.8 25.9 39. 31.2 46.9 39.6 44. 42.5 54.2
meas. z4(k) 40.9 21.9 18. 8.8 23.9 17.2 18.6 22. 22.9 17.2
Using the Kalman filter, estimate the actual volume of water ri for k ∈ {1, 2, . . . , 10} for all tanks.
Also provide the associated uncertainty. Provide this using graphs. Notice that the estimate
uncertainty for tank 1 is lower than the solution you had for the simpler network – why is this?
(c-iii) (6P.) We will now repeat the previous problem, except that now the sensor of tank 3 has failed,
and thus no longer provides any measurements. Modify your Kalman filter from before (reduce
your sensor model to remove this), and run this using the same data as before (except that you
remove the measurements z3(k)). Estimate the actual volume of water ri for k ∈ {1, 2, . . . , 10} for
all tanks, and also provide the associated uncertainty. How does this compare to before? That
is, how much has losing the sensor affected your ability to estimate the tank levels?
4 of 4
























































































































































































学霸联盟


essay、essay代写