How to apply Kalman filter on time series?

13 views (last 30 days)
Leo
Leo on 14 Apr 2014
Answered: Benjamin on 1 Sep 2014
I have time series from stock market and want to apply the Kalman Filter. I read the samples about the setup of the Filter and they all work with some kind of matrizes. The command dspadpt3 gives me some weird mask which I have no conlcusion about handling it.
So, my main purpose would be so apply the Filter on a time series and see how it is adapted resp. hulled in (var resp. covar?).
Is there a hint resp. sample how to start the stuff? (e.g. how to get the matrixes, how to continue for a plot, etc.)

Answers (2)

Royi Avital
Royi Avital on 14 Apr 2014
Edited: Royi Avital on 14 Apr 2014
Kalman Filter is pretty straight forward, why not write it yourself?
You can see all needed here:
Now all you need is to define the parameters and use '/' and '\' wisely :-).
  1 Comment
Leo
Leo on 15 Apr 2014
Why not write it by myself? Hm' good question. I think the main reason is that I didn't understand the details behind it. After reading the wikipedia I have a better idea about the workflow - the big picture - thx for the hint. But still lack the practical approach. I am unclear about some matrix in the article.
IFF I take the truck example, than I have e.g. no idea how to take w_k ~ N(0,Q). Also, can I take it for stock-samples cause there is no velocity, i.e. no quadratic curve? Is there as well a variance resp. co-variance included in the model?
If I take the python-sample than I get an idea how a straight forward implementation might look like. But there I have the problem what might be a truth value (variable x) for a stock value (?) and how to set up the normal distribution on an array with variance 0.1? And shouldn't be the variance adapted over the time?
If you could lend me a helping hand this I would highly appreciate.

Sign in to comment.


Benjamin
Benjamin on 1 Sep 2014
Is there anyone can give code example?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!