%% Velocity and Covariance of 3-D Constant-Acceleration Object
% Create an extended Kalman filter tracker for 3-D constant-acceleration motion.

tracker = multiObjectTracker('FilterInitializationFcn',@initcaekf);

%
% Initialize the tracker with one detection.

detection = objectDetection(0,[10;-20;4],'ObjectClassID',3);
tracks = tracker(detection,0);

%
% Add a second detection at a later time and at a different position.

detection = objectDetection(0.1,[10.3;-20.2;4.3],'ObjectClassID',3);
tracks = tracker(detection,0.2);

%
% Obtain the velocity vector from the track state.

velocitySelector = [0 1 0 0 0 0 0 0 0; 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0 0 1 0];
[velocity,velocityCovariance] = getTrackVelocities(tracks,velocitySelector)

% Copyright 2020 The MathWorks, Inc.