Adding process noise

In this chapter, we add process noise to the one-dimensional Kalman Filter model.

The complete model of the one-dimensional Kalman Filter

The Process Noise

In the real world, there are uncertainties in the system dynamic model. For example, when we want to estimate the resistance value of the resistor, we assume a constant dynamic model, i.e., the resistance doesn't change between the measurements. However, the resistance can change slightly due to the fluctuation of the environment temperature. When tracking ballistic missiles with radar, the uncertainty of the dynamic model includes random changes in the target acceleration. The uncertainties are much more significant for an aircraft due to possible aircraft maneuvers.

On the other hand, when we estimate the location of a static object using a GPS receiver, the uncertainty of the dynamic model is zero since the static object doesn't move. The uncertainty of the dynamic model is called the Process Noise. In the literature, it is also called plant noise, driving noise, dynamics noise, model noise, and system noise. The process noise produces estimation errors.

In the previous example, we estimated the height of the building. Since the building height doesn't change, we didn't consider the process noise.

The Process Noise Variance is denoted by the letter \( q \).

The Covariance Extrapolation Equation shall include the Process Noise Variance.

The Covariance Extrapolation Equation for constant dynamics is:

\[ p_{n+1,n}= p_{n,n}+ q_{n} \]

These are the updated Kalman Filter equations in one dimension:

Equation Equation Name Alternative names used in the literature
State Update \( \hat{x}_{n,n}=~ \hat{x}_{n,n-1}+ K_{n} \left( z_{n}- \hat{x}_{n,n-1} \right) \) State Update Filtering Equation
\( p_{n,n}=~ \left( 1-K_{n} \right) p_{n,n-1} \) Covariance Update Corrector Equation
\( K_{n}= \frac{p_{n,n-1}}{p_{n,n-1}+r_{n}} \) Kalman Gain Weight Equation
State Predict \( \hat{x}_{n+1,n}= \hat{x}_{n,n} \)
(For constant dynamics)

\( \hat{x}_{n+1,n}= \hat{x}_{n,n}+ \Delta t\hat{\dot{x}}_{n,n} \)
\( \hat{\dot{x}}_{n+1,n}= \hat{\dot{x}}_{n,n} \)
(For constant velocity dynamics)
State Extrapolation Predictor Equation
Transition Equation
Prediction Equation
Dynamic Model
State Space Model
\( p_{n+1,n}= p_{n,n} + q_{n} \)
(For constant dynamics)

\( p_{n+1,n}^{x}= p_{n,n}^{x} + \Delta t^{2} \cdot p_{n,n}^{v} \)
\( p_{n+1,n}^{v}= p_{n,n}^{v} + q_{n} \)
(For constant velocity dynamics)
Covariance Extrapolation Predictor Covariance Equation
Note 1: The State Extrapolation Equation and the Covariance Extrapolation Equation depend on the system dynamics.
Note 2: The table above demonstrates the special form of the Kalman Filter equations tailored for the specific case. The general form of the equation is presented later in matrix notation. For now, our goal is to understand the concept of the Kalman Filter.

Example 6 – Estimating the temperature of the liquid in a tank

We want to estimate the temperature of the liquid in a tank.

Estimating the liquid temperature

We assume that at a steady state, the liquid temperature is constant. However, some fluctuations in the true liquid temperature are possible. We can describe the system dynamics by the following equation:

\[ x_{n}=T+ w_{n} \]

Where:

\( T \) is the constant temperature

\( w_{n} \) is a random process noise with variance \( q \)

The numerical example

  • Let us assume a true temperature of 50 degrees Celsius.
  • We assume that the model is accurate. Thus we set the process noise variance ( \( q \) ) to 0.0001.
  • The measurement error (standard deviation) is 0.1 degrees Celsius.
  • The measurements are taken every 5 seconds.
  • The true liquid temperature values at the measurement points are: 49.979\( ^{o}C \), 50.025\( ^{o}C \), 50\( ^{o}C \), 50.003\( ^{o}C \), 49.994\( ^{o}C \), 50.002\( ^{o}C \), 49.999\( ^{o}C \), 50.006\( ^{o}C \), 49.998\( ^{o}C \), and 49.991\( ^{o}C \).
  • The measurements are: 49.95\( ^{o}C \), 49.967\( ^{o}C \), 50.1\( ^{o}C \), 50.106\( ^{o}C \), 49.992\( ^{o}C \), 49.819\( ^{o}C \), 49.933\( ^{o}C \), 50.007\( ^{o}C \), 50.023\( ^{o}C \), and 49.99\( ^{o}C \).

