Home > src > demos > multisignal_demo > multisignal_plot.m

multisignal_plot

PURPOSE ^

Load and collect the trajectories

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Load and collect the trajectories

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 %
0003 % Load and collect the trajectories
0004 %
0005 [FM,FP,SM,SP,Times] = kf_nmcda_collect(SS,A,Q);
0006 
0007 save_figures = 0;
0008 %
0009 % Plot the data
0010 %
0011 set(gcf,'PaperType','a4');
0012 set(gcf,'PaperPosition',[0.25 2.5 3.8 3]);
0013 set(gca,'Position',[0.25 2.5 3.8 3]);
0014 
0015 clf;
0016 h=plot(T,Y,'o');
0017 set(h(1),'color',[0.5 0.5 0.5]);
0018 set(h,'markersize',2);
0019 set(gca,'FontSize',8);
0020 hold on;
0021 for i=1:length(X)
0022     x = X{i};
0023     ind = find(diff(C(:,i) ~= 0) ~= 0);
0024     ind = [ind;size(C,1)];
0025     k = 1;
0026     for j=1:length(ind)
0027         if C(ind(j),i) ~= 0
0028             h=plot(T(k:ind(j)),x(k:ind(j)));
0029             set(h(1),'color',[0 0 0]);
0030             set(h,'linewidth',2);
0031         end
0032         k = ind(j)+1;
0033     end
0034 end
0035 fprintf('This is the measured/true data.\n<Press enter>\n');
0036 %  print('-depsc',sprintf('data1-%.2f-%.2f.eps',alpha,beta));
0037 if save_figures
0038     print('-dpsc',sprintf('multisignal_data.ps',alpha,beta));
0039 end
0040 pause;
0041 
0042 %
0043 % Plot the filtered results in
0044 % best particle
0045 %
0046 clf;
0047 h=plot(T,Y,'o','markersize',1.0);
0048 set(h(1),'color',[0.5 0.5 0.5]);
0049 set(h,'markersize',2);
0050 set(gca,'FontSize',8);
0051 xlabel('Time');
0052 fprintf('Filtered \\alpha=%.2f \\beta=%.2f\n',alpha,beta);
0053 hold on;
0054 
0055 cols = repmat((0:0.1:0.5)',1,3);
0056 cols = cols(randperm(size(cols,1)),:);
0057 
0058 W = get_weights(S);
0059 [mx,ind] = max(W);
0060 c = 0;
0061 for j=1:size(FM,1)
0062     if ~isempty(FM{j,ind})
0063         t = Times{j,ind};
0064         m = FM{j,ind}(1,:);
0065         s = sqrt(reshape(FP{j,ind}(1,1,:),1,size(FP{j,ind},3)));
0066         c = c + 1;
0067         if c == size(cols,1)
0068             c = 1;
0069         end
0070         h=plot(t,m);
0071         %      set(h(1),'color',cols(c,:));
0072         set(h(1),'color',[0 0 0]);
0073         set(h,'linewidth',2);
0074 
0075         h=plot(t(1),m(1),'ko');
0076         set(h(1),'markersize',10);
0077         set(h(1),'color', [0.0 0.0 0.0]);
0078     end
0079 end
0080 if save_figures
0081     print('-dpsc',sprintf('multisignal_filtered1-%.2f-%.2f.ps',alpha,beta));
0082 end
0083 pause;
0084 
0085 
0086 %
0087 % Plot the filtered results in
0088 % each particle
0089 %
0090 for i=1:length(W)
0091     clf;
0092     h=plot(T,Y,'o');
0093     set(h(1),'color',[0.5 0.5 0.5]);
0094     set(h,'markersize',2);
0095     set(gca,'FontSize',8);
0096     xlabel('Time');
0097     fprintf('(%d/%d) Filtered \\alpha=%.2f \\beta=%.2f\n',i,length(W),alpha,beta);
0098     hold on;
0099 
0100     cols = repmat((0:0.1:0.5)',1,3);
0101     cols = cols(randperm(size(cols,1)),:);
0102 
0103     ind = i;
0104     c = 0;
0105     for j=1:size(FM,1)
0106         if ~isempty(FM{j,ind})
0107             t = Times{j,ind};
0108             m = FM{j,ind}(1,:);
0109             s = sqrt(reshape(FP{j,ind}(1,1,:),1,size(FP{j,ind},3)));
0110             c = c + 1;
0111             if c == size(cols,1)
0112                 c = 1;
0113             end
0114             h=plot(t,m);
0115             %      set(h(1),'color',cols(c,:));
0116             set(h(1),'color',[0 0 0]);
0117             set(h,'linewidth',2);
0118 
0119             h=plot(t(1),m(1),'ko');
0120             set(h(1),'markersize',10);
0121             set(h(1),'color', [0.0 0.0 0.0]);
0122         end
0123     end
0124 
0125     % Uncomment this if you want to plot each particle
0126     %if save_figures
0127     %    print('-dpsc',sprintf('filtered1-%.2f-%.2f-%02d.ps',alpha,beta,i));
0128     %end
0129 end
0130 
0131 %
0132 % Plot the number of signals in
0133 % the most likely particle
0134 %
0135 [mx,ind] = max(W);
0136 clf;
0137 count = [];
0138 for k=1:size(SS,1)
0139     count = [count length(SS{k,ind}.M)];
0140 end
0141 
0142 h=plot(T,NT,'--',T,count,'-');
0143 set(h,'linewidth',2);
0144 set(h(1),'color',[0.5 0.5 0.5]);
0145 set(h(2),'color',[0.0 0.0 0.0]);
0146 legend('True Number of Signals',...
0147     'Estimated Number of Signals');
0148 xlabel('Time');
0149 
0150 axis([min(T) max(T) 0 max(count)+1]);
0151 fprintf('Number of signals \\alpha=%.2f \\beta=%.2f\n',alpha,beta);
0152 if save_figures
0153     print('-depsc',sprintf('number1-%.2f-%.2f.ps',alpha,beta));
0154 end
0155 pause;
0156 
0157 %
0158 % Plot the smoothed result in
0159 % the most likely particle
0160 %
0161 clf;
0162 h=plot(T,Y,'ko');
0163 set(h,'markersize',2);
0164 set(h(1),'color',[0.5 0.5 0.5]);
0165 xlabel('Time');
0166 fprintf('Smoothed \\alpha=%.2f \\beta=%.2f\n',alpha,beta);
0167 hold on;
0168 
0169 [mx,ind] = max(W);
0170 c = 0;
0171 for j=1:size(SM,1)
0172     if ~isempty(SM{j,ind})
0173         t = Times{j,ind};
0174         m = SM{j,ind}(1,:);
0175         s = sqrt(reshape(SP{j,ind}(1,1,:),1,size(SP{j,ind},3)));
0176         c = c + 1;
0177         if c == size(cols,1)
0178             c = 1;
0179         end
0180         %      plot(t,m,'-',t,m-2*s,'--',t,m+2*s,'--');
0181 
0182         h=plot(t,m);
0183         %      set(h(1),'color',cols(c,:));
0184         set(h(1),'color',[0 0 0]);
0185         set(h,'linewidth',2);
0186         h=plot(t(1),m(1),'ko');
0187         set(h(1),'markersize',10);
0188         set(h(1),'color', [0.0 0.0 0.0]);
0189     end
0190 end
0191 if save_figures
0192     print('-dpsc',sprintf('multisignal_smoothed1-%.2f-%.2f.ps',alpha,beta));
0193 end
0194 pause;

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