⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tracking_demo.m

📁 基于matlab的卡尔曼滤波程序对相关研究有借鉴价值
💻 M
字号:
% Make a point move in the 2D plane% State = (x y xdot ydot). We only observe (x y).% This code was used to generate Figure 15.9 of "Artificial Intelligence: a Modern Approach",% Russell and Norvig, 2nd edition, Prentice Hall, 2003.% X(t+1) = F X(t) + noise(Q)% Y(t) = H X(t) + noise(R)ss = 4; % state sizeos = 2; % observation sizeF = [1 0 1 0; 0 1 0 1; 0 0 1 0; 0 0 0 1]; H = [1 0 0 0; 0 1 0 0];Q = 0.1*eye(ss);R = 1*eye(os);initx = [10 10 1 0]';initV = 10*eye(ss);seed = 9;rand('state', seed);randn('state', seed);T = 15;[x,y] = sample_lds(F, H, Q, R, initx, T);[xfilt, Vfilt, VVfilt, loglik] = kalman_filter(y, F, H, Q, R, initx, initV);[xsmooth, Vsmooth] = kalman_smoother(y, F, H, Q, R, initx, initV);dfilt = x([1 2],:) - xfilt([1 2],:);mse_filt = sqrt(sum(sum(dfilt.^2)))dsmooth = x([1 2],:) - xsmooth([1 2],:);mse_smooth = sqrt(sum(sum(dsmooth.^2)))figure(1)clf%subplot(2,1,1)hold onplot(x(1,:), x(2,:), 'ks-');plot(y(1,:), y(2,:), 'g*');plot(xfilt(1,:), xfilt(2,:), 'rx:');for t=1:T, plotgauss2d(xfilt(1:2,t), Vfilt(1:2, 1:2, t)); endhold offlegend('true', 'observed', 'filtered', 3)xlabel('x')ylabel('y')% 3x3 inchesset(gcf,'units','inches');set(gcf,'PaperPosition',[0 0 3 3])  %print(gcf,'-depsc','/home/eecs/murphyk/public_html/Bayes/Figures/aima_filtered.eps');%print(gcf,'-djpeg','-r100', '/home/eecs/murphyk/public_html/Bayes/Figures/aima_filtered.jpg');figure(2)%subplot(2,1,2)hold onplot(x(1,:), x(2,:), 'ks-');plot(y(1,:), y(2,:), 'g*');plot(xsmooth(1,:), xsmooth(2,:), 'rx:');for t=1:T, plotgauss2d(xsmooth(1:2,t), Vsmooth(1:2, 1:2, t)); endhold offlegend('true', 'observed', 'smoothed', 3)xlabel('x')ylabel('y')% 3x3 inchesset(gcf,'units','inches');set(gcf,'PaperPosition',[0 0 3 3])  %print(gcf,'-djpeg','-r100', '/home/eecs/murphyk/public_html/Bayes/Figures/aima_smoothed.jpg');%print(gcf,'-depsc','/home/eecs/murphyk/public_html/Bayes/Figures/aima_smoothed.eps');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -