MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ central_first_derivative() [1/2]

template<typename T >
T MayaFlux::Kinesis::central_first_derivative ( const Memory::HistoryBuffer< T > &  history,
double  dt 
)
inlinenoexcept

Central difference approximation of the first derivative.

Template Parameters
TSample type
Parameters
historyBuffer with capacity >= 3
dtElapsed time between consecutive samples
Returns
(history[0] - history[2]) / (2 * dt)

Second-order accurate versus the first-order accurate backward difference used by velocity(). Costs one extra sample of lag since the estimate is centered on history[1], not history[0].

Definition at line 117 of file Differential.hpp.

118{
119 using S = scalar_t<T>;
120 return (history[0] - history[2]) / static_cast<S>(2.0 * dt);
121}

Referenced by central_first_derivative().

+ Here is the caller graph for this function: