Post · 31 min read· pp. 36–62

The α-β-γ filter

This chapter is introductory, and it describes the α−β\alpha -\beta and α−β−γ\alpha -\beta -\gamma filters. These filters are frequently used for time series data smoothing. The principles of the α−β(−γ)\alpha -\beta (-\gamma) filter are closely related to the Kalman Filter principles.

Example 1 – Weighting the gold

Now we are ready for the first simple example. In this example, we estimate the state of the static system. A static system is a system that doesn't change its state over a reasonable period. For instance, the static system could be a tower, and the state would be its height.

In this example, we estimate the weight of the gold bar. We have unbiased scales, i.e., the measurements don't have a systematic error, but the measurements do include random noise.

Man Weighing Gold

Man Weighing Gold Adriaen Isenbrant, Netherlandish ca. 1515–20 The Metropolitan Museum of Art (Open Access Policy)

The system is the gold bar, and the system state is the weight of the gold bar. The dynamic model of the system is constant since we assume that the weight doesn't change over short periods.

To estimate the system state (i.e., the weight value), we can make multiple measurements and average them.

Measurements vs. True value

At the time nn, the estimate x^n,n\hat{x}_{n,n} would be the average of all previous measurements:

x^n,n=1n(z1+z2+…+zn−1+zn)=1n∑i=1n(zi)\hat{x}_{n,n}= \frac{1}{n} \left( z_{1}+ z_{2}+ \ldots + z_{n-1}+ z_{n} \right) = \frac{1}{n} \sum _{i=1}^{n} \left( z_{i} \right)

Example Notation:

xxis the true value of the weight.
znz_{n}is the measured value of the weight at time nn.
x^n,n\hat{x}_{n,n}is the estimate of xx at time nn (the estimate is made after taking the measurement znz_{n} ).
x^n+1,n\hat{x}_{n+1,n}is the estimate of the future state (n+1n+1 ) of xx. The estimate is made at the time nn. In other words, x^n+1,n\hat{x}_{n+1,n} is a predicted state or extrapolated state.
x^n−1,n−1\hat{x}_{n-1,n-1}is the estimate of xx at time n−1n-1 (the estimate is made after taking the measurement zn−1z_{n-1} ).
x^n,n−1\hat{x}_{n,n-1}is a prior prediction - the estimate of the state at time nn. The prediction is made at the time n−1n-1.

Note: In the literature, a caret (or hat) over a variable indicates an estimated value.

The dynamic model in this example is static (or constant) since the weight of gold doesn't change over time, therefore x^n+1,n=x^n,n\hat{x}_{n+1,n}= \hat{x}_{n,n}.

Although the above equation is mathematically correct, it is not practical for implementation. In order to estimate x^n,n\hat{x}_{n,n} we need to remember all historical measurements; therefore, we need a large memory. We also need to recalculate the average repeatedly if we want to update the estimated value after every new measurement. Thus, we need a more powerful CPU.

It would be more practical to keep the last estimate only (x^n−1,n−1\hat{x}_{n-1,n-1}) and update it after every new measurement. The following figure exemplifies the required algorithm:

  • Estimate the current state based on the measurement and prior prediction.
  • Predict the next state based on the current state estimate using the Dynamic Model.

Example Notation

We can modify the averaging equation for our needs using a small mathematical trick:

Notes
(
code
                                                \hat{x}_{n,n}= \frac{1}{n} \sum _{i=1}^{n} \left( z_{i} \right)
                                                \) | Average formula: sum of nn measurements divided by nn |

