Skip to content

Derivative

Computes the change from the previous sample divided by dt; the initial condition seeds the previous sample.

y(0) = (u(0) - ic) / dt; for n > 0, y(n) = (u(n) - u(n-1)) / dt.

Direction Name Type
Input u T
Output y T
Name Type Default Meaning
T type (default f64) f64 Float scalar or float array type
ic T ZERO Previous sample used at the first tick

T may be a float scalar or float array; subtraction and scaling are element-wise for arrays. dt must be nonzero.

With dt = 0.1, ic = 0, and input samples 0.2, 0.5, 0.5, outputs are 2, 3, 0.