The following chart compares the true liquid temperature and the measurements.

True temperature vs. measurements

Iteration Zero

Before the first iteration, we must initialize the Kalman Filter and predict the following state (which is the first state).

Initialization

We don't know the true temperature of the liquid in a tank, and our guess is 10\( ^{o}C \).

\[ \hat{x}_{0,0}=10^{o}C \]

Our guess is imprecise, so we set our initialization estimate error \( \sigma \) to 100. The Estimate Uncertainty of the initialization is the error variance \( \left( \sigma ^{2} \right) \):

\[ p_{0,0}=100^{2}=10,000 \]

This variance is very high. We get faster Kalman Filter convergence if we initialize with a more meaningful value.

Prediction

Now, we shall predict the next state based on the initialization values.

Since our model has constant dynamics, the predicted estimate is equal to the current estimate:

\[ \hat{x}_{1,0}=10^{o}C \]

The extrapolated estimate uncertainty (variance):

\[ p_{1,0}= p_{0,0}+q=10000+ 0.0001=10000.0001 \]

First Iteration

Step 1 - Measure

The measurement value:

\[ z_{1}=~ 49.95^{o}C \]

Since the measurement error is 0.1 ( \( \sigma \) ), the variance ( \( \sigma ^{2} \) ) would be 0.01; thus, the measurement uncertainty is:

\[ r_{1}= 0.01 \]

Step 2 - Update

Kalman Gain calculation:

\[ K_{1}= \frac{p_{1,0}}{p_{1,0}+r_{1}}= \frac{10000.0001}{10000.0001+0.01} = 0.999999 \]

The Kalman Gain is almost 1, i.e., our estimate error is much bigger than the measurement error. Thus the weight of the estimate is negligible, while the measurement weight is almost 1.

Estimating the current state:

\[ \hat{x}_{1,1}=~ \hat{x}_{1,0}+ K_{1} \left( z_{1}- \hat{x}_{1,0} \right) =10+0.999999 \left( 49.95-10 \right) =49.95^{o}C \]

Update the current estimate uncertainty:

\[ p_{1,1}=~ \left( 1-K_{1} \right) p_{1,0}= \left( 1-0.999999 \right) 10000.0001=0.01 \]

Step 3 - Predict

Since our system's Dynamic Model is constant, i.e., the liquid temperature doesn't change:

\[ \hat{x}_{2,1}=\hat{x}_{1,1}= 49.95^{o}C \]

The extrapolated estimate uncertainty (variance) is:

\[ p_{2,1}= p_{1,1}+q=0.01+ 0.0001=0.0101 \]

Second Iteration

Step 1 - Measure

The measurement value:

\[ z_{2}=~ 49.967^{o}C \]

Since the measurement error is 0.1 ( \( \sigma \) ), the variance ( \( \sigma^{2} \) ) would be 0.01; thus, the measurement uncertainty is:

\[ r_{2}= 0.01 \]

Step 2 - Update

Kalman Gain calculation:

\[ K_{2}= \frac{p_{2,1}}{p_{2,1}+r_{2}}= \frac{0.0101}{0.0101+0.01} = 0.5 \]

The Kalman Gain is 0.5, i.e., the weight of the estimate and the measurement weight are equal.

Estimating the current state:

\[ \hat{x}_{2,2}=~ \hat{x}_{2,1}+ K_{2} \left( z_{2}- \hat{x}_{2,1} \right) =49.95+0.5 \left( 49.967-49.95 \right) =49.959^{o}C \]

Update the current estimate uncertainty:

\[ p_{2,2}=~ \left( 1-K_{2} \right) p_{2,1}= \left( 1-0.5 \right) 0.0101=0.005 \]

Step 3 - Predict

Since the dynamic model of the system is constant, i.e., the liquid temperature doesn't change:

\[ \hat{x}_{3,2}=\hat{x}_{2,2}= 49.959^{o}C \]

The extrapolated estimate uncertainty (variance) is:

\[ p_{3,2}= p_{2,2}+q=0.005+ 0.0001=0.0051 \]

Iterations 3-10

