Code covered by the BSD License  

Highlights from
Kalman Filter Package


4.5 | 11 ratings Rate this file 204 Downloads (last 30 days) File Size: 205 KB File ID: #38302
image thumbnail

Kalman Filter Package



Implements Kalman Filter, Extended Kalman Filter, Dual Kalman Filter, and Square Root Kalman Filters

| Watch this File

File Information

This package implements the following Kalman filters:

1) Standard Kalman Filter
2) Extended Kalman Filter
3) Dual Kalman Filter
4) Square Root Kalman Filter

This package also contains instructive examples for each filter type demonstrating their practical application.

In all 4 cases, the KF functions accept as input noisy samples of a multi-dimensional system and produce the KF estimate of the true system state based on the time-varying process/noise covariances inherent in the noisy samples.

Exponentially-weighted (or unweighted) moving averages are used to estimate the time-varying system covariances from the noisy measurements.

The Standard Kalman Filter is the most basic KF implementation. It assumes a model that the noisy measurements contain the true system state plus white noise.

The Extended Kalman Filter is a generalization of the Standard Kalman Filter that allows the user to specify a nonlinear system model, which is then iteratively linearized during EKF execution.

The Dual Kalman filter simultaneously solves two Standard Kalman filter problems:

1) Fits an auto-regressive model to the data and applies a Kalman Filter to update the AR model

2) Applies the AR model at each iteration before performing the Standard KF update

Square Root Kalman Filters are a more robust and numerically stable method to perform Standard/Dual Kalman Filtering, especially when the covariance matrices of interest are ill-conditioned or nearly not positive definite. The Square Root Kalman Filtering idea is to propagate the process error covariance P in square root form P = U D U', where U and D are iteratively updated and P is not explicitly computed. Doing so will guarantee P is positive definite and thus increase the numerically stability of the KF.


This file inspired 1 D Standard Kalman Filter (Simulink Model & Program).

Required Products MATLAB
MATLAB release MATLAB 7.8 (R2009a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (18)
14 Aug 2014 Brian Moore

@tverskoj Why the 1 star rating? Please provide feedback so I can improve the submission!

14 Aug 2014 Brian Moore

@Aaron: The Dual Kalman filter is used to implement the auto-regressive Kalman filter (see StandardARKalmanFilter.m)

14 Aug 2014 Aaron

Hi, I cannot find the Dual Kalman filter in this package, has it been removed?

06 Aug 2014 Brian Moore

@Mike Good point - I assumed the most basic "white noise" model (A = I, B = I, etc.) for simplicity so that the user can quickly run filter without doing any modeling.

Of course, if you do have a model for your data, you should be able to follow any basic Kalman filter reference to see where to insert the model matrices

06 Aug 2014 Mikes Vines  
06 Aug 2014 Mikes Vines

Why did you not include A, B, u, and H in your equations?

17 Mar 2014 tverskoj  
22 Sep 2013 Justin  
22 Aug 2013 liliaceae  
12 Aug 2013 Guosheng Huang

Very helpful for me, thanks so much!

01 Aug 2013 Smahato

any example on structural dynamics problem

08 May 2013 Amit Bermano

Easy to use, good default values, readable, great!
Thanks a lot

27 Feb 2013 afu2007 ??

could you tell me the reference for StandardCovEst.m?
thank you!

13 Feb 2013 zhang blue

nice code ,thanks !

31 Dec 2012 W. Chong  
21 Nov 2012 Brian Moore

Hi Alexander,

Make sure you add the Kalman Filters directory and *all* subdirectories to your MATLAB path before running any of the scripts.

For instance, to address your specific problem, EWMA() is a function located in "MA Methods" subdirectory. But you will probably get more errors if you don't add the other subdirectories ("Covariance Estimation Methods", "Linear Algebra Methods", and "Square Root Filter Methods") to your path as well.


21 Nov 2012 Alexander

Getting a problem with Demo2
??? Error using ==> eval
Undefined function or method 'EWMA' for input arguments of type

Error in ==> StandardKalmanFilter at 113
eval(['smoothed_z = ' MAType '(z,MAlen);']);

Error in ==> KF_Demo2 at 41
[x_kf KF] = StandardKalmanFilter(z,MAlen,N);

28 Sep 2012 Youssef KHMOU  

Contact us