% x23 - data setup for 2 sets of 3 measurements with two tracks
%
%   K Lmax
%   - ----
%   1  3
%   2  6
%   3  6

if( K == 1)

  LOADED = 23;

  N = 2;			% N data samples

% set up main global variables
%
  false_alarm_rate = 4;		% average number of false alarms per unit time

  Pmiss = 0.4;			% probability of a missed target event

  MM = [3, 3];

  MM_max = 3;

  M = MM_max + 1;			% M states

  XY_offset = [0, 3];			% XY measurement offset indices

% apriori costs for missed target events
%
% Cmiss(n+1,K) is -log( P(n target events)) apriori cost
%
  Cmiss = get_Cmiss( Pmiss, MM_max);

% apriori costs for false detections
%
% Cfalse(m+1) is -log(P(m false detections))

  Cfalse = get_Cfalse( false_alarm_rate, MM_max);

% generate XY measurements
%
  dt = 4/20;				% needed in Kalman gain computation

  XY = zeros(2,3);

  XY(:,1) = [ 1; 1];
  XY(:,2) = [ 3; 3];
  XY(:,3) = [ 0; 4];	% false alarm

  XY(:,4) = [ 1.1; 1.1];
  XY(:,5) = [ 3.1; 3.1];
  XY(:,6) = [ 4; 0];	% false alarm

  Kn = 0.01;				% measurement noise variance

  missed_cost = log(16);		% volume is x,y = 0..4,0..4

  zstate = 0;	% initial state unknown

  z = [1:N];	% time index for dummy z data

else % K > 1

  if( LOADED ~= 23)
    error( 'initialize with K = 1 first');
  end

  if( K > MM_max)
    error( 'K > MM_max not allowed!');
  end

  setup_combos;	% setup global variables: perms, combos, unique_perms, MP, M

end
