Home > src > demos > multisignal_demo > multisignal_plot_color.m

multisignal_plot_color

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

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