| ( = \frac{1}{n} \left( \sum {i=1}^{n-1} \left( z{i} \right) + z_{n} \right) ) | Sum of the n−1n - 1 measurements plus the last measurement divided by nn | | ( = \frac{1}{n} \sum {i=1}^{n-1} \left( z{i} \right) + \frac{1}{n} z_{n} ) | Expand | | ( = \frac{1}{n}\frac{n-1}{n-1} \sum {i=1}^{n-1} \left( z{i} \right) + \frac{1}{n} z_{n} ) | Multiply and divide by term n−1n - 1 | | ( = \frac{n-1}{n}\color{#FF8C00}{\frac{1}{n-1} \sum {i=1}^{n-1} \left( z{i} \right)} + \frac{1}{n} z_{n} ) | Reorder The 'orange' term is the prior estimate | | ( = \frac{n-1}{n}\color{#FF8C00}{\hat{x}{n-1,n-1}} + \frac{1}{n} z{n} ) | Rewriting the sum | | ( = \hat{x}{n-1,n-1}- \frac{1}{n}\hat{x}{n-1,n-1}+ \frac{1}{n} z_{n} ) | Distribute the term n−1n\frac{n-1}{n} | | ( = \hat{x}{n-1,n-1}+ \frac{1}{n} \left( z{n}- \hat{x}_{n-1,n-1} \right) ) | Reorder |

x^n−1,n−1\hat{x}_{n-1,n-1} is the estimated state of xx at the time n−1n - 1, based on the measurement at the time n−1n-1.

Let's find x^n,n−1\hat{x}_{n,n-1} (the predicted state of xx at the time nn) , based on x^n−1,n−1\hat{x}_{n-1,n-1} (the estimation at the time n−1n - 1). In other words, we would like to extrapolate x^n−1,n−1\hat{x}_{n-1,n-1} to the time nn.

Since the dynamic model in this example is static, the predicted state of xx equals the estimated state of xx: x^n,n−1=x^n−1,n−1\hat{x}_{n,n-1} = \hat{x}_{n-1,n-1}.

Based on the above, the estimate of the current state x^n,n\hat{x}_{n,n}, can be written as follows:

x^n,n=x^n,n−1+1n(zn−x^n,n−1)\hat{x}_{n,n} = \hat{x}_{n,n-1} + \frac{1}{n} \left( z_{n} - \hat{x}_{n,n-1} \right)

The above equation is one of the five Kalman filter equations. It is called the State Update Equation. It means the following:

State update

The factor 1n\frac{1}{n} is specific to our example. We will discuss the vital role of this factor later, but right now, I would like to note that in "Kalman Filter language," this factor is called the Kalman Gain. It is denoted by KnK_{n}. The subscript nn indicates that the Kalman Gain can change with every iteration.

The discovery of KnK_{n} was one of Rudolf Kalman's significant contributions.

Before we get into the guts of the Kalman Filter, we use the Greek letter αn\alpha _{n} instead of KnK_{n}.

So, the State Update Equation looks as follows:

x^n,n=x^n,n−1+αn(zn−x^n,n−1)\hat{x}_{n,n}= \hat{x}_{n,n-1}+ \alpha _{n} \left( z_{n}-\hat{x}_{n,n-1} \right)

The term (zn−x^n,n−1)\left( z_{n}- \hat{x}_{n,n-1} \right) is the "measurement residual," also called innovation. The innovation contains new information.

In this example, 1n\frac{1}{n} decreases as nn increases. In the beginning, we don't have enough information about the current state; thus, the first estimation is based on the first measurement 1n∣n=1=1\frac{1}{n}|_{n=1} = 1. As we continue, each successive measurement has less weight in the estimation process, since 1n\frac{1}{n} decreases. At some point, the contribution of the new measurements will become negligible.

Let's continue with the example. Before we make the first measurement, we can guess (or rough estimate) the gold bar weight simply by reading the stamp on the gold bar. It is called the Initial Guess, and it is our first estimate.

The Kalman Filter requires the initial guess as a preset, which can be very rough.

Estimation algorithm

The following chart depicts the estimation algorithm that is used in this example.

Example 1 estimation algorithm

Now we are ready to start the measurement and estimation process.

Note: While the standard unit of weight is Newton (N), a measure of the force exerted on an object due to gravity, people commonly refer to their 'weight' in kilograms (kg), a unit of mass. To enhance simplicity and accessibility in this book, I've opted to use kilogram units for weight instead of Newton.

The numerical example

Iteration Zero

Initialization

Our initial guess of the gold bar weight is 1000 grams. The initial guess is used only once for the filter initiation. Thus, it won't be required for successive iterations.

x^0,0=1000g\hat{x}_{0,0}=1000g

Prediction

The weight of the gold bar is not supposed to change. Therefore, the dynamic model of the system is static. Our next state estimate (prediction) equals the initialization:

x^1,0=x^0,0=1000g\hat{x}_{1,0} = \hat{x}_{0,0}=1000g

First Iteration

Step 1

Making the weight measurement with the scales:

z1=996gz_{1}= 996g

Step 2

Calculating the gain. In our example αn=1n\alpha_{n}= \frac{1}{n} , thus:

α1=11=1\alpha_{1}= \frac{1}{1}=1

Calculating the current estimate using the State Update Equation:

x^1,1=x^1,0+α1(z1−x^1,0)=1000+1(996−1000)=996g\hat{x}_{1,1}= \hat{x}_{1,0}+ \alpha _{1} \left( z_{1}- \hat{x}_{1,0} \right) = 1000+1 \left( 996-1000 \right) = 996g

Note: The initial guess could be any number in this specific example. Since α1=1\alpha _{1}= 1, the initial guess is eliminated in the first iteration.

Step 3

The dynamic model of the system is static; thus, the weight of the gold bar is not supposed to change. Our next state estimate (prediction) equals to current state estimate:

x^2,1=x^1,1=996g\hat{x}_{2,1}= \hat{x}_{1,1}=996g

Second Iteration

After a unit time delay, the predicted estimate from the previous iteration becomes the prior estimate in the current iteration:

x^2,1=996g\hat{x}_{2,1}=996g

Step 1

Making the second measurement of the weight:

z2=994gz_{2}= 994g

Step 2

Calculating the gain:

α2=12\alpha _{2}= \frac{1}{2}

Calculating the current estimate:

x^2,2=x^2,1+α2(z2−x^2,1)=996+12(994−996)=995g\hat{x}_{2,2}= \hat{x}_{2,1}+ \alpha_{2} \left( z_{2}- \hat{x}_{2,1} \right) =996+\frac{1}{2} \left( 994-996 \right) = 995g

Step 3

x^3,2=x^2,2=995g\hat{x}_{3,2}= \hat{x}_{2,2}=995g

Third Iteration

z3=1021g                          α3=13z_{3}= 1021g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{3}= \frac{1}{3}
x^3,3= 995+13(1021−995)=1003.67g\hat{x}_{3,3}=~ 995+\frac{1}{3} \left( 1021-995 \right) =1003.67g
x^4,3=1003.67g\hat{x}_{4,3}=1003.67g

Fourth Iteration

z4=1000g                          α4=14z_{4}= 1000g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{4}= \frac{1}{4}
x^4,4=1003.67+14(1000−1003.67)=1002.75g\hat{x}_{4,4}= 1003.67+\frac{1}{4} \left( 1000-1003.67 \right) =1002.75g
x^5,4=1002.75g\hat{x}_{5,4}=1002.75g

Fifth Iteration

z5=1002g                          α5=15z_{5}= 1002g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{5}= \frac{1}{5}
x^5,5=1002.75+15(1002−1002.75)=1002.6g\hat{x}_{5,5}= 1002.75+\frac{1}{5} \left( 1002-1002.75 \right) =1002.6g
x^6,5=1002.6g\hat{x}_{6,5}=1002.6g

Sixth Iteration

z6=1010g                          α6=16z_{6}= 1010g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{6}= \frac{1}{6}
x^6,6=1002.6+16(1010−1002.6)=1003.83\hat{x}_{6,6}= 1002.6+\frac{1}{6} \left( 1010-1002.6 \right) =1003.83
x^7,6=1003.83g\hat{x}_{7,6}=1003.83g

Seventh Iteration

z7=983g                          α7=17z_{7}=983g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{7}= \frac{1}{7}
x^7,7=1003.83+17(983−1003.83)=1000.86g\hat{x}_{7,7}= 1003.83+\frac{1}{7} \left( 983-1003.83 \right) =1000.86g
x^8,7=1000.86g\hat{x}_{8,7}=1000.86g

Eighth Iteration

z8=971g                          α8=18z_{8}=971g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{8}= \frac{1}{8}
x^8,8=1000.86+18(971−1000.86)=997.125g\hat{x}_{8,8}= 1000.86+\frac{1}{8} \left( 971-1000.86 \right) =997.125g
x^9,8=997.125g\hat{x}_{9,8}=997.125g

Ninth Iteration

z9=993g                          α9=19z_{9}=993g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{9}= \frac{1}{9}
x^9,9=997.125+19(993−997.125)=996.67g\hat{x}_{9,9}= 997.125+\frac{1}{9} \left( 993-997.125 \right) =996.67g
x^10,9=996.67g\hat{x}_{10,9}=996.67g

Tenth Iteration

z10=1023g                          α10=110z_{10}=1023g~~~~~~~~~~~~~~~~~~~~~~~~~~ \alpha_{10}= \frac{1}{10}
x^10,10=996.67+110(1023−996.67)=999.3g\hat{x}_{10,10}= 996.67+\frac{1}{10} \left( 1023-996.67 \right) =999.3g
x^11,10=999.3g\hat{x}_{11,10}=999.3g

We can stop here. The gain decreases with each measurement. Therefore, the contribution of each successive measurement is lower than the contribution of the previous measurement. We get pretty close to the true weight, which is 1000g. If we were making more measurements, we would get closer to the true value.

The following table summarizes our measurements and estimates, and the chart compares the measured values, the estimates, and the true value.

nn12345678910
αn\alpha _{n}1112\frac{1}{2}13\frac{1}{3}14\frac{1}{4}15\frac{1}{5}16\frac{1}{6}17\frac{1}{7}18\frac{1}{8}19\frac{1}{9}110\frac{1}{10}
znz_{n}99699410211000100210109839719931023
x^n,n\hat{x}_{n,n}9969951003.671002.751002.61003.831000.86997.125996.67999.3
x^n+1,n\hat{x}_{n+1,n}9969951003.671002.751002.61003.831000.86997.125996.67999.3

Results analysis

The following chart compares the true, measured, and estimated values.

Measurements vs. True value vs. Estimates

The estimation algorithm has a smoothing effect on the measurements and converges toward the true value.

The required number of measurements

What should be the number of measurements? Should we stop after 10, 100, or maybe 1000 measurements?

The required number of measurements depends on the desired estimation precision. We will have the answer to this question once we've gone through the book's second part. However, the inquisitive reader can sneak a peek at the Appendix J of the book.

Example summary

In this example, we've developed a simple estimation algorithm for a static system. We have also derived the state update equation, one of the five Kalman Filter equations. We will revise the state update equation in the next chapter.

Example 2 – Tracking the constant velocity aircraft in one dimension

It is time to examine a dynamic system that changes its state over time. In this example, we track a constant-velocity aircraft in one dimension using the α−β\alpha - \beta filter.

Let us assume a one-dimensional world. We assume an aircraft that is moving radially away from the radar (or towards the radar). In the one-dimensional world, the angle to the radar is constant, and the aircraft altitude is constant, as shown in the following figure.

One dimensional Radar

xnx_{n} represents the range to the aircraft at time nn. The aircraft velocity can be approximated using the range differentiation method - the change in the measured range with time.

Thus, the velocity is a derivative of the range:

x˙=v=dxdt\dot{x}= v = \frac{dx}{dt}

For discrete measurements:

v=ΔxΔtv = \frac{\Delta x}{\Delta t}

The radar sends a track beam in the direction of the target at a constant rate. The track-to-track interval is Δt\Delta t.

Two motion equations describe the system dynamic model for constant velocity motion:

xn+1=xn+Δtx˙nx_{n+1}= x_{n}+ \Delta t\dot{x}_{n}
x˙n+1=x˙n\dot{x}_{n+1}= \dot{x}_{n}

According to these equations, the aircraft range at the next tracking cycle equals the range at the current track cycle plus the target velocity multiplied by the track-to-track interval. Since we assume constant velocity in this example, the velocity at the next cycle equals the velocity at the current cycle.

The above system of equations is called a State Extrapolation Equation (also called a Transition Equation or a Prediction Equation) and is also one of the five Kalman filter equations. This system of equations extrapolates the current state to the next state (prediction).

We have already used the State Extrapolation Equation in the previous example, where we assumed that the weight at the next state equals the weight at the current state.

The State Extrapolation Equations depend on the system dynamics and differ from example to example.

There is a general form of the State Extrapolation Equation in matrix notation. We will learn it later.

In this example, we use the above equations specific to our case.

Note: we have already learned two of the five Kalman Filter equations:

  • State Update Equation
  • State Extrapolation Equation

Now we are going to modify the State Update Equation for our example.

The α−β\alpha - \beta filter

Let the radar track-to-track ( Δt\Delta t ) period be 5 seconds. Assume that at time n−1n - 1, the estimated range of the UAV (Unmanned Aerial Vehicle) is 30,000m, and the estimated UAV velocity is 40m/s.

Using the State Extrapolation Equations, we can predict the target position at time nn:

x^n,n−1=x^n−1,n−1+Δtx˙^n−1,n−1=30000+5×40=30200m\hat{x}_{n,n-1}= \hat{x}_{n-1,n-1}+ \Delta t\hat{\dot{x}}_{n-1,n-1}=30000+5\times40=30200m

The target velocity prediction for time nn:

x˙^n,n−1=x˙^n−1,n−1=40m/s\hat{\dot{x}}_{n,n-1}= \hat{\dot{x}}_{n-1,n-1}=40m/s

However, at time nn, the radar measures range ( znz_{n} ) of 30,110m and not 30,200m as expected. There is a 90m gap between the expected (predicted) range and the measured range. There are two possible reasons for this gap:

  • The radar measurements are not precise
  • The aircraft velocity has changed. The new aircraft velocity is: 30,110−30,0005=22m/s\frac{30,110-30,000}{5}=22m/s

Which of the two statements is true?

Let us write down the State Update Equation for the velocity:

x˙^n,n=x˙^n,n−1+β(zn−x^n,n−1Δt)\hat{\dot{x}}_{n,n}= \hat{\dot{x}}_{n,n-1}+ \beta \left( \frac{z_{n}-\hat{x}_{n,n-1}}{ \Delta t} \right)

The value of the factor β\beta depends on the precision level of the radar. Suppose that the 1σ1 \sigma precision of the radar is 20m. The 90 meters gap between the predicted and measured ranges most likely results from a change in the aircraft velocity. In this case, we should set the β\beta factor to a high value. If we set β\beta = 0.9, then the estimated velocity would be:

x˙^n,n=x˙^n,n−1+β(zn−x^n,n−1Δt)=40+0.9(30110−302005)=23.8m/s\hat{\dot{x}}_{n,n}= \hat{\dot{x}}_{n,n-1}+ \beta \left( \frac{z_{n}-\hat{x}_{n,n-1}}{ \Delta t} \right) =40+0.9 \left( \frac{30110-30200}{5} \right) =23.8m/s

On the other hand, suppose that the 1σ1 \sigma precision of the radar is 150m. Then the 90 meters gap probably results from the radar measurement error. In this case, we should set the β\beta factor to a low value. If we set β\beta = 0.1, then the estimated velocity would be:

x˙^n,n=x˙^n,n−1+β(zn−x^n,n−1Δt)=40+0.1(30110−302005)=38.2m/s\hat{\dot{x}}_{n,n}= \hat{\dot{x}}_{n,n-1}+ \beta \left( \frac{z_{n}-\hat{x}_{n,n-1}}{ \Delta t} \right) =40+0.1 \left( \frac{30110-30200}{5} \right) =38.2m/s

If the aircraft velocity has changed from 40m/s to 22m/s, we see this after 10 track cycles (running the above equation 10 times with β\beta = 0.1). If the gap has been caused by measurement error, then the successive measurements would be in front or behind the predicted positions. Thus on average, the target velocity would not change.

The State Update Equation for the aircraft position is similar to the equation that was derived in the previous example:

x^n,n=x^n,n−1+α(zn−x^n,n−1)\hat{x}_{n,n}= \hat{x}_{n,n-1}+ \alpha \left( z_{n}- \hat{x}_{n,n-1} \right)

Unlike the previous example, where the α\alpha factor is recalculated in each iteration ( αn=1n\alpha _{n}= \frac{1}{n} ), the α\alpha factor is constant in this example.

The magnitude of the α\alpha factor depends on the radar measurement precision. For high precision-radar, we should choose high α\alpha, giving high weight to the measurements. If α=1\alpha = 1, then the estimated range equals the measured range:

x^n,n=x^n,n−1+1(zn−x^n,n−1)=zn\hat{x}_{n,n}= \hat{x}_{n,n-1}+ 1 \left( z_{n}- \hat{x}_{n,n-1} \right) = z_{n}

If α=0\alpha =0 , then the measurement has no meaning:

x^n,n=x^n,n−1+0(zn−x^n,n−1)=x^n,n−1\hat{x}_{n,n} = \hat{x}_{n,n-1}+ 0 \left( z_{n}- \hat{x}_{n,n-1} \right) = \hat{x}_{n,n-1}

So, we have derived a system of equations that composes the State Update Equation for the radar tracker. They are also called α−β\alpha - \beta track update equations or α−β\alpha - \beta track filtering equations.

The State Update Equation for position:

x^n,n=x^n,n−1+α(zn−x^n,n−1)\hat{x}_{n,n} = \hat{x}_{n,n-1}+ \alpha \left( z_{n}- \hat{x}_{n,n-1} \right)

The State Update Equation for velocity:

x˙^n,n=x˙^n,n−1+β(zn−x^n,n−1Δt)\hat{\dot{x}}_{n,n} = \hat{\dot{x}}_{n,n-1}+ \beta \left( \frac{z_{n}-\hat{x}_{n,n-1}}{ \Delta t} \right)

Note: In some books, the α−β\alpha - \beta filter is called the g-h filter, where the Greek letter α\alpha is replaced by the English letter g, and the English letter h replaces the Greek letter β\beta.

Note: In this example, we are deriving the aircraft velocity from the range measurements ( x˙=ΔxΔt\dot{x}= \frac{ \Delta x}{ \Delta t} ). Modern radars can measure radial velocity directly using the Doppler Effect. However, my goal is to explain the Kalman Filter, not the radar operation. So, for the sake of generality, I will keep deriving the velocity from the range measurements in our examples.

Estimation Algorithm

The following chart depicts the estimation algorithm that is used in this example.

Estimation Algorithm

Unlike the previous example, the Gain values α\alpha and β\beta are given for this example. For the Kalman Filter, the α\alpha and β\beta are replaced by Kalman Gain, which is calculated at each iteration, but we learn it later.

Now we are ready to start a numerical example.

The numerical example

Consider an aircraft moving radially toward (or away from) a radar in a one-dimensional world.

The α−β\alpha - \beta filter parameters are:

  • α=0.2\alpha =0.2.
  • β=0.1\beta =0.1.

The track-to-track interval is 5 seconds.

Note: In this example, we use an imprecise radar and a low-speed target (UAV) for better graphical representation. The radars are usually more precise in real life, and the targets can be much faster.

Iteration Zero

Initialization

The initial conditions for the time n=0n=0 are given:

x^0,0=30000m\hat{x}_{0,0}=30000m
x˙^0,0=40m/s\hat{\dot{x}}_{0,0}=40m/s

Note: The Track Initiation (or how we get the initial conditions) is an important topic that will be discussed later. Right now, our goal is to understand the basic α−β\alpha - \beta filter operation, so let's assume that the initial conditions are given by somebody else.

Prediction

The initial guess should be extrapolated to the first cycle using the State Extrapolation Equations:

x^n+1,n=x^n,n+Δtx˙^n,n→x^1,0=x^0,0+Δtx˙^0,0=30000+5×40=30200m\hat{x}_{n+1,n}= \hat{x}_{n,n}+ \Delta t\hat{\dot{x}}_{n,n} \rightarrow \hat{x}_{1,0}= \hat{x}_{0,0}+ \Delta t\hat{\dot{x}}_{0,0} =30000+5 \times 40=30200m
x˙^n+1,n=x˙^n,n→x˙^1,0=x˙^0,0=40m/s\hat{\dot{x}}_{n+1,n}= \hat{\dot{x}}_{n,n} \rightarrow \hat{\dot{x}}_{1,0}= \hat{\dot{x}}_{0,0} =40m/s

First Iteration

In the first cycle ( n=1n=1 ), the initial guess is the prior estimate:

x^n,n−1=x^1,0=30200m\hat{x}_{n,n-1} = \hat{x}_{1,0}=30200m
x˙^n,n−1=x˙^1,0=40m/s\hat{\dot{x}}_{n,n-1} = \hat{\dot{x}}_{1,0}=40m/s

Step 1

The radar measures the aircraft range:

z1=30171mz_{1}= 30171m

Step 2

Calculating the current estimate using the State Update Equation:

x^1,1=x^1,0+α(z1−x^1,0)=30200+0.2(30171−30200)=30194.2m\hat{x}_{1,1} = \hat{x}_{1,0}+ \alpha \left( z_{1}- \hat{x}_{1,0} \right) =30200+0.2 \left( 30171-30200 \right) = 30194.2m
x˙^1,1=x˙^1,0+β(z1−x^1,0Δt)=40+0.1(30171−302005)=39.42m/s\hat{\dot{x}}_{1,1}= \hat{\dot{x}}_{1,0}+ \beta \left( \frac{z_{1}-\hat{x}_{1,0}}{ \Delta t} \right) = 40+0.1 \left( \frac{30171-30200}{5} \right) = 39.42m/s

Step 3

Calculating the next state estimate using the State Extrapolation Equations:

x^2,1=x^1,1+Δtx˙^1,1=30194.2+5×39.42=30391.3m\hat{x}_{2,1}= \hat{x}_{1,1}+ \Delta t\hat{\dot{x}}_{1,1} =30194.2+5 \times 39.42=30391.3m
x˙^2,1=x˙^1,1=39.42m/s\hat{\dot{x}}_{2,1}= \hat{\dot{x}}_{1,1} =39.42m/s

Second Iteration

After a unit time delay, the predicted estimate from the previous iteration becomes the prior estimate in the current iteration:

x^2,1=30391.3m\hat{x}_{2,1}=30391.3m
x˙^2,1=39.42m/s\hat{\dot{x}}_{2,1}= 39.42m/s

Step 1

The radar measures the aircraft range:

z2=30353mz_{2}= 30353m

Step 2

Calculating the current estimate using the State Update Equation:

x^2,2=x^2,1+α(z2−x^2,1)=30391.3+0.2(30353−30391.3)=30383.64m\hat{x}_{2,2} = \hat{x}_{2,1}+ \alpha \left( z_{2}- \hat{x}_{2,1} \right) =30391.3+0.2 \left( 30353-30391.3 \right) = 30383.64m
x˙^2,2=x˙^2,1+β(z2−x^2,1Δt)=39.42+0.1(30353−30391.35)=38.65m/s\hat{\dot{x}}_{2,2}= \hat{\dot{x}}_{2,1}+ \beta \left( \frac{z_{2}-\hat{x}_{2,1}}{ \Delta t} \right) = 39.42 + 0.1 \left( \frac{30353-30391.3}{5} \right) = 38.65m/s

Step 3

Calculating the next state estimate using the State Extrapolation Equations:

x^3,2=x^2,2+Δtx˙^2,2=30383.64+5×38.65=30576.9m\hat{x}_{3,2}= \hat{x}_{2,2}+ \Delta t\hat{\dot{x}}_{2,2} =30383.64+5 \times 38.65=30576.9m
x˙^3,2=x˙^2,2=38.65m/s\hat{\dot{x}}_{3,2}= \hat{\dot{x}}_{2,2} =38.65m/s

Third Iteration

z3=30756mz_{3}= 30756m
x^3,3=30576.9+0.2(30756−30576.9)=30612.73m\hat{x}_{3,3}= 30576.9+0.2 \left( 30756 -30576.9 \right) = 30612.73m
x˙^3,3=38.65+0.1(30756−30576.95)=42.2m/s\hat{\dot{x}}_{3,3}= 38.65+0.1 \left( \frac{30756 - 30576.9}{5} \right) = 42.2m/s
x^4,3=30612.73+5×42.2=30823.9m\hat{x}_{4,3}= 30612.73+5 \times 42.2=30823.9m
x˙^4,3=42.2m/s\hat{\dot{x}}_{4,3}= 42.2m/s

Fourth Iteration

z4=30799mz_{4}= 30799m
x^4,4=30823.9+0.2(30799−30823.9)=30818.93m\hat{x}_{4,4}= 30823.9+0.2 \left( 30799-30823.9 \right) = 30818.93m
x˙^4,4=42.2+0.1(30799−30823.95)=41.7m/s\hat{\dot{x}}_{4,4}= 42.2+0.1 \left( \frac{30799-30823.9}{5} \right) = 41.7m/s
x^5,4=30818.93+5×41.7=31027.6m\hat{x}_{5,4}= 30818.93+5 \times 41.7=31027.6m
x˙^5,4=41.7m/s\hat{\dot{x}}_{5,4}= 41.7m/s

Fifth Iteration

z5=31018mz_{5}= 31018m
x^5,5=31027.6+0.2(31018−31027.6)=31025.7m\hat{x}_{5,5}= 31027.6+0.2 \left( 31018 -31027.6 \right) = 31025.7m
x˙^5,5=41.7+0.1(31018−31027.65)=41.55m/s\hat{\dot{x}}_{5,5}= 41.7+0.1 \left( \frac{31018 -31027.6}{5} \right) = 41.55m/s
x^6,5=31025.7+5×41.55=31233.4m\hat{x}_{6,5}= 31025.7+5 \times 41.55 = 31233.4m
x˙^6,5=41.55m/s\hat{\dot{x}}_{6,5}= 41.55m/s

Sixth Iteration

z6=31278mz_{6}= 31278m
x^6,6=31233.4+0.2(31278−31233.4)=31242.3m\hat{x}_{6,6}= 31233.4+0.2 \left( 31278 -31233.4 \right) = 31242.3m
x˙^6,6=41.55+0.1(31278−31233.45)=42.44m/s\hat{\dot{x}}_{6,6}= 41.55+0.1 \left( \frac{31278 -31233.4}{5} \right) = 42.44m/s
x^7,6=31242.3+5×42.44=31454.5m\hat{x}_{7,6}= 31242.3+5 \times 42.44 = 31454.5m
x˙^7,6=42.44m/s\hat{\dot{x}}_{7,6}= 42.44m/s

Seventh Iteration

z7=31276mz_{7}= 31276m
x^7,7=31454.5+0.2(31276−31454.5)=31418.8m\hat{x}_{7,7}= 31454.5+0.2 \left( 31276 -31454.5 \right) = 31418.8m
x˙^7,7=42.44+0.1(31276−31454.55)=38.9m/s\hat{\dot{x}}_{7,7}= 42.44+0.1 \left( \frac{31276 -31454.5}{5} \right) = 38.9m/s
x^8,7=31418.8+5×38.9=31613.15m\hat{x}_{8,7}= 31418.8+5 \times 38.9 = 31613.15m
x˙^8,7=38.9m/s\hat{\dot{x}}_{8,7}= 38.9m/s

Eighth Iteration

z8=31379mz_{8}= 31379m
x^8,8=31613.15+0.2(31379−31613.15)=31566.3m\hat{x}_{8,8}= 31613.15+0.2 \left( 31379 -31613.15 \right) = 31566.3m
x˙^8,8=38.9+0.1(31379−31613.155)=34.2m/s\hat{\dot{x}}_{8,8}= 38.9+0.1 \left( \frac{31379 -31613.15}{5} \right) = 34.2m/s
x^9,8=31566.3+5×34.2=31737.24m\hat{x}_{9,8}= 31566.3 + 5 \times 34.2 = 31737.24m
x˙^9,8=34.2m/s\hat{\dot{x}}_{9,8}= 34.2m/s

Ninth Iteration

z9=31748mz_{9}= 31748m
x^9,9=31737.24+0.2(31748−31737.24)=31739.4m\hat{x}_{9,9}= 31737.24+0.2 \left( 31748 -31737.24 \right) = 31739.4m
x˙^9,9=34.2+0.1(31748−31737.245)=34.4m/s\hat{\dot{x}}_{9,9}= 34.2+0.1 \left( \frac{31748 -31737.24}{5} \right) = 34.4m/s
x^10,9=31739.4+5×34.4=31911.4m\hat{x}_{10,9}= 31739.4+5 \times 34.4=31911.4m
x˙^10,9=34.4m/s\hat{\dot{x}}_{10,9}=34.4m/s

Tenth Iteration

z10=32175mz_{10}= 32175m
x^10,10=31911.4+0.2(32175−31911.4)=31964.1m\hat{x}_{10,10}= 31911.4+0.2 \left( 32175 -31911.4 \right) = 31964.1m
x˙^10,10=34.4+0.1(32175−31911.45)=39.67m/s\hat{\dot{x}}_{10,10}= 34.4+0.1 \left( \frac{32175 -31911.4}{5} \right) = 39.67m/s
x^11,10=31964.1+5×39.67=32162.45m\hat{x}_{11,10}= 31964.1+5 \times 39.67 = 32162.45m
x˙^11,10=39.67m/s\hat{\dot{x}}_{11,10}= 39.67m/s

The following table summarizes our measurements and estimates.

nn12345678910
znz_{n}30171303533075630799310183127831276313793174832175
x^n,n\hat{x}_{n,n}30194.230383.6430612.7330818.9331025.731242.331418.831566.331739.431964.1
x^˙n,n\dot{\hat{x}}_{n,n}39.4238.6542.241.741.5542.4438.934.234.439.67
x^n+1,n\hat{x}_{n+1,n}30391.330576.930823.931027.631233.431454.531613.1531737.2431911.432162.45
x^˙n+1,n\dot{\hat{x}}_{n+1,n}39.4238.6542.241.741.5542.4438.934.234.439.67

Results analysis

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

Measurements vs. True value vs. Estimates - low Alpha and Beta

Our estimation algorithm has a smoothing effect on the measurements and converges toward the true value.

Using high α\alpha and β\beta

The following chart depicts the true, measured, and estimated values for α=0.8\alpha = 0.8 and β=0.5\beta = 0.5.

Measurements vs. True value vs. Estimates - high Alpha and Beta

The "smoothing" degree of this filter is much lower. The "current estimate" is very close to the measured values, and predicted estimate errors are relatively high.

So, shall we always choose low values for α\alpha and β\beta ?

The answer is NO. The value of α\alpha and β\beta should depend on the measurement precision. If we use high-precision equipment, like laser radar, we would prefer a high α\alpha and β\beta that follow measurements. In this case, the filter would quickly respond to a velocity change of the target. On the other hand, if measurement precision is low, we prefer low α\alpha and β\beta. In this case, the filter smoothes the uncertainty (errors) in the measurements. However, the filter reaction to target velocity changes would be much slower.

Example summary

We've derived the α−β\alpha - \beta filter state update equation. We've also learned the State Extrapolation Equation. We've developed an estimation algorithm for a one-dimensional dynamic system based on the α−β\alpha - \beta filter and solved a numerical example for a constant velocity target.

Example 3 – Tracking accelerating aircraft in one dimension

In this example, we track an aircraft moving with constant acceleration with the α−β\alpha - \beta filter.

In the previous example, we tracked a UAV moving at a constant velocity of 40m/s. The following chart depicts the target range and velocity vs. time.

Constant Velocity Movement

As you can see, the range function is linear.

Now let's examine a fighter aircraft. This aircraft moves at a constant velocity of 50m/s for 20 seconds. Then the aircraft accelerates with a constant acceleration of 8m/s2 for another 35 seconds.

The following chart depicts the target range, velocity and acceleration vs. time.

Accelerated Movement

As you can see from the chart, the aircraft velocity is constant for the first 20 seconds and then grows linearly. The range grows linearly for the first 20 seconds and then grows quadratically.

We are going to track this aircraft with the α−β\alpha - \beta filter that was used in the previous example.

The numerical example

Consider an aircraft moving radially toward (or away from) a radar in a one-dimensional world.

The α−β\alpha - \beta filter parameters are:

  • α=0.2\alpha =0.2
  • β=0.1\beta =0.1

The track-to-track interval is 5 seconds.

Iteration Zero

Initialization

The initial conditions for the time n=0n=0 are given:

x^0,0=30000m\hat{x}_{0,0}=30000m
x˙^0,0=50m/s\hat{\dot{x}}_{0,0}=50m/s

Note: The Track Initiation (or how we get the initial conditions) is an important topic that will be discussed later. Right now, our goal is to understand the basic α−β\alpha - \beta filter operation, so let's assume that the initial conditions are given by somebody else.

Prediction

The initial guess shall be extrapolated to the first cycle using the State Extrapolation Equations:

x^n+1,n=x^n,n+Δtx˙^n,n→x^1,0=x^0,0+Δtx˙^0,0=30000+5×50=30250m\hat{x}_{n+1,n}= \hat{x}_{n,n}+ \Delta t\hat{\dot{x}}_{n,n} \rightarrow \hat{x}_{1,0}= \hat{x}_{0,0}+ \Delta t\hat{\dot{x}}_{0,0} =30000+5 \times 50=30250m
x˙^n+1,n=x˙^n,n→x˙^1,0=x˙^0,0=50m/s\hat{\dot{x}}_{n+1,n}= \hat{\dot{x}}_{n,n} \rightarrow \hat{\dot{x}}_{1,0}= \hat{\dot{x}}_{0,0} =50m/s

Iterations 1-10

All filter iterations are summarized in the following table:

nnznz_{n}Current state estimates ( x^n,n\hat{x}_{n,n}, x˙^n,n\hat{\dot{x}}_{n,n} )Prediction ( x^n+1,n\hat{x}_{n+1,n}, x˙^n+1,n\hat{\dot{x}}_{n+1,n} )
130221m30221m
x^1,1=30250+0.2(30221−30250)=30244.2m\hat{x}_{1,1} = 30250+0.2 \left( 30221- 30250 \right) = 30244.2m
x˙^1,1=50+0.1(30221−302505)=49.42m/s\hat{\dot{x}}_{1,1}= 50+0.1 \left( \frac{30221 -30250}{5} \right) = 49.42m/s
x^2,1=30244.2+5×49.42=30491.3m\hat{x}_{2,1} = 30244.2 + 5 \times 49.42 = 30491.3m
x˙^2,1=49.42m/s\hat{\dot{x}}_{2,1}= 49.42m/s
230453m30453m
x^2,2=30491.3+0.2(30453−30491.3)=30483.64m\hat{x}_{2,2} = 30491.3 + 0.2 \left( 30453 - 30491.3 \right) = 30483.64m
x˙^2,2=49.42+0.1(30453−30491.35)=48.65m/s\hat{\dot{x}}_{2,2} = 49.42 + 0.1 \left( \frac{30453 - 30491.3}{5} \right) = 48.65m/s
x^3,2=30483.64+5×48.65=30726.9m\hat{x}_{3,2} = 30483.64 + 5 \times 48.65 = 30726.9m
x˙^3,2=48.65m/s\hat{\dot{x}}_{3,2} = 48.65m/s
330906m30906m
x^3,3=30726.9+0.2(30906−30726.9)=30762.7m\hat{x}_{3,3} = 30726.9 + 0.2 \left( 30906 - 30726.9 \right) = 30762.7m
x˙^3,3=48.65+0.1(30906−30726.95)=52.24m/s\hat{\dot{x}}_{3,3}= 48.65 + 0.1 \left( \frac{30906 - 30726.9}{5} \right) = 52.24m/s
x^4,3=30762.7+5×52.24=31023.9m\hat{x}_{4,3} = 30762.7 + 5 \times 52.24 = 31023.9m
x˙^4,3=52.24m/s\hat{\dot{x}}_{4,3} = 52.24m/s
430999m30999m
x^4,4=31023.9+0.2(30999−31023.9)=31018.93m\hat{x}_{4,4} = 31023.9 + 0.2 \left( 30999 - 31023.9 \right) = 31018.93m
x˙^4,4=52.24+0.1(30999−31023.95)=51.74m/s\hat{\dot{x}}_{4,4}= 52.24 + 0.1 \left( \frac{30999 - 31023.9}{5} \right) = 51.74m/s
x^5,4=31018.93+5×51.74=31277.6m\hat{x}_{5,4} = 31018.93 + 5 \times 51.74 = 31277.6m
x˙^5,4=51.74m/s\hat{\dot{x}}_{5,4} = 51.74m/s
531368m31368m
x^5,5=31277.6+0.2(31368−31277.6)=31295.7m\hat{x}_{5,5} = 31277.6 + 0.2 \left( 31368 - 31277.6 \right) = 31295.7m
x˙^5,5=51.74+0.1(31368−31277.65)=53.55m/s\hat{\dot{x}}_{5,5}= 51.74 + 0.1 \left( \frac{31368 - 31277.6}{5} \right) = 53.55m/s
x^6,5=31295.7+5×53.55=31563.4m\hat{x}_{6,5} = 31295.7 + 5 \times 53.55 = 31563.4m
x˙^6,5=53.55m/s\hat{\dot{x}}_{6,5} = 53.55m/s
631978m31978m
x^6,6=31563.4+0.2(31978−31563.4)=31646.3m\hat{x}_{6,6} = 31563.4 + 0.2 \left( 31978 - 31563.4 \right) = 31646.3m
x˙^6,6=53.55+0.1(31978−31563.45)=61.84m/s\hat{\dot{x}}_{6,6}= 53.55 + 0.1 \left( \frac{31978 - 31563.4}{5} \right) = 61.84m/s
x^7,6=31646.3+5×61.84=31955.5m\hat{x}_{7,6} = 31646.3 + 5 \times 61.84 = 31955.5m
x˙^7,6=61.84m/s\hat{\dot{x}}_{7,6}= 61.84m/s
732526m32526m
x^7,7=31955.5+0.2(32526−31955.5)=32069.6m\hat{x}_{7,7} = 31955.5 + 0.2 \left( 32526 - 31955.5 \right) = 32069.6m
x˙^7,7=61.84+0.1(32526−31955.55)=73.25m/s\hat{\dot{x}}_{7,7}= 61.84 + 0.1 \left( \frac{32526 - 31955.5}{5} \right) = 73.25m/s
x^8,7=32069.6+5×73.25=32435.85m\hat{x}_{8,7} = 32069.6 + 5 \times 73.25 = 32435.85m
x˙^8,7=73.25m/s\hat{\dot{x}}_{8,7} = 73.25m/s
833379m33379m
x^8,8=32435.85+0.2(33379−32435.85)=32624.5m\hat{x}_{8,8} = 32435.85 + 0.2 \left( 33379 - 32435.85 \right) = 32624.5m
x˙^8,8=73.25+0.1(33379−32435.855)=92.1m/s\hat{\dot{x}}_{8,8}= 73.25 + 0.1 \left( \frac{33379 - 32435.85}{5} \right) = 92.1m/s
x^9,8=32624.5+5×92.1=33085m\hat{x}_{9,8} = 32624.5 + 5 \times 92.1 = 33085m
x˙^9,8=92.1m/s\hat{\dot{x}}_{9,8} = 92.1m/s
934698m34698m
x^9,9=33085+0.2(34698−33085)=33407.6m\hat{x}_{9,9} = 33085 + 0.2 \left( 34698 - 33085 \right) = 33407.6m
x˙^9,9=92.1+0.1(34698−330855)=124.37m/s\hat{\dot{x}}_{9,9}= 92.1 + 0.1 \left( \frac{34698 - 33085}{5} \right) = 124.37m/s
x^10,9=33407.6+5×124.37=34029.5m\hat{x}_{10,9} = 33407.6 + 5 \times 124.37 = 34029.5m
x˙^10,9=124.37m/s\hat{\dot{x}}_{10,9} = 124.37m/s
1036275m36275m
x^10,10=34029.5+0.2(36275−34029.5)=34478.6m\hat{x}_{10,10} = 34029.5 + 0.2 \left( 36275 - 34029.5 \right) = 34478.6m
x˙^10,10=124.37+0.1(36275−34029.55)=169.28m/s\hat{\dot{x}}_{10,10} = 124.37 + 0.1 \left( \frac{36275 - 34029.5}{5} \right) = 169.28m/s
x^11,10=34478.6+5×169.28=35325m\hat{x}_{11,10} = 34478.6 + 5 \times 169.28 = 35325m
x˙^11,10=169.28m/s\hat{\dot{x}}_{11,10} = 169.28m/s

Results analysis

The following charts compare the true, measured, and estimated values for the range and velocity for the first 75 seconds.

Range vs. Time Velocity vs. Time

You can see a constant gap between true or measured values and estimates. The gap is called a lag error. Other common names for the lag error are:

  • Dynamic error
  • Systematic error
  • Bias error
  • Truncation error

The lag error appears during the acceleration period. A significant lag error can result in the target loss. The lag error is unacceptable in certain applications, such as missile guidance or air defense.

Example summary

We've examined the lag error caused by target acceleration.

Example 4 – Tracking accelerating aircraft with the α−β−γ\alpha -\beta -\gamma filter

In this example, we tackle the lag error using the α−β−γ\alpha -\beta -\gamma filter. The aircraft is moving with a constant acceleration.

The α−β−γ\alpha -\beta -\gamma filter

The α−β−γ\alpha -\beta -\gamma filter (sometimes called g-h-k filter) considers a target acceleration. Thus, the State Extrapolation Equations become:

Results analysis

The following charts compare the true, measured, and estimated values for the range, velocity, and acceleration for the first 50 seconds.

Range vs. Time Velocity vs. Time Acceleration vs. Time

Example summary

As you can see, the α−β−γ\alpha -\beta -\gamma filter with dynamic model equations that include acceleration can track the target with constant acceleration and eliminate the lag error.

But what happens in the case of a maneuvering target? The target can suddenly change the flight direction by making a maneuver. The dynamic model of the target can also include a jerk (changing acceleration). In such cases, the α−β−γ\alpha -\beta -\gamma filter with constant α−β−γ\alpha -\beta -\gamma coefficients produces estimation errors and, in some cases, loses the target track.

The Kalman filter can handle uncertainty in the dynamic model. It is our next topic, right after the summary.

Summary of the α−β−(γ)\alpha -\beta -(\gamma) filter

There are many types of α−β−(γ)\alpha -\beta -(\gamma) filters, and they are based on the same principle:

  • The current state estimation is based on the state update equations.
  • The following state estimation (prediction) is based on the dynamic model equations.

The main difference between these filters is the selection of weighting coefficients α−β−(γ)\alpha -\beta -(\gamma). Some filter types use constant weighting coefficients; others compute weighting coefficients for every filter iteration (cycle).

The choice of the α\alpha, β\beta and γ\gamma is crucial for proper functionality of the estimation algorithm.

What should be the α−β−(γ)\alpha -\beta -(\gamma) parameters?

I described the α−β−(γ)\alpha -\beta -(\gamma) filter as an introductory to the Kalman Filter, thus, I won't cover this topic. The curious reader can find many books and papers on this topic. As a reference, I would recommend the following:

Dirk Tenne, Tarunraj Singh. “Optimal Design of α−β−(γ)\alpha -\beta -(\gamma) Filters”. State University of New York at Buffalo.

Another important issue is the initiation of the filter, i.e., providing the initial value for the first filter iteration.

The following list includes the most popular α−β−(γ)\alpha -\beta -(\gamma) filters:

  • Wiener Filter
  • Bayes Filter
  • Fading-memory polynomial Filter
  • Expanding-memory (or growing-memory) polynomial Filter
  • Least-squares Filter
  • Benedict–Bordner Filter
  • Lumped Filter
  • Discounted least-squares α−β\alpha -\beta Filter
  • Critically damped α−β\alpha -\beta Filter
  • Growing-memory Filter
  • Kalman Filter
  • Extended Kalman Filter
  • Unscented Kalman Filter
  • Extended Kalman Filter
  • Gauss-Hermite Kalman Filter
  • Cubature Kalman Filter
  • Particle Filter

I hope to write a tutorial about some of these filters. But this tutorial is about the Kalman Filter, which is the topic of the following examples.