Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am now learning the Kalman filter and wants to implement it by hand to understand it better. To be specific I want to first simulate a sequence of data by $$ \dot x=Ax+Bw\\ y=Cx+Dv,\\ E[x(0)]=0,E[x(0)x'(0)]=P_0, $$ where $w,v$ are white noise processes with unit variance. Then I need to construct the Kalman filter by $$ \dot{\hat x}=A\hat x+QC'(y-C\hat x), \hat x(0)=0 $$ where $Q$ solves the ricatti differential equation $$ \dot Q=AQ+QA'-QC'CQ+C'C,Q(0)=P_0. $$ I have two questions:

  1. How do I generate the sequence of data governed by a differential equation?

  2. How do I solve the ricatti differential equation?

I know this post shows no effort, but I am new to mathematica and have no idea where to start (especially that I cannot generate the data needed, which stops me from any progress). Any hint is appreciated.

share|improve this question
If you have version 8 or higher, look up RicattiSolve‌​, KalmanEstimator and the general guide to control systems in the documentation. – Verbeia Apr 7 '13 at 0:55
Regarding 1. you could use NestList. – b.gatessucks Apr 7 '13 at 7:01
A pre-v9 related Wolfram Library Archive entry: Kalman Filter. – István Zachar Apr 7 '13 at 7:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.