#First order centered finite differences

9 messages · Page 1 of 1 (latest)

grizzled light
#

Say I am sampling a position every second and storing the distance between each sampled position in an array dl of N distances.
How would I go about using first-order centered finite differences to estimate the speed for each segment?

crude patioBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

gaunt ibex
#

are you not already there?

#

if you're storing the difference BETWEEN each sample, you're storing f(x + 1) - f(x)

#

looks like your array is an array of finite differences

cosmic goblet
#

Or you can possibly use calculus, but I’m not sure exactly the context of what you’re doing or what your program looks like

gaunt ibex
#

the data he's recording (distance / unit time) is exactly what he's asking for (speed) in the same paradigm (finite differences)

high kindle
#

"centered finite differences" probably just means: take the average of the i-1 speed and the i+1 speed
(and speed is proportional to dl because of fixed timestep)
so something like speed[i] = 0.5 * ( dl[i-1] + dl[i+1] )
or with timestep dt speed[i] = 0.5 * (1/dt) * ( dl[i-1] + dl[i+1] )

grizzled light