function [eststate] = siests(state, normweight)
% *************************************************************************
%
% FILE:siests.m
%
% Date Created: April 7, 2004
% Author: Mark E. Irwin
%
% Contents: Generates estimates based on output of sipath.m
%           Sequential Imputation for target tracking with model
%           Process: X_t = GX_t-1 + H delta_t; delta_t ~ N(0,lambda)
%           Measurement: Z_T = FX_t + epsilon_t;   epsilson_t ~ N(0,sigma)
%
% Revision History
% Date          Name            Changes/Reasons
%
% *************************************************************************
%
% Input:
%
%   state: sampled states (nstates x nobs x nimpute)
%   normweight: normalized importance sampling weights (nobs x nimpute)
%
% Output:
%
%   eststate: posterior mean of state (#states x #obs + 1)
%
% *************************************************************************

[nstates,nobs,nimpute] = size(state);

eststate = zeros(nstates, nobs);

for i = 1:nobs
    eststate(:,i) = squeeze(state(:,i,:)) * normweight(i,:)';
end