File Exchange

## An Intuitive Introduction to Kalman Filter

version 1.0 (7.21 KB) by

A simplified tutorial example to the usage of Kalman Filter

4.11111
17 Ratings

Updated

The purpose of this tutorial is to illustrate the usage of Kalman Filter by a simple example.

The problem: Predict the position and velocity of a moving train 2 seconds ahead, having noisy measurements of its positions along the previous 10 seconds (10 samples a second).

Ground truth: The train is initially located at the point x = 0 and moves along the X axis with constant velocity V = 10m/sec, so the motion equation of the train is X = X0 + V*t. Easy to see that the position of the train after 12 seconds will be x = 120m, and this is what we will try to find.

Approach: We measure (sample) the position of the train every dt = 0.1 seconds. But, because of imperfect apparature, weather etc., our measurements are noisy, so the instantaneous velocity, derived from 2 consecutive position measurements (remember, we measure only position) is innacurate. We will use Kalman filter as we need an accurate and smooth estimate for the velocity in order to predict train's position in the future.

We assume that the measurement noise is normally distributed, with mean 0 and standard deviation SIGMA

SG Wang

### SG Wang (view profile)

nice work and well explained

SG Wang

Asaf Zebulon

Paras Maharjan

### Paras Maharjan (view profile)

This is the best implementation of Kalman Filter using simple example I ever have found. Thank you for sharing.

SOHAN BEHURA

Matteo Bodini

### Hadas (view profile)

very nice and simple

Alexander

Perfect tutorial

Alex

### Alex (view profile)

This was SUPER helpful. Thanks!

Justin Fernandes

### Justin Fernandes (view profile)

thank you. Very helpful.

Alex Feinman

### Alex Feinman (view profile)

Clear demonstration of basic capabilities of the Kalman filter.

dan lon

ok

OnlyD Log

Excellent intro tu KFiltering!

ihsan ul haq

good tutorial for Kalman Filter.

s k

nuri agab

thanks

Daniel Porta

Dimitri u always say that close all and clear all is a bad habit... explain which one is a good one then!

Alireza Key

it's good but i think u could add more comment and more explain ... but it's useful for every who want have quick start in Kalman Filter...
tanks alex

Dimitri Shvorob

And anyway, what does it add to Michael Kleder's submission? (Nothing).

Dimitri Shvorob

Correction: this is not a 'tutorial', but 'one commented program'. Of course, it can still be helpful. Note on programming: 'close all,
clear all' is bad form.

##### MATLAB Release
MATLAB 7.1.0 (R14SP3)
##### Acknowledgements

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

Play today