%% Constant-Velocity Unscented Kalman Filter
% Create a trackingUKF object using the predefined constant-velocity motion model, constvel, and the associated measurement model, cvmeas. These models assume that the state vector has the form [x;vx;y;vy] and that the position measurement is in Cartesian coordinates, [x;y;z]. Set the sigma point spread property to 1e-2.

filter = trackingUKF(@constvel,@cvmeas,[0;0;0;0],'Alpha',1e-2);

%
% Run the filter. Use the predict and correct functions to propagate the state. You can call predict and correct in any order and as many times as you want.

meas = [1;1;0]; 
[xpred, Ppred] = predict(filter);
[xcorr, Pcorr] = correct(filter,meas);
[xpred, Ppred] = predict(filter);
[xpred, Ppred] = predict(filter)

% Copyright 2012 The MathWorks, Inc.