其他分享
首页 > 其他分享> > MATLAB卡尔曼滤波-实例

MATLAB卡尔曼滤波-实例

作者:互联网


 % DR_CAN老师的例子
 clc;clear
 ​
 Z = 3*(rand(50,1)*2-1)+50;
 X_hat = zeros(50,1);
 G_K   = zeros(50,1);
 e     = zeros(50,1);
 X_hat(1) = 40;
 e(1)     = 5;
 G_K(1)   = 0;
 ​
 for k = 2:50
     G_K(k) = e(k-1)/(e(k-1)+3);
     X_hat(k) = X_hat(k-1)+G_K(k)*(Z(k)-X_hat(k-1));
     e(k) = (1-G_K(k))*e(k-1);
 end
 figure(1);
 plot(Z);
 hold on
 plot(X_hat)
 legend('测量值','估计值');

 

 

 

标签:Kalman,数据,卡尔曼滤波,滤波,50,实例,zeros,MATLAB,hat
来源: https://www.cnblogs.com/bloghjx/p/15811995.html