So in the previous exercise, you had to go through and implement the prediction step of the common
filter, it's always good practice that if you have a simulation of the model that you're trying to
estimate, then run the simulation without any noise from a known initial condition and then run the
method of prediction step from the same initial condition and see that the two are consistent.
Now, this is an important validation step.
It shows that the common thread model that you're using is appropriate for the system dynamics that
you're trying to estimate.
And we want to run this without the update step from the common filter.
This is because if we run it with the update step, sometimes the correction step can hide any errors
in the model.
So it's always good to make sure that the underlying prediction is as best as possible for the model
that we want to try to estimate so we can have a look at this when we look at the code.
So let's go switch the code.
And if we start the initial state from zero zero zero and the covariance all from zero zero zero with
zero process model noise and run it, we can see what happens with the true state.
We can see that the object that we want to track shoots off at a 45 degree angle and it's traveling
at 10 meters a second.
So in this example, every time we run the simulation, the same velocity and the same direction happens.
So we can say here we have Awasthi of about seven point zero seven and seven point zero seven.
So using this information now, we can run the comment field, a prediction step using the same true
initial state.
So we saw that the initial state of the truth always starts at the Origin zero zero and had a controversy
about seven point zero seven seven point zero seven.
So now when we run the simulation.
We can see our estimated position, the red dot and the true state, the blue dot, pretty much overlap.
They line up.
So the prediction step is very consistent with the actual model that we want to simulate.
And we have looked at the main position error and maybe once the year, you see, they're very small.
This is because we know the true state of the system and we're studying it from the true initial state.
So if you look at the graphs here, you can see that we have a very small position error.
So you can see here our units are very small and the same thing for the velocity, the velocity, and
it's very small.
So we pretty much start it from the truth and we're predicting it very well.
So I can say that the true state tracks with the predicted state, I should say the other way around
the predicted state tracks very well for the true state.
So it all seems to be working fine.
It all seems to be working accurately.
And this is a good validation step as we covered in the slides.
So the variance in the filter must always represent the approximate level of the uncertainty inside
the field estimates, and this needs to be done through a correct model and correct tuning.
What this means is that the true state of the system is within the uncertainty bounds around the estimated
state.
If this is not the case, then the filter is called inconsistent.
And if the filter is inconsistent, this leads to bad and incorrect estimates and it degrades the whole
estimation process.
In some cases, it pretty much means that the estimated state from the filter is worthless.
It's useless if you're trying to use it for anything, it would just cause problems.
So we've checked that the state transmission model is working correctly, it can correctly predict from
a known initial condition the true state response.
We also want to check that the prediction model correctly transforms the uncertainty.
The uncertainty in the system should not be increasing if our key metrics, a process model noise is
equal to zero.
Rather, it should be transformed, appropriate with the system model.
So on the slide here, we can see the common field, our prediction set for the uncertainty.
So this is the current uncertainty.
This is the predicted uncertainty.
These are the state transition matrixes.
And this is the process model noise.
So this step here takes the process model.
So this step here takes the uncertainty at the TimeStep K minus one, transforms it through the process
model to get the new uncertainty at the current time.
So this transforms the uncertainty from the time set.
It does not actually inflate the uncertainty, does not increase the uncertainty in the system.
It just transforms what's appropriate with the system dynamics.
Whereas this key metrics here, this actually increases or inflates the uncertainty inside the system.
So if Kyuss equal to zero, we're just transforming the uncertainty based on the process model.
If CU is non-zero, then we're actually increasing the uncertainty in the system.
So what they can do is that we can check the position uncertainty is operating as expected, and to
do this, we set the initial position uncertainty to be a non-zero value.
We set the initial velocity, uncertainty to be zero, and then we can run the filter and see that the
position uncertainty stays the same.
So let's do that with the code that we have developed.
So we want to set the initial position uncertainty to a non-zero value.
So in this case, let's set the position uncertainty or the position standard deviation to be five.
So the variance is five squared, so five squared for the X and five squared for the Y initial position
uncertainty.
So when we run this.
We can now say that we have an uncertainty elipse around the estimate so we can see from these graphs
here that the three sigma, these green lines here and here for the plus or minus sigma and plus or
minus three sigma for the position error, they stay constant.
And from a process model, this is what we expect.
We're not increasing the uncertainty.
We're just keeping the uncertainty the same.
So the position uncertainty stays the same throughout the simulation.
So the covariates prediction for the position on certainly seems to be operating as expected.
So now let's check that they've lost the uncertainty is operating as expected.
And to do this, we're going to set the initial position, uncertainty to zero, but we're going to
set the velocity uncertainty to a non-zero value.
And when we do this and run the field, we should see that the velocity uncertainty stays at the same
value.
But the position uncertainty in this case should grow linearly with time.
And this is just due to the dynamics of the system.
So if we integrate diversity, we shall get a change in position.
So switching to the code this time, we're going to have a zero position uncertainty for the initial
state, but we're going to have an uncertainty for the velocity.
So let's say a standard deviation or variance of one.
So now when we run the simulation.
OK, so now if we have a look at the graphs, we can see that our velocity and certainly a three sigma
bounce stays the same and it's going to be at three because this is a three sigma bounce.
And we said the answer only to be one.
So I've lost the uncertainty is doing what's expected is staying constant.
Now, if you look at our position, uncertainty, we can see that is increasing with time and linearly
increasing of time.
And this is to be expected because we know that when we integrate velocity, we get a change in position.
So initially we start off at zero variance, so we start off at zero.
That's what we said it is.
And you can see after our 120 seconds, it should be friends of one multiplied by 120, multiplied by
three.
So it should be quite a large value.
So now it's three hundred and sixty as expected and same thing for the Y, so we can see that our velocity
uncertainty is doing the correct thing with the system dynamics.
It's changing.
It's transforming the uncertainty in the appropriate way that represents the system dynamics.
So we've looked at the uncertainty due to the process model.
Now we want to know that you have a look at the process model noise.
So this is the key metrics, part of the uncertainty equation.
So we want to check that the process model noise, the acceleration uncertainty is operating as expected
to do this.
We're going to set the initial position and the uncertainties to zero.
And we want to set a non-zero acceleration stand deviation.
So we want the key metrics, the process model noise metrics to be non-zero.
So when you run the filter, we should say that the total level of uncertainty in the system should
be growing with time.
Now, this means that the velocity uncertainty should be increasing linearly and the position uncertainty
should be increasing quite radically as expected due to the system dynamics, because we know that position
is a second integral of acceleration.
So let's carry out this experiment, Velcade.
So we're going to set our initial variances for position of velocity to be zero.
But now we want a non-zero key matrix.
So we're going to set this standard deviation of acceleration to be point one.
So now when we run the simulation, we should say something different.
We can see that the uncertainty in the system is increasing with time.
So our three sigma so bubble here is increasing as the simulation runs.
And if we look at our core variances now, we can see that our velocity era, that's increasing linearly
with time and we can see our position and certainly increasing quite radically with time.
So everything seems to be working as expected on this front.
So the person's moral noise increases the uncertainty in the system to capture the stochastic nature
of the system dynamics.
Now, in this simple case where we have an object that starts at a known origin and moves at a constant
velocity and there's no randomness, randomness inside the system, then it's not really all that important.
This is why we the.
So this is why we can set a key metrics to be zero, because there's no uncertainty in the system.
The only uncertainty at the moment is around our initial guess of the position and velocity.
So in general, when running a common field, all the key metrics or the process of noise can compensate
for a common Philidor process model that does not correctly or accurately model the true system dynamics.
And this works by increasing the uncertainty inside the system, which helps to cause a filter to stay
consistent so that it helps to make the uncertainty around the estimates to actually include where the
true state actually is, the presence of noise ties closely and with the measurement of noise and the
performance of the filter.
So we only cover this in a lot more detail later on.
So hopefully now you have a better understanding of why we went about the different exercises in the
way that we did, a key takeaway point from all this is that whenever we designing or implementing a
common filter, if we have a simulation of what the true system is going to do, we should run that
and run the method of prediction step to make sure the two are consistent or as consistent as possible.
If we do this, then there's a good chance that the model we have selected for the common filter should
be appropriate for the system in that mix that we're trying to estimate.