% for SPIE, K estimation, from Win4.m results

clf

subplot(2,2,1);

plot( xy1_orig(1,:), xy1_orig(2,:), 'k-');
hold on;
plot( xy2_orig(1,:), xy2_orig(2,:), 'k-');
plot( XY_orig(1,:), XY_orig(2,:), 'kx');
for i=1:N_orig
  if( n1(i) )
    k = 1 + XY_offset_orig(i);
    plot( XY_orig(1,k), XY_orig(2,k), 'ko');
  end
  if( n2(i))
    k = n1(i) + 1 + XY_offset_orig(i);
    plot( XY_orig(1,k), XY_orig(2,k), 'ks');
  end
end
axis([0 4 0 4]);
xlabel 'X';
ylabel 'Y'
title '(a) Tracks and Measurements';

% subplot(2,2,2);
% t=[5 10 15 20] ;
% semilogy( t, PK12(:,2), 'k.-');
% hold on
% semilogy( t, PK12(:,1), 'k.-.');
% a = axis;
% axis([ 0 20 a(3:4)]);
% text(1,0.5e-2, [ '\_\_\_  P(K=2)'; ...
%                  '-.-.  P(K=1)  ' ]);
% xlabel 'Time';
% ylabel 'Prob'
% title '(b) Probability of 1 or 2 tracks'

subplot(2,2,2);
t=[5 10 15 20] ;
semilogy( t, PK03(:,1), 'k.-');
hold on
semilogy( t, PK03(:,2), 'k.-');
semilogy( t, PK03(:,3), 'k.-');
semilogy( t, PK03(:,4), 'k.-');
a = axis;
axis([ 0 20 a(3) 10]);
% text(1,0.5e-2, [ '\_\_\_  P(K=2)'; ...
%                  '-.-.  P(K=1)  ' ]);
text(2,PK03(1,1),'K=0');
text(2,PK03(1,2),'K=1');
text(2,PK03(1,3),'K=2');
text(2,PK03(1,4),'K=3');
xlabel 'Time';
ylabel 'Probability'
title '(b) Probability of K tracks'

hold off
