WEBVTT
00:00:00.000 --> 00:00:03.000
Here's my solution for the programming assignment.
00:00:03.000 --> 00:00:06.000
There are many different ways to structure this, but that's what I've done.
00:00:06.000 --> 00:00:09.000
I have a dt equals 0.1.
00:00:09.000 --> 00:00:13.000
I set my initial state vector to be the initial x and y coordinates,
00:00:13.000 --> 00:00:17.000
and for the two velocities I set them both to 0.
00:00:17.000 --> 00:00:21.000
My u vector, as I said in the statement of the problem, is zero everywhere,
00:00:21.000 --> 00:00:23.000
so just ignore it.
00:00:23.000 --> 00:00:28.000
Interesting is my P matrix that measures the uncertainty.
00:00:28.000 --> 00:00:31.000
I set the uncertainty initially for the locations to be zero.
00:00:31.000 --> 00:00:33.000
These are the two main diagonal elements over here,
00:00:33.000 --> 00:00:37.000
and the uncertainty for the velocity is to be really high--it's 1000.
00:00:37.000 --> 00:00:39.000
So this is my initial uncertainty matrix.
00:00:39.000 --> 00:00:43.000
That guarantees that I can really estimate the velocity based on data,
00:00:43.000 --> 00:00:46.000
and I believe the initial state estimates are correct.
00:00:46.000 --> 00:00:50.000
Our F matrix is a 4-dimensional generalization of the F matrix we had before
00:00:50.000 --> 00:00:53.000
where we have 1 along the main diagonal.
00:00:53.000 --> 00:00:58.000
This one says that the position is retained in expectation and the velocity is retained,
00:00:58.000 --> 00:01:01.000
and we have two dt's over here.
00:01:01.000 --> 00:01:04.000
The x dot, which is my third state vector influences
00:01:04.000 --> 00:01:08.000
the x by a factor of dt for each time stamp.
00:01:08.000 --> 00:01:10.000
The same is true for y dot.
00:01:10.000 --> 00:01:15.000
These are the places where our velocities impact our position estimate.
00:01:15.000 --> 00:01:21.000
As I scroll down, the H matrix is a 4 x 2 projection matrix
00:01:21.000 --> 00:01:26.000
where we project out the x dimension and the y dimension without any velocities.
00:01:26.000 --> 00:01:29.000
For the measurement uncertainty I assume
00:01:29.000 --> 00:01:33.000
that each measurement has uncertainty covariance of 0.1,
00:01:33.000 --> 00:01:38.000
and these are along the main diagonal of the 2 x 2 measurement noise uncertainty matrix.
00:01:38.000 --> 00:01:43.000
This is obviously how a 4-dimensional identity matrix looks over here.
00:01:43.000 --> 00:01:49.000
If I run this for my first example where the measurements are 5, 6, 7, 8, 9, and 10,
00:01:49.000 --> 00:01:54.000
and the second dimension is 10, 8, 6, 4, and 2 and you can't see it but it's 0 over here.
00:01:54.000 --> 00:02:03.000
In my output, I correctly get the estimate of 10 for my x and 0 for my y.
00:02:03.000 --> 00:02:06.000
Velocity is 10 and -20.
00:02:06.000 --> 00:02:10.000
As we had before, because dt equals 0.1,
00:02:10.000 --> 00:02:13.000
a step from 5 to 6 within a 10th of a time unit
00:02:13.000 --> 00:02:17.000
requires velocity of 10 and from 10 to 8 one of 20.
00:02:17.000 --> 00:02:19.000
These numbers are correct.
00:02:19.000 --> 00:02:21.000
But we want to look at the covariance matrix.
00:02:21.000 --> 00:02:26.000
It's hard to read anything off it other than we are fairly certain as to what our location is,
00:02:26.000 --> 00:02:29.000
and we have a fairly good estimate of what our velocities are.
00:02:29.000 --> 00:02:32.000
Our covariance of velocity uncertainty is 0.1, and this is down from 1000,
00:02:32.000 --> 00:02:36.000
which was the initial value in these uncertainties.
00:02:36.000 --> 00:02:39.000
Going to the second example, I now commented away
00:02:39.000 --> 00:02:42.000
the first example and put in place a second example.
00:02:42.000 --> 00:02:48.000
If I run it again, here we see the first dimension go for -4, 1, 6, 11, 16.
00:02:48.000 --> 00:02:51.000
The second dimension 8, 4, 0, -4, -8.
00:02:51.000 --> 00:02:55.000
These are the exact same values over here--16 and -8.
00:02:55.000 --> 00:03:00.000
For velocities I get 50 and -40, which are exactly the correct velocities.
00:03:00.000 --> 00:03:05.000
Finally, for our third example, where the first coordinate doesn't change at all,
00:03:05.000 --> 00:03:09.000
we get the correct 1 over here and velocity of 0.
00:03:09.000 --> 00:03:12.000
Second coordinate goes from 19, 17 all the way to 11.
00:03:12.000 --> 00:03:15.000
We get 11 over here and velocity of -20.
00:03:15.000 --> 00:03:18.000
This is the implementation I wanted you to do.
00:03:18.000 --> 00:03:22.000
If you implemented this thing over here, you got it right
00:03:22.000 --> 00:03:27.000
and congratulations--you implemented a fairly nontrivial Kalman filter in stages,
00:03:27.000 --> 00:03:30.000
but through this class, we now have code that allows you
00:03:30.000 --> 00:03:33.000
to run Kalman filters on complicated problems,
00:03:33.000 --> 99:59:59.999
and I hope you really got an understanding how the Kalman filter works.