Traj3DVelocity: Velocity of a trajectory

View source: R/3D.R

Traj3DVelocityR Documentation

Velocity of a trajectory

Description

The velocity, as a 3-dimensional vector, is approximated at each point of the trajectory using first-order finite differences. Central, forward or backward differences can be used. Central differences yield a more accurate approximation if the velocity is smooth. As a practical guide, if velocity doesn't change much between steps, use central differences. If it changes substantially (and not just as an artifact of recording noise), then use either forward or backward differences.

Usage

Traj3DVelocity(trj3d, diff = c("central", "forward", "backward"))

Arguments

trj3d

3-dimensional trajectory whose velocity is to be calculated.

diff

Type of difference to be calculated, one of "central" (the default), "forward" or "backward".

Details

Intuitively, think of the central difference velocity at a point as the mean of the velocities of the two adjacent steps. Forward difference velocity is the velocity of the step starting at the point. Backward difference is the velocity of the step ending at the point.

Speed (i.e. the magnitude of the velocity) can be derived from velocity by calling Traj3DSpeed.

Value

A numeric matrix. Each row represents the 3D velocity vector at each point along the trajectory, with 'x', 'y' and 'z' columns. If diff is "central", the first and last velocity values will be NA since velocity cannot be calculated for them. If diff is "forward", the last value will be NA, and if diff is "backward", the first value will be NA.

See Also

Traj3DSpeed for calculating scalar speed, which is the magnitude of the velocity vector at each step; Traj3DResampleTime and Traj3DRediscretize to resample a trajectory to fixed time or length steps; Finite differences on Wikipedia.


JimMcL/trajr documentation built on July 23, 2024, 2:06 a.m.