Computes velocity (first derivative) from position assays in a PhysioExperiment object using finite differences.
Arguments
- pe
A PhysioExperiment object containing position assays.
- assay_names
Character vector of assay names to differentiate. If NULL (default), auto-detects position_x/y/z or keypoint_x/y assays.
- method
Finite difference method: "central" (default), "forward", or "backward".
- sampling_rate
Sampling rate in Hz. If NULL (default), uses
samplingRate(pe).
Value
PhysioExperiment with new velocity assays added. For 3D marker data, assays named velocity_x, velocity_y, velocity_z. For 2D keypoint data, assays named velocity_kp_x, velocity_kp_y.
References
Winter DA (2009). "Biomechanics and Motor Control of Human Movement." 4th ed. John Wiley & Sons.
See also
computeAcceleration() for second-order derivatives,
computeSpeed() for scalar speed from velocity components,
differentiate() for general-purpose numerical differentiation.
Examples
demo <- demoMoCapData(seed = 1)
pe_vel <- computeVelocity(demo$mocap)
SummarizedExperiment::assayNames(pe_vel)
#> [1] "position_x" "position_y" "position_z" "velocity_x" "velocity_y"
#> [6] "velocity_z"