首页 > 代码库 > 关于卡尔曼滤波(Kalman Filter)的很好讲解

关于卡尔曼滤波(Kalman Filter)的很好讲解

http://bilgin.esme.org/BitsAndBytes/KalmanFilterforDummies

C#代码:

 1 double[] Data = http://www.mamicode.com/new double[] { 0.39, 0.50, 0.48, 0.29, 0.25, 0.32, 0.34, 0.48, 0.41, 0.45 }; 2         private void kalman() 3         { 4             sb = new StringBuilder(); 5            for(int j=0;j<50;j++) 6                 for (int i = 0; i < Data.Length; i++) 7                 { 8                     double k = lp / (lp + 0.1); 9                     double x = lx + k * (Data[i] - lx);10                     double p = (1 - k) * lp;11                     sb.Append(string.Format("{0}:  {1:F3};  {2:F3};  {3:F3} \n", i, Data[i], x, p));12                     richTextBox1.BeginInvoke(new EventHandler(delegate13                     {14                         richTextBox1.Text = sb.ToString();15                         richTextBox1.SelectionStart = richTextBox1.TextLength;16                         richTextBox1.ScrollToCaret();17                     }));18                     Thread.Sleep(1000);19                     lx = x;20                     lp = p;21                 }22         }

经多次迭代,p值得到很好收敛,是不是很简单,但实际使用还需要完善模型,调整速度、加速度、测量噪声等参数!

关于卡尔曼滤波(Kalman Filter)的很好讲解