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

Albert EinsteinKalman Filter is an easy topic. However, many tutorials are not easy to understand. Most of the tutorials require extensive mathematical background that makes it difficult to understand. As well, most of the tutorials are lacking 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 the Kalman Filtering is used extensively (mainly for the target tracking), however, the principles that are presented here can be applied in any field where estimation and prediction are required.

The tutorial includes three parts:

- Part 1 – an introduction to Kalman Filter. This part is based on eight numerical examples. There is no requirement for a priory 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 the "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). It is a bit more advanced. Most of the 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 statistics area. Currently, this part is in the process of planning. It is supposed to include Extended Kalman Filter, Unscented Kalman Filter, Kalman Filter implementation in different real-life applications and much more.

Currently, all numerical examples are presented in metric units. I am planning to add imperial units option later.

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

Lucius SenecaMy 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.

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

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

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. As well, the Kalman Filter provides a prediction of the future system state, based on the past estimations.

The filter is named after Rudolf E. Kalman (May 19, 1930 – July 2, 2016). In 1960, Kalman 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.

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

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

The tracking radar sends a pencil beam in the direction of the target. Assume the track cycle of 5 seconds. Thus 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. As well, 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:

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:

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 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 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, it is 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 a 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 a Process Noise.

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

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

The most widely used prediction algorithm is the Kalman Filter.