[Script Info]
Title:
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:03.00,Default,,0000,0000,0000,,Here's my solution for the programming assignment.
Dialogue: 0,0:00:03.00,0:00:06.00,Default,,0000,0000,0000,,There are many different ways to structure this, but that's what I've done.
Dialogue: 0,0:00:06.00,0:00:09.00,Default,,0000,0000,0000,,I have a dt equals 0.1.
Dialogue: 0,0:00:09.00,0:00:13.00,Default,,0000,0000,0000,,I set my initial state vector to be the initial x and y coordinates,
Dialogue: 0,0:00:13.00,0:00:17.00,Default,,0000,0000,0000,,and for the two velocities I set them both to 0.
Dialogue: 0,0:00:17.00,0:00:21.00,Default,,0000,0000,0000,,My u vector, as I said in the statement of the problem, is zero everywhere,
Dialogue: 0,0:00:21.00,0:00:23.00,Default,,0000,0000,0000,,so just ignore it.
Dialogue: 0,0:00:23.00,0:00:28.00,Default,,0000,0000,0000,,Interesting is my P matrix that measures the uncertainty.
Dialogue: 0,0:00:28.00,0:00:31.00,Default,,0000,0000,0000,,I set the uncertainty initially for the locations to be zero.
Dialogue: 0,0:00:31.00,0:00:33.00,Default,,0000,0000,0000,,These are the two main diagonal elements over here,
Dialogue: 0,0:00:33.00,0:00:37.00,Default,,0000,0000,0000,,and the uncertainty for the velocity is to be really high--it's 1000.
Dialogue: 0,0:00:37.00,0:00:39.00,Default,,0000,0000,0000,,So this is my initial uncertainty matrix.
Dialogue: 0,0:00:39.00,0:00:43.00,Default,,0000,0000,0000,,That guarantees that I can really estimate the velocity based on data,
Dialogue: 0,0:00:43.00,0:00:46.00,Default,,0000,0000,0000,,and I believe the initial state estimates are correct.
Dialogue: 0,0:00:46.00,0:00:50.00,Default,,0000,0000,0000,,Our F matrix is a 4-dimensional generalization of the F matrix we had before
Dialogue: 0,0:00:50.00,0:00:53.00,Default,,0000,0000,0000,,where we have 1 along the main diagonal.
Dialogue: 0,0:00:53.00,0:00:58.00,Default,,0000,0000,0000,,This one says that the position is retained in expectation and the velocity is retained,
Dialogue: 0,0:00:58.00,0:01:01.00,Default,,0000,0000,0000,,and we have two dt's over here.
Dialogue: 0,0:01:01.00,0:01:04.00,Default,,0000,0000,0000,,The x dot, which is my third state vector influences
Dialogue: 0,0:01:04.00,0:01:08.00,Default,,0000,0000,0000,,the x by a factor of dt for each time stamp.
Dialogue: 0,0:01:08.00,0:01:10.00,Default,,0000,0000,0000,,The same is true for y dot.
Dialogue: 0,0:01:10.00,0:01:15.00,Default,,0000,0000,0000,,These are the places where our velocities impact our position estimate.
Dialogue: 0,0:01:15.00,0:01:21.00,Default,,0000,0000,0000,,As I scroll down, the H matrix is a 4 x 2 projection matrix
Dialogue: 0,0:01:21.00,0:01:26.00,Default,,0000,0000,0000,,where we project out the x dimension and the y dimension without any velocities.
Dialogue: 0,0:01:26.00,0:01:29.00,Default,,0000,0000,0000,,For the measurement uncertainty I assume
Dialogue: 0,0:01:29.00,0:01:33.00,Default,,0000,0000,0000,,that each measurement has uncertainty covariance of 0.1,
Dialogue: 0,0:01:33.00,0:01:38.00,Default,,0000,0000,0000,,and these are along the main diagonal of the 2 x 2 measurement noise uncertainty matrix.
Dialogue: 0,0:01:38.00,0:01:43.00,Default,,0000,0000,0000,,This is obviously how a 4-dimensional identity matrix looks over here.
Dialogue: 0,0:01:43.00,0:01:49.00,Default,,0000,0000,0000,,If I run this for my first example where the measurements are 5, 6, 7, 8, 9, and 10,
Dialogue: 0,0:01:49.00,0:01:54.00,Default,,0000,0000,0000,,and the second dimension is 10, 8, 6, 4, and 2 and you can't see it but it's 0 over here.
Dialogue: 0,0:01:54.00,0:02:03.00,Default,,0000,0000,0000,,In my output, I correctly get the estimate of 10 for my x and 0 for my y.
Dialogue: 0,0:02:03.00,0:02:06.00,Default,,0000,0000,0000,,Velocity is 10 and -20.
Dialogue: 0,0:02:06.00,0:02:10.00,Default,,0000,0000,0000,,As we had before, because dt equals 0.1,
Dialogue: 0,0:02:10.00,0:02:13.00,Default,,0000,0000,0000,,a step from 5 to 6 within a 10th of a time unit
Dialogue: 0,0:02:13.00,0:02:17.00,Default,,0000,0000,0000,,requires velocity of 10 and from 10 to 8 one of 20.
Dialogue: 0,0:02:17.00,0:02:19.00,Default,,0000,0000,0000,,These numbers are correct.
Dialogue: 0,0:02:19.00,0:02:21.00,Default,,0000,0000,0000,,But we want to look at the covariance matrix.
Dialogue: 0,0:02:21.00,0:02:26.00,Default,,0000,0000,0000,,It's hard to read anything off it other than we are fairly certain as to what our location is,
Dialogue: 0,0:02:26.00,0:02:29.00,Default,,0000,0000,0000,,and we have a fairly good estimate of what our velocities are.
Dialogue: 0,0:02:29.00,0:02:32.00,Default,,0000,0000,0000,,Our covariance of velocity uncertainty is 0.1, and this is down from 1000,
Dialogue: 0,0:02:32.00,0:02:36.00,Default,,0000,0000,0000,,which was the initial value in these uncertainties.
Dialogue: 0,0:02:36.00,0:02:39.00,Default,,0000,0000,0000,,Going to the second example, I now commented away
Dialogue: 0,0:02:39.00,0:02:42.00,Default,,0000,0000,0000,,the first example and put in place a second example.
Dialogue: 0,0:02:42.00,0:02:48.00,Default,,0000,0000,0000,,If I run it again, here we see the first dimension go for -4, 1, 6, 11, 16.
Dialogue: 0,0:02:48.00,0:02:51.00,Default,,0000,0000,0000,,The second dimension 8, 4, 0, -4, -8.
Dialogue: 0,0:02:51.00,0:02:55.00,Default,,0000,0000,0000,,These are the exact same values over here--16 and -8.
Dialogue: 0,0:02:55.00,0:03:00.00,Default,,0000,0000,0000,,For velocities I get 50 and -40, which are exactly the correct velocities.
Dialogue: 0,0:03:00.00,0:03:05.00,Default,,0000,0000,0000,,Finally, for our third example, where the first coordinate doesn't change at all,
Dialogue: 0,0:03:05.00,0:03:09.00,Default,,0000,0000,0000,,we get the correct 1 over here and velocity of 0.
Dialogue: 0,0:03:09.00,0:03:12.00,Default,,0000,0000,0000,,Second coordinate goes from 19, 17 all the way to 11.
Dialogue: 0,0:03:12.00,0:03:15.00,Default,,0000,0000,0000,,We get 11 over here and velocity of -20.
Dialogue: 0,0:03:15.00,0:03:18.00,Default,,0000,0000,0000,,This is the implementation I wanted you to do.
Dialogue: 0,0:03:18.00,0:03:22.00,Default,,0000,0000,0000,,If you implemented this thing over here, you got it right
Dialogue: 0,0:03:22.00,0:03:27.00,Default,,0000,0000,0000,,and congratulations--you implemented a fairly nontrivial Kalman filter in stages,
Dialogue: 0,0:03:27.00,0:03:30.00,Default,,0000,0000,0000,,but through this class, we now have code that allows you
Dialogue: 0,0:03:30.00,0:03:33.00,Default,,0000,0000,0000,,to run Kalman filters on complicated problems,
Dialogue: 0,0:03:33.00,9:59:59.99,Default,,0000,0000,0000,,and I hope you really got an understanding how the Kalman filter works.