MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# velocity from a trajectory

Asked by Rannock on 9 Oct 2012

I made the acquisition of a marker trajectory in the space. I am having a .txt file where I have a set of 3d coordinates. This is a portion of the file (coordinates in mm)

-9.72742, -141.224, 401.578

-9.51058, -142.775, 401.518

-9.45633, -143.178, 401.485

-6.35867, -143.593, 400.581

-4.83707, -143.675, 400.053

-5.00037, -144.15, 398.159

What I would like to do is to analyze the velocity along the axes x, y, z. So I have to make derivatives along the three directions. I put the first column in a vector x and I simply applied the formula of numerical differentiation df = [f (x + h)-f (x)] / h with h = interval used to sample (in my case 0.02 sec). In Matlab: dx = diff (x) dx% contains differences between a point and the next vx = dx./0.02; plot (vx);

by this method the graph is very irregular. Is there a better method to derive the velocity by a series of coordinates? thanks

## Products

No products are associated with this question.

Answer by Image Analyst on 9 Oct 2012

What makes you think it's not irregular? Maybe the particle does wiggle or vibrate or somehow jostle around at it travels. Maybe if you look at the square root of the sum of the squares of each directional velocity it will look smoother.