clear;
X(1,1)=0.950;
X(2,1)=0.004;
X(3,1)=0.004;%初值
R = 0.0001;
tf = 4000; %仿真长度
N = 1000; %粒子数目
P = 0.0001;
XhatPart1 = X(1,1); %xhatPart=x=0.1
XhatPart2 = X(2,1);
XhatPart3 = X(3,1);
% Initialize the particle filter. 初始化粒子滤波,xpart值用来在不同时刻生成粒子
for i = 1 : N
Xpart(1,i) = X(1,1)+ wgn(1,1,10*log10(0.0001));
Xpart(2,i) = X(2,1)+ wgn(1,1,10*log10(0.0001));
Xpart(3,i) = X(3,1)+ wgn(1,1,10*log10(0.0001));
end %初始化xpart(i)为生成的随机粒子(有时考虑到精度会手动初始化)
XArr1 = X(1,1); %存放数组
XArr2 = X(2,1);
XArr3 = X(3,1);
XhatPartArr1 = XhatPart1; %xhatPartArr = [xhatPart]=0.1;存放数组
XhatPartArr2 = XhatPart2;
XhatPartArr3 = XhatPart3;
close all;%cl