The calculations for the successive iterations are summarized in the following table:

\( n \) \( z_{n} \) Current state estimates ( \( K_{n} \) , \( \hat{x}_{n,n} \) , \( p_{n,n} \) ) Prediction ( \( \hat{x}_{n+1,n} \) , \( p_{n+1,n} \) )
3 \( 50.1^{o}C \) \[ K_{3}= \frac{0.0051}{0.0051+0.01}=0.3388 \] \[ \hat{x}_{3,3}=~ 49.959+0.3388 \left( 50.1-49.959 \right) =50.007^{o}C \] \[ p_{3,3}= \left( 1-0.3388 \right)0.0051 =0.0034 \] \[ \hat{x}_{4,3}= \hat{x}_{3,3}=50.007^{o}C \] \[ p_{4,3}= 0.0034+0.0001=0.0035 \]
4 \( 50.106^{o}C \) \[ K_{4}= \frac{0.0035}{0.0035+0.01}=0.2586 \] \[ \hat{x}_{4,4}=~ 50.007+0.2586 \left( 50.106-50.007 \right) =50.032^{o}C \] \[ p_{4,4}= \left( 1-0.2586 \right) 0.0035=0.0026 \] \[ \hat{x}_{5,4}= \hat{x}_{4,4}=50.032^{o}C \] \[ p_{5,4}= 0.0026+0.0001=0.0027 \]
5 \( 49.992^{o}C \) \[ K_{5}= \frac{0.0027}{0.0027+0.01}=0.2117 \] \[ \hat{x}_{5,5}= 50.032+0.2117 \left( 49.992-50.032 \right) =50.023^{o}C \] \[ p_{5,5}= \left( 1-0.2117 \right) 0.0027=0.0021 \] \[ \hat{x}_{6,5}= \hat{x}_{5,5}=50.023^{o}C \] \[ p_{6,5}= 0.0021+0.0001=0.0022 \]
6 \( 49.819^{o}C \) \[ K_{6}= \frac{0.0022}{0.0022+0.01}=0.1815 \] \[ \hat{x}_{6,6}=~ 50.023+0.1815 \left( 49.819-50.023 \right) =49.987^{o}C \] \[ p_{6,6}= \left( 1-0.1815 \right) 0.0022=0.0018 \] \[ \hat{x}_{7,6}= \hat{x}_{6,6}=49.987^{o}C \] \[ p_{7,6}= 0.0018+0.0001=0.0019 \]
7 \( 49.933^{o}C \) \[ K_{7}= \frac{0.0019}{0.0019+0.01}=0.1607 \] \[ \hat{x}_{7,7}=~ 49.987+0.1607 \left( 49.933-49.987 \right) =49.978^{o}C \] \[ p_{7,7}= \left( 1-0.1607 \right) 0.0019=0.0016 \] \[ \hat{x}_{8,7}= \hat{x}_{7,7}=49.978^{o}C \] \[ p_{8,7}= 0.0016+0.0001=0.0017 \]
8 \( 50.007^{o}C \) \[ K_{8}= \frac{0.0017}{0.0017+0.01}=0.1458 \] \[ \hat{x}_{8,8}= 49.978+0.1458 \left( 50.007-49.978 \right) =49.983^{o}C \] \[ p_{8,8}= \left( 1-0.1458 \right) 0.0017=0.0015 \] \[ \hat{x}_{9,8}= \hat{x}_{8,8}=49.983^{o}C \] \[ p_{9,8}= 0.0015+0.0001=0.0016 \]
9 \( 50.023^{o}C \) \[ K_{9}= \frac{0.0016}{0.0016+0.01}=0.1348 \] \[ \hat{x}_{9,9}=~ 49.983+0.1348 \left( 50.023-49.983 \right) =49.988^{o}C \] \[ p_{9,9}= \left( 1-0.1348 \right) 0.0016=0.0014 \] \[ \hat{x}_{10,9}= \hat{x}_{9,9}=49.988^{o}C \] \[ p_{10,9}= 0.0014+0.0001=0.0015 \]
10 \( 49.99^{o}C \) \[ K_{10}= \frac{0.0015}{0.0015+0.01}=0.1265 \] \[ \hat{x}_{10,10}=~ 49.988+0.1265 \left( 49.99 -49.988 \right) =49.988^{o}C \] \[ p_{10,10}= \left( 1-0.1265 \right) 0.0015=0.0013 \] \[ \hat{x}_{11,10}= \hat{x}_{10,10}=49.988^{o}C \] \[ p_{11,10}= 0.0013+0.0001=0.0014 \]

