• 大小: 3KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-08
  • 语言: Matlab
  • 标签: matlab  UKF  

资源简介

这个关于怎么实现UKF的代码,关于实现步骤及实现过程可看我的博客: https://blog.csdn.net/caokaifa/article/details/83041371

资源截图

代码片段和文件信息

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  无迹Kalman滤波在目标跟踪中的应用
%  详细原理介绍及中文注释请参考:
%  《卡尔曼滤波原理及应用-MATLAB仿真》,电子工业出版社,黄小平著。
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function UKF
clc;clear;
T=1; 
N=60/T; 
X=zeros(4N); 
X(:1)=[-100220020]; 
Z=zeros(1N); 
delta_w=1e-3; 
Q=delta_w*diag([0.51]) ;
G=[T^2/20;T0;0T^2/2;0T];
R=5; 
F=[1T00;0100;001T;0001];
x0=200; 
y0=300;
Xstation=[x0y0]; 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
w=sqrtm(R)*randn(1N);
for t=2:N
    X(:t)=F*X(:t-1)+G*sqrtm(Q)*randn(21);
end
for t=1:N
    Z(t)=Dist(X(:t)Xstation)+w(t);
end
L=4;
alpha=1;
kalpha=0;
belta=2;
ramda=alpha^2*(L+kalpha)-L;
for j=1:2*L+1
    Wm(j)=1/(2*(L+ramda));
    Wc(j)=1/(2*(L+ramda));
end
Wm(1)=ramda/(L+ramda);
Wc(1)=ramda/(L+ramda)+1-alpha^2+belta;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Xukf=zeros(4N);
Xukf(:1)=X(:1);
P0=eye(4);
for t=2:N
    xestimate= Xukf(:t-1);
    P=P0;
    cho=(chol(P*(L+ramda)))‘;
    for k=1:L
        xgamaP1(:k)=xestimate+cho(:k);
        xgamaP2(:k)=xestimate-cho(:k);
    end
    Xsigma=[xestimatexgamaP1xgamaP2];
    Xsigmapre=F*Xsigma;
    Xpred=zeros(41);
    for k=1:2*L+1
        Xpred=Xpred+Wm(k)*Xsigmapre(:k);
    end
    Ppred=zeros(44);
    for k=1:2*L+1
        Ppred=Ppred+Wc(k)*(Xsigmapre(:k)-Xpred)*(Xs

评论

共有 条评论