Calculating velocity/acceleration

Hi - I’m trying to calculate the velocity and acceleration of a generic chop input. I’m shaky with the math, but since my intention to look at this frame by frame (making time=1), I’m doing:

where input[0] is the latest sample in the channel

vel1 = input[0] - input[1]
vel2 = input[1] - input[2]

acceleration1 = vel1-vel2

I’ve made a simple tox to do these calculations but I’m seeing some weird results. When I feed it a ramp pattern, velocity and acceleration values vary just ever so slightly. I’ve attached the tox and would appreciate a look to see if this is the proper way to do these calculations. I’m using delay chops, specifying delays in frames, and maths rather than python to do the calculations.

thanks!
b
accel_test.tox (1.19 KB)

You could compare your results with a slopeCHOP

docs.derivative.ca/Slope_CHOP

(+ use trailCHOP with a fixed viewer to visualize)

Thank you! Did not know the ‘slope’ chop existed… I am seeing some of the same artifacts but far less. Anyone have any ideas of why it would be doing this?

Here’s how the data looks. First column is speed, second acceleration. Sometimes I get weird little blips in acceleration and/or velocity. Maybe its just because im feeding this with a pattern.


tox attached as well.
slopeTest.tox (694 Bytes)

The glitch is happening as the timeline wraps around.
Specifically the value in pattern1 drops from 1 to 0 at that time.

The slight variations in value are likely due to the limits of floating point precision happening in the CHOPs.

Hope that helps,
Rob