Code covered by the BSD License  

Highlights from
ensemble kalman filter


4.0 | 2 ratings Rate this file 48 Downloads (last 30 days) File Size: 3.86 KB File ID: #31093

ensemble kalman filter



18 Apr 2011 (Updated )

This program uses the ensemble kalman filter to estimate a system's state.

| Watch this File

File Information

The algorithm used in this code is referenced from the following:
S Gillijns et al "What Is the Ensemble Kalman Filter and How Well Does it Work?"
Proceedings of the 2006 American Control Conference, Minneapolis, Minnesota, USA, June 14-16, 2006, pp 4448-4453.


Required Products Symbolic Math Toolbox
MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
01 Nov 2013 Colette  
01 Nov 2013 Colette


Thank you for your work on this file. It has been helpful to me as I begin learning Kalman Filter.

I am having a few issues with the code and was wondering if anyone else was too. Matlab is not my primary software, so I am wondering if it might be something simple (perhaps I need additional toolboxes). When I try to run the example, I get the following errors:

Error using sym/subs>normalize (line 206)
Entries in OLD must be scalar.

Error in sym/subs>mupadsubs (line 136)
[X2,Y2,symX,symY] = normalize(X,Y); %#ok

Error in sym/subs (line 124)
G = mupadsubs(F,X,Y);

Error in ensemblekfilter3 (line 63)
x_true=subs(f,var_vector,x_true)+w.*randn(p1,1); %compute true value of state at next
time step

It seems I have found a solution by changing the loop to be:
for j=1:p1 %create vector containing variables x1 to xn
eval(sprintf(' syms x%d', j));
temp = sprintf('x%d ',j);
var_vector = [var_vector; sym(temp)];
%var_vector=[var_vector sprintf('x%d ',j)];

If anyone else has experienced similar errors or has further insight into mine, it would be appreciated.


25 Jun 2012 Abel Galois

Thanks a lot!

16 Jun 2011 dwight nwaigwe

Hi Albert, thanks for catching that serious typo. I just corrected it and uploaded the new version.

06 Jun 2011 albert chiang

Thank you for your work, i have found a mistake in your recent version. In line 71, yforbar=mean(ybar,2), i think it should be yforbar=mean(yfor,2).

16 May 2011 albert chiang

have a look at!

19 Apr 2011

changed description

20 Apr 2011

made minor adjustments to file such as inserting comments

10 May 2011

in the first few lines of the comments, I changed y+1 to y_new and x+1 to x_new

16 Jun 2011

Corrected line 71 as Albert Chiang mentioned.

It should be y_forbar=mean(y_for,2);
not y_forbar=mean(y_bar,2);

05 Apr 2013

Cosmetic changes: consolidated comments, removed the comment num_iterations = 20 as it wasn't necessary, and i added spaces and indents. i did these edits in notepad. i still have the original file in zipped folder to be safe

08 Apr 2013

whoops, i meant to say i deleted "num_members" = 20 from comments since it implied you must supply a variable with that name.

29 Oct 2013

Renamed variables and reorganized code for clarity. The original version is the .m file and the modified one is the .txt file. I haven't tested the .txt file but it should work.

Contact us