Home > src > demos > mt_demo > kf_mt_plot2d.m

kf_mt_plot2d

PURPOSE ^

Script for plotting 2D Gaussian signals estimated with RBMCDA

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Script for plotting 2D Gaussian signals estimated with RBMCDA

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001   % Script for plotting 2D Gaussian signals estimated with RBMCDA
0002 
0003   %
0004   %       Copyright (C) 2005 Simo Särkkä
0005   %                     2008 Jouni Hartikainen
0006   %
0007   % This software is distributed under the GNU General Public
0008   % Licence (version 2 or later); please refer to the file
0009   % Licence.txt, included with the software, for details.
0010 
0011   %
0012   % Load and collect the trajectories
0013   %
0014   [FM,FP,SM,SP,Times] = kf_nmcda_collect(SS,A,Q);
0015 
0016   
0017   save_figures = 0;
0018 
0019   %
0020   % Plot the filtered data
0021   %
0022   hold off;
0023 
0024   set(gcf,'PaperType','a4');
0025   set(gcf,'PaperPosition',[0.25 2.5 3.8 3]);
0026   set(gca,'Position',[0.25 2.5 3.8 3]);
0027   clf;
0028   axis off;
0029 
0030   for j=1:4
0031     XX = [];
0032     for kk=1:nsteps
0033       if ~isempty(states{j,kk})
0034     XX = [XX states{j,kk}];
0035       end
0036     end
0037     if ~isempty(XX)
0038       h=plot(XX(1,:),XX(2,:),'--');
0039       set(h,'linewidth',2);
0040       set(h(1),'color',[0.5 0.5 0.5]);
0041       hold on;
0042     end
0043   end
0044   h=plot(Y(1,:),Y(2,:),'o');
0045   set(h,'markersize',2);
0046   set(h(1),'color',[0.5 0.5 0.5]);
0047   hold on;
0048 
0049   cols = repmat((0:0.1:0.8)',1,3);
0050 
0051   c = 0;
0052   tmp = [SS{end,:}];
0053   W = [tmp.W];
0054   [mx,ind] = max(W);
0055 
0056   for j=1:size(FM,1)
0057     if ~isempty(FM{j,ind}) & j~= 7
0058       t = Times{j,ind};
0059       m = FM{j,ind};
0060       c = c + 1;
0061       if c == size(cols,1)
0062     c = 1;
0063       end
0064 
0065       h=plot(m(1,:),m(2,:),'-');
0066       set(h(1),'color',[0 0 0]);
0067       set(h(1),'linewidth',2);
0068 
0069       h=plot(m(1,1),m(2,1),'ko');
0070       set(h(1),'markersize',10);
0071     end
0072   end
0073   if save_figures
0074       print('-dpsc',sprintf('filtered2-%.2f-%.2f.ps',alpha,beta));
0075   end
0076   pause;
0077 
0078   %
0079   % Plot the number of signals in
0080   % the most likely particle
0081   %
0082   [mx,ind] = max(W);
0083   clf;
0084   count = [];
0085   for k=1:size(SS,1)
0086     count = [count length(SS{k,ind}.M)];
0087   end
0088   size(T)
0089   size(NT)
0090   size(count)
0091   h=plot(T,NT,'--',T,count,'-');
0092   set(h,'linewidth',2);
0093   set(h(1),'color',[0.5 0.5 0.5]);
0094   set(h(2),'color',[0.0 0.0 0.0]);
0095   legend('True Number of Targets',...
0096      'Estimated Number of Targets');
0097   xlabel('Time');
0098 
0099   axis([min(T) max(T) 0 max(count)+1]);
0100   fprintf('Number of targets \\alpha=%.2f \\beta=%.2f\n',alpha,beta);
0101   if save_figures
0102       print('-dpsc',sprintf('number2-%.2f-%.2f.ps',alpha,beta));
0103   end
0104   pause;
0105   
0106   %
0107   % Plot the smoothed data
0108   %
0109   hold off;
0110   clf;
0111   axis off;
0112 
0113   for j=1:4
0114     XX = [];
0115     for kk=1:nsteps
0116       if ~isempty(states{j,kk})
0117     XX = [XX states{j,kk}];
0118       end
0119     end
0120     if ~isempty(XX)
0121       h=plot(XX(1,:),XX(2,:),'--');
0122       set(h,'linewidth',2);
0123       set(h(1),'color',[0.5 0.5 0.5]);
0124       hold on;
0125     end
0126   end
0127   h=plot(Y(1,:),Y(2,:),'ro');
0128   set(h,'markersize',2);
0129   set(h(1),'color',[0.5 0.5 0.5]);
0130   hold on;
0131 
0132   cols = repmat((0:0.1:0.8)',1,3);
0133 
0134   c = 0;
0135   [mx,ind] = max(W);
0136 
0137   for j=1:size(FM,1)
0138     if ~isempty(FM{j,ind})       
0139       t = Times{j,ind};
0140       m = SM{j,ind};
0141       c = c + 1;
0142       if c == size(cols,1)
0143     c = 1;
0144       end
0145       h=plot(m(1,:),m(2,:),'-');
0146       set(h(1),'color',[0 0 0]);
0147       set(h(1),'linewidth',2);
0148 
0149       h=plot(m(1,1),m(2,1),'ko');
0150       set(h(1),'markersize',10);
0151     end
0152   end
0153   if save_figures
0154       print('-dpsc',sprintf('smoothed2-%.2f-%.2f.ps',alpha,beta));
0155   end
0156   pause;
0157

Generated on Tue 19-Feb-2008 16:59:37 by m2html © 2003