The following chart compares the true value, measured values, and estimates.

True value, measured values and estimates

As you can see, the estimated value converges toward the true value.

The following chart shows the estimate uncertainty.

Estimate uncertainty

The estimate uncertainty quickly goes down. After 10 measurements, the estimate uncertainty ( \( \sigma ^{2} \) ) is 0.0013, i.e., the estimate error standard deviation is: \( \sigma = \sqrt[]{0.0013}=0.036^{o}C \).

So we can say that the liquid temperature estimate is: \( 49.988 \pm 0.036_{ }^{o}C \).

The following chart describes the Kalman Gain.

The Kalman Gain

As you can see, the Kalman Gain is going down, making the measurement weight smaller and smaller.

Example summary

We measured a liquid temperature using the one-dimensional Kalman Filter in this example. Although the system dynamics include a random process noise, the Kalman Filter can provide a good estimation.

Example 7 – Estimating the temperature of a heating liquid

Like in the previous example, we estimate the temperature of a liquid in a tank. In this case, the dynamic model of the system is not constant - the liquid is heating at a rate of 0.1\( ^{o}C \) every second.

The Kalman Filter parameters are similar to the previous example:

  • We assume that the model is accurate. Thus we set the process noise variance ( \( q \) ) to 0.0001.
  • The measurement error (standard deviation) is 0.1\( ^{o}C \).
  • The measurements are taken every 5 seconds.
  • The dynamic model of the system is constant.

