下载此文档

粒子滤波的仿真.docx


文档分类:研究报告 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
v % Particle filter example, adapted from Gordon, Salmond, and Smith paper. x= ; % initial state Q= 1;% process noise covariance R= 1;% measurement noise covariance tf= 50; % simulation length N= 100; % number of particles in the particle filter xhat = x;% 有疑问 P= 2;% 有疑问 xhatPart = x;% 有疑问% Initialize the particle filter. for i=1:N xpart(i) =x+ sqrt(P) * randn; % 产生 100 个期望值为 x ,方差为 p ,的随机数, 这 100 个随机数满足正太分布 end xArr = [x]; yArr = [x^2 / 20 + sqrt(R) * randn]; xhatArr = [x]; PArr = [P]; xhatPartArr = [xhatPart]; close all; % 关闭程序运行产生的所有窗口。 for k=1: tf% System simulation x= *x+ 25 *x/ (1+ x^2) +8* cos(*(k-1)) + sqrt(Q) * randn;% 状态方程 y= x^2 / 20 + sqrt(R) * randn;% 观测方程% Extended Kalman filter F= + 25 * (1- xhat^2) / (1+ xhat^2)^2; P=F*P* F'+ Q; H= xhat / 10; K=P* H'* (H*P* H'+ R)^(-1); xhat = * xhat + 25 * xhat / (1+ xhat^2) +8* cos(*(k-1));% 预测 xhat = xhat +K* (y- xhat^2 / 20);% 更新 P= (1-K* H)* P; % Particle filter 粒子滤波从这开始 for i=1:N xpartminus(i) = * xpart(i) + 25 * xpart(i) / (1+ xpart(i)^2) +8* cos(*(k-1)) + sqrt(Q) * randn; ypart = xpartminus(i)^2 / 20; vhat =y- ypart;% 观测和预测的差 q(i) = (1/ sqrt(R) / sqrt(2*pi)) * exp(-vhat^2 /2/ R); end % Normalize the likelihood of each a priori estimate. 规范每个先验估计的可能性 qsum = sum(q); for i=1:N q(i) = q(i) / qsum;% 归一化权重 end % Resample. for i=1:Nu= rand; % uniform random number between 0 and 1 qtempsum = 0; for j=

粒子滤波的仿真 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人福建网
  • 文件大小0 KB
  • 时间2016-06-13