% example script to run a known-channel multi-user ISI problem
% using separate trellises for each user
% and estimates of the other users symbols
%
% R. Perry, June 2001

%%%
%%
% run Viterbi
%
L = 1;
Nv = Nusers;

% first update each trellis independently
%
vit_init( L, M, N, Nv);

TYPE = 22;

for u = 1:Nusers
  for t=1:N
    vit_update( u);
  end
end

% get initial results
%
ex = zeros( N, L, Nusers);

for u = 1:Nusers
  paths = vit_paths( u);
  ex(:,:,u) = get_ex( paths);
end

% now start over using the above estimates
% we could iterate this...
%
vit_init( L, M, N, Nv);

TYPE = 23;

% forward iteration
%
for u = 1:Nusers
  for t=1:N
    vit_update( u);
  end
  paths = vit_paths( u);
  ex(:,:,u) = get_ex( paths);
end

vit_init( L, M, N, Nv);

% backward iteration
%
for u = Nusers-1:-1:1
  for t=1:N
    vit_update( u);
  end
  paths = vit_paths( u);
  ex(:,:,u) = get_ex( paths);
end