Note: although the true dynamic model of the system is not constant (since the liquid is heating), we treat the system as a system with a constant dynamic model (the temperature doesn't change).

  • The true liquid temperature values at the measurement points are: 50.479\( ^{o}C \), 51.025\( ^{o}C \), 51.5\( ^{o}C \), 52.003\( ^{o}C \), 52.494\( ^{o}C \), 53.002\( ^{o}C \), 53.499\( ^{o}C \), 54.006\( ^{o}C \), 54.498\( ^{o}C \), and 54.991\( ^{o}C \).
  • The measurements are: 50.45\( ^{o}C \), 50.967\( ^{o}C \), 51.6\( ^{o}C \), 52.106\( ^{o}C \), 52.492\( ^{o}C \), 52.819\( ^{o}C \), 53.433\( ^{o}C \), 54.007\( ^{o}C \), 54.523\( ^{o}C \), and 54.99\( ^{o}C \).

The following chart compares the true liquid temperature and the measurements.

True temperature vs. measurements

Iteration Zero

Iteration zero is similar to the previous example.

Before the first iteration, we must initialize the Kalman Filter and predict the following state (which is the first state).

Initialization

We don't know the true temperature of the liquid in a tank, and our guess is 10\( ^{o}C \).

\[ \hat{x}_{0,0}=10^{o}C \]

Our guess is very imprecise, so we set our initialization estimate error ( \( \sigma \) ) to 100. The Estimate Uncertainty of the initialization is the error variance \( \left( \sigma ^{2} \right) \):

\[ p_{0,0}=100^{2}=10,000 \]

This variance is very high. We get faster Kalman Filter convergence if we initialize with a more meaningful value.

Prediction

Now, we shall predict the next state based on the initialization values.

Since our model has constant dynamics, the predicted estimate is equal to the current estimate:

\[ \hat{x}_{1,0}=10^{o}C \]

The extrapolated estimate uncertainty (variance):

\[ p_{1,0}= p_{0,0}+q=10000+ 0.0001=10000.0001 \]

Iterations 1-10

The calculations for the successive iterations are summarized in the following table:

\( n \) \( z_{n} \) Current state estimates ( \( K_{n} \) , \( \hat{x}_{n,n} \) , \( p_{n,n} \) ) Prediction ( \( \hat{x}_{n+1,n} \) , \( p_{n+1,n} \) )
1 \( 50.45^{o}C \) \[ K_{1}= \frac{10000.0001}{10000.0001+0.01} = 0.999999 \] \[ \hat{x}_{1,1}=~ 10+0.999999 \left( 50.45-10 \right) =50.45^{o}C \] \[ p_{1,1}= \left( 1-0.999999 \right) 10000.0001=0.01 \] \[ \hat{x}_{2,1}= \hat{x}_{1,1}=50.45^{o}C \] \[ p_{2,1}= 0.01+0.0001=0.0101 \]
2 \( 50.967^{o}C \) \[ K_{2}= \frac{0.0101}{0.0101+0.01}=0.5025 \] \[ \hat{x}_{2,2}=~ 50.45+0.5025 \left( 50.967-50.45 \right) =50.71^{o}C\] \[ p_{2,2}= \left( 1-0.5025 \right) 0.0101=0.005 \] \[ \hat{x}_{3,2}= \hat{x}_{2,2}=50.71^{o}C \] \[ p_{3,2}= 0.005+0.0001=0.0051 \]
3 \( 51.6^{o}C \) \[ K_{3}= \frac{0.0051}{0.0051+0.01}=0.3388 \] \[ \hat{x}_{3,3}=~ 50.71+0.3388 \left( 51.6-50.71 \right) =51.011^{o}C\] \[ p_{3,3}= \left( 1-0.3388 \right) 0.0051=0.0034 \] \[ \hat{x}_{4,3}= \hat{x}_{3,3}=51.011^{o}C \] \[ p_{4,3}= 0.0034+0.0001=0.0035 \]
4 \( 52.106^{o}C \) \[ K_{4}= \frac{0.0035}{0.0035+0.01}=0.2586 \] \[ \hat{x}_{4,4}=~ 51.011+0.2586 \left( 52.106-51.011 \right) =51.295^{o}C \] \[ p_{4,4}= \left( 1-0.2586 \right) 0.0035=0.0026 \] \[ \hat{x}_{5,4}= \hat{x}_{4,4}=51.295^{o}C \] \[ p_{5,4}= 0.0026+0.0001=0.0027 \]
5 \( 52.492^{o}C \) \[ K_{5}= \frac{0.0027}{0.0027+0.01}=0.2117 \] \[ \hat{x}_{5,5}= 51.295+0.2117 \left( 52.492-51.295 \right) =51.548^{o}C \] \[ p_{5,5}= \left( 1-0.2117 \right) 0.0027=0.0021 \] \[ \hat{x}_{6,5}= \hat{x}_{5,5}=51.548^{o}C \] \[ p_{6,5}= 0.0021+0.0001=0.0022 \]
6 \( 52.819^{o}C \) \[ K_{6}= \frac{0.0022}{0.0022+0.01}=0.1815 \] \[ \hat{x}_{6,6}=~ 51.548+0.1815 \left( 52.819-51.548 \right) =51.779^{o}C \] \[ p_{6,6}= \left( 1-0.1815 \right) 0.0022=0.0018 \] \[ \hat{x}_{7,6}= \hat{x}_{6,6}=51.779^{o}C \] \[ p_{7,6}= 0.0018+0.0001=0.0019 \]
7 \( 53.433^{o}C \) \[ K_{7}= \frac{0.0019}{0.0019+0.01}=0.1607 \] \[ \hat{x}_{7,7}=~ 51.779+0.1607 \left( 53.433-51.779 \right) =52.045^{o}C \] \[ p_{7,7}= \left( 1-0.1607 \right) 0.0019=0.0016 \] \[ \hat{x}_{8,7}= \hat{x}_{7,7}=52.045^{o}C \] \[ p_{8,7}= 0.0016+0.0001=0.0017 \]
8 \( 54.007^{o}C \) \[ K_{8}= \frac{0.0017}{0.0017+0.01}=0.1458 \] \[ \hat{x}_{8,8}= 52.045+0.1458 \left( 54.007-52.045 \right) =52.331^{o}C \] \[ p_{8,8}= \left( 1-0.1458 \right) 0.0017=0.0015 \] \[ \hat{x}_{9,8}= \hat{x}_{8,8}=52.331^{o}C \] \[ p_{9,8}= 0.0015+0.0001=0.0016 \]
9 \( 54.523^{o}C \) \[ K_{9}= \frac{0.0016}{0.0016+0.01}=0.1348 \] \[ \hat{x}_{9,9}=~ 52.331+0.1348 \left( 54.523-52.331 \right) =52.626^{o}C \] \[ p_{9,9}= \left( 1-0.1348 \right) 0.0016=0.0014 \] \[ \hat{x}_{10,9}= \hat{x}_{9,9}=52.626^{o}C \] \[ p_{10,9}= 0.0014+0.0001=0.0015 \]
10 \( 54.99^{o}C \) \[ K_{10}= \frac{0.0015}{0.0015+0.01}=0.1265 \] \[ \hat{x}_{10,10}=~ 2.626+0.1265 \left( 54.99 -52.626 \right) =52.925^{o}C \] \[ p_{10,10}= \left( 1-0.1265 \right) 0.0015=0.0013 \] \[ \hat{x}_{11,10}= \hat{x}_{10,10}=52.925^{o}C \] \[ p_{11,10}= 0.0013+0.0001=0.0014 \]

The following chart compares the true value, measured values, and estimates.

True value, measured values and estimates

As you can see, the Kalman Filter has failed to provide a reliable estimation. There is a lag error in the Kalman Filter estimation. We've already encountered the lag error in Example 3, where we estimated the position of an accelerating aircraft using the \( \alpha - \beta \) filter that assumes constant aircraft velocity. We got rid of the lag error in Example 4, where we replaced the \( \alpha - \beta \) filter with the \( \alpha -\beta -\gamma \) filter that assumes acceleration.

There are two reasons for the lag error in our Kalman Filter example:

  • The dynamic model doesn't fit the case.
  • We have chosen very low process noise \( \left( q=0.0001 \right) \) while the true temperature fluctuations are much more significant.
Note: The lag error is constant. Therefore the estimate curve should have the same slope as the true value curve. The figure above presents only the 10 first measurements, which is not enough for convergence. The figure below presents the first 100 measurements with a constant lag error.
True value, measured values and estimates

There are two possible ways to fix the lag error:

  • If we know that the liquid temperature can change linearly, we can define a new model that considers a possible linear change in the liquid temperature. We did this in Example 4. This method is preferred. However, this method won't improve the Kalman Filter performance if the temperature change can't be modeled.
  • On the other hand, since our model is not well defined, we can adjust the process model reliability by increasing the process noise \( \left( q \right) \). See the next example for details.

Example summary

In this example, we measured the temperature of a heating liquid using a one-dimensional Kalman Filter with a constant dynamic model. We've observed the lag error in the Kalman Filter estimation. The wrong dynamic model and process model definitions cause the lag error.

An appropriate dynamic model or process model definition can fix the lag error.

Example 8 – Estimating the temperature of a heating liquid

This example is similar to the previous example, with only one change. Since our process is not well-defined, we increase the process uncertainty \( \left( q \right) \) from 0.0001 to 0.15.

Iteration Zero

Before the first iteration, we must initialize the Kalman Filter and predict the following state (which is the first state).

Initialization

The initialization is similar to the previous example.

We don't know the true temperature of the liquid in a tank, and our guess is 10\( ^{o}C \).

\[ \hat{x}_{0,0}=10^{o}C \]

Our guest is very imprecise, so we set our initialization estimate error ( \( \sigma \) ) to 100. The Estimate Uncertainty of the initialization is the error variance \( \left( \sigma ^{2} \right) \):

\[ p_{0,0}=100^{2}=10,000 \]

This variance is very high. We get faster Kalman Filter convergence if we initialize with a more meaningful value.

Prediction

Now, we shall predict the next state based on the initialization values.

Since our model has constant dynamics, the predicted estimate is equal to the current estimate:

\[ \hat{x}_{1,0}=10^{o}C \]

The extrapolated estimate uncertainty (variance):

\[ p_{1,0}= p_{0,0}+q=10000+ 0.15=10000.15 \]

Iterations 1-10

The calculations for the successive iterations are summarized in the following table:

\( n \) \( z_{n} \) Current state estimates ( \( K_{n} \) , \( \hat{x}_{n,n} \) , \( p_{n,n} \) ) Prediction ( \( \hat{x}_{n+1,n} \) , \( p_{n+1,n} \) )
1 \( 50.45^{o}C \) \[ K_{1}= \frac{10000.15}{10000.15+0.01} = 0.999999 \] \[ \hat{x}_{1,1}=~ 10+0.999999 \left( 50.45-10 \right) =50.45^{o}C \] \[ p_{1,1}= \left( 1-0.999999 \right)10000.15=0.01 \] \[ \hat{x}_{2,1}= \hat{x}_{1,1}=50.45^{o}C \] \[ p_{2,1}= 0.01+0.15=0.16 \]
2 \( 50.967^{o}C \) \[ K_{2}= \frac{0.16}{0.16+0.01}=0.9412 \] \[ \hat{x}_{2,2}=~ 50.45+0.9412 \left( 50.967-50.45 \right) =50.94^{o}C\] \[ p_{2,2}= \left( 1-0.9412 \right) 0.16=0.0094 \] \[ \hat{x}_{3,2}= \hat{x}_{2,2}=50.94^{o}C \] \[ p_{3,2}= 0.0094+0.15=0.1594 \]
3 \( 51.6^{o}C \) \[ K_{3}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{3,3}=~ 50.94+0.941 \left( 51.6-50.94 \right) =51.56^{o}C\] \[ p_{3,3}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{4,3}= \hat{x}_{3,3}=51.56^{o}C \] \[ p_{4,3}= 0.0094+0.15=0.1594 \]
4 \( 52.106^{o}C \) \[ K_{4}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{4,4}=~ 51.56+0.941 \left( 52.106-51.56 \right) =52.07^{o}C \] \[ p_{4,4}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{5,4}= \hat{x}_{4,4}=52.07^{o}C \] \[ p_{5,4}= 0.0094+0.15=0.1594 \]
5 \( 52.492^{o}C \) \[ K_{5}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{5,5}= 52.07+0.941 \left( 52.492-52.07 \right) =52.47^{o}C \] \[ p_{5,5}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{6,5}= \hat{x}_{5,5}=52.47^{o}C \] \[ p_{6,5}= 0.0094+0.15=0.1594 \]
6 \( 52.819^{o}C \) \[ K_{6}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{6,6}=~ 52.47+0.941 \left( 52.819-52.47 \right) =52.8^{o}C \] \[ p_{6,6}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{7,6}= \hat{x}_{6,6}=52.8^{o}C \] \[ p_{7,6}= 0.0094+0.15=0.1594 \]
7 \( 53.433^{o}C \) \[ K_{7}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{7,7}=~ 52.8+0.941 \left( 53.433-52.8 \right) =53.4^{o}C \] \[ p_{7,7}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{8,7}= \hat{x}_{7,7}=53.4^{o}C \] \[ p_{8,7}= 0.0094+0.15=0.1594 \]
8 \( 54.007^{o}C \) \[ K_{8}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{8,8}= 53.4+0.941 \left( 54.007-53.4 \right) =53.97^{o}C \] \[ p_{8,8}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{9,8}= \hat{x}_{8,8}=53.97^{o}C \] \[ p_{9,8}= 0.0094+0.15=0.1594 \]
9 \( 54.523^{o}C \) \[ K_{9}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{9,9}=~ 53.97+0.941 \left( 54.523-53.97 \right) =54.49^{o}C \] \[ p_{9,9}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{10,9}= \hat{x}_{9,9}=54.49^{o}C \] \[ p_{10,9}= 0.0094+0.15=0.1594 \]
10 \( 54.99^{o}C \) \[ K_{10}= \frac{0.1594}{0.1594+0.01}=0.941 \] \[ \hat{x}_{10,10}=~ 54.49+0.941 \left( 54.99 -54.49 \right) =54.96^{o}C \] \[ p_{10,10}= \left( 1-0.941 \right) 0.1594=0.0094 \] \[ \hat{x}_{11,10}= \hat{x}_{10,10}=54.96^{o}C \] \[ p_{11,10}= 0.0094+0.15=0.1594 \]

The following chart compares the true value, measured values, and estimates.

True value, measured values and estimates

As you can see, the estimates follow the measurements. There is no lag error.

The following chart shows the Kalman Gain.

The Kalman Gain

Due to the high process uncertainty, the measurement weight is much higher than the weight of the estimate. Thus, the Kalman Gain is high, and it converges to 0.94.

Example summary

We can eliminate the lag error by setting a high process uncertainty. However, since our model is not well-defined, the noisy estimates are almost equal to the measurements, and we miss the goal of the Kalman Filter.

The best Kalman Filter implementation involves a model that is very close to reality, leaving little room for process noise. However, a precise model is not always available - for example, an airplane pilot may decide to perform a sudden maneuver that changes the predicted airplane trajectory. In this case, the process noise would be increased.

Previous Next