Overview

"If you can't explain it simply, you don't understand it well enough."

Albert Einstein

About this tutorial

The Kalman Filter is an easy topic. However, many tutorials are not easy to understand. Most require extensive mathematical background which makes them difficult to understand. Also, most lack practical numerical examples.

I've decided to write a tutorial that is based on numerical examples and provides easy and intuitive explanations.

Some of the examples are from the radar world where Kalman Filtering is used extensively (mainly for the target tracking). However, the principles that are presented here can be applied to any field where estimation and prediction are required.

The tutorial includes three parts:

  • Part 1 – an introduction to the Kalman Filter. This part is based on eight numerical examples. There is no requirement for a priori mathematical knowledge. All the necessary mathematical background is provided in the tutorial, and it includes terms such as mean, variance and standard deviation. That's it. You can call it "The Kalman Filter for Dummies" if you like. After reading the first part, you will be able to understand the concept of the Kalman Filter and develop “Kalman Filter intuition”. You will also be able to design a one-dimensional Kalman Filter.
  • Part 2 – multidimensional Kalman Filter (Kalman Filter in matrix notation). This a bit more advanced. Most real-life Kalman Filter implementations are multidimensional and require basic knowledge of Linear Algebra (only matrix operations). The necessary mathematical background is also provided in the tutorial. The mathematical derivation of the Kalman Filter and dynamic systems modelling are also included. After reading the second part, you will be able to understand the math behind the Kalman Filter. You will also be able to design a multidimensional Kalman Filter.
  • Part 3 – advanced topics. This part is for advanced readers, and it requires some mathematical background, mainly in area of statistics. Currently, this part is in the planning process. It is supposed to include Extended Kalman Filter, Unscented Kalman Filter, Kalman Filter implementation in different real-life applications and much more.
Get notified about new content
I'll will never spam or share your email with anyone else.
Captcha

"The road to learning by precept is long, by example short and effective."

Lucius Seneca

About the author

My name is Alex Becker. I am from Israel. I am an engineer with more than 15 years of experience in the Wireless Technologies field. As a part of my work, I had to deal with Kalman Filters, mainly for tracking applications.

Constructive criticism is always welcome. I would greatly appreciate your comments and suggestions. Please drop me an email.

The examples in this tutorial don't exemplify any modes, methodologies, techniques or parameters employed by any operational system known to the author.
Alex Becker

About the Kalman Filter

Most modern systems are equipped with numerous sensors that provide estimation of hidden (unknown) variables based on a series of measurements. For example, a GPS receiver provides location and velocity estimation, where location and velocity are the hidden variables and differential time of the satellites’ signals’ arrival are the measurements.

One of the biggest challenges of tracking and control systems is providing accurate and precise estimation of the hidden variables in the presence of uncertainty. In GPS receivers, the measurement uncertainty depends on many external factors such as thermal noise, atmospheric effects, slight changes in satellite positions, receiver clock precision and many more.

The Kalman Filter is one of the most important and common estimation algorithms. The Kalman Filter produces estimates of hidden variables based on inaccurate and uncertain measurements. Also, the Kalman Filter provides a prediction of the future system state based on past estimations.

The filter is named after Rudolf E. Kálmán (May 19, 1930 – July 2, 2016). In 1960, Kálmán published his famous paper describing a recursive solution to the discrete-data linear filtering problem.

Today the Kalman filter is used in Tracking Targets (Radar), location and navigation systems, control systems, computer graphics and much more.

Rudolf E. Kálmán

The prediction requirement

Before diving into the Kalman Filter explanation, let's first understand the need for a prediction algorithm.

As an example, let us consider a radar tracking algorithm.

Tracking Radar

The tracking radar sends a pencil beam in the direction of the target. Assume a track cycle of 5 seconds. In other words, every 5 seconds, the radar revisits the target by sending a dedicated track beam in the direction of the target.

After sending the beam, the radar estimates the current target position and velocity. Also, the radar estimates (or predicts) the target position at the next track beam.

The future target position can be easily calculated using Newton's motion equations:

\[ x= x_{0} + v_{0} \Delta t+ \frac{1}{2}a \Delta t^{2} \]
Where:
\( x \) is the target's position
\( x_{0} \) is the target's initial position
\( v_{0} \) is the target's initial velocity
\( a \) is the target's acceleration
\( \Delta t \) is the time interval (5 seconds in our example)

In three dimensions, the Newton's motion equations can be written as a system of equations:

\[ \left\{\begin{matrix} x= x_{0} + v_{x0} \Delta t+ \frac{1}{2}a_{x} \Delta t^{2}\\ y= y_{0} + v_{y0} \Delta t+ \frac{1}{2}a_{y} \Delta t^{2}\\ z= z_{0} + v_{z0} \Delta t+ \frac{1}{2}a_{z} \Delta t^{2} \end{matrix}\right. \]

The target parameters \( \left[ x, y, z, v_{x},v_{y},v_{z},a_{x},a_{y},a_{z} \right] \) are called a System State. The current state is the input to the prediction algorithm and the next state (the target parameters at the next time interval) is the output of the algorithm.

The above set of equations is called a Dynamic Model (or a State Space Model). The Dynamic Model describes the relationship between input and output.

Let's return to our example. As we can see, if the current state and the dynamic model are known, the next target state can be easily predicted.

Well, they are not. First of all, the radar measurement is not absolute. It includes a random error (or uncertainty). The error magnitude depends on many parameters, such as radar calibration, the beam width, the magnitude of the return echo, etc. The error included in the measurement is called Measurement Noise.

Furthermore, the target motion is not strictly aligned to motion equations due to external factors such as wind, air turbulence, pilot maneuvers, etc. The dynamic model error (or uncertainty) is called Process Noise.

Due to Measurement Noise and Process Noise, the estimated target position can be far away from the real target position. In this case, the radar might send the track beam in the wrong direction and miss the target.

In order to improve the radar tracking performance, we need a prediction algorithm that takes into account process uncertainty and measurement uncertainty.

The most widely used prediction algorithm is the Kalman Filter.

Next