How can i calculate the velocity of al those rats in X and Y coordinates

Hey Guys,
I have a file with time and many X and Y coordinates of 8 rats who walk through a maze, i need to calculate the X and Y velocity of al those rats separately. Can someone help me with this? (Sorry i am a matlab noob...)

Answers (1)

To get the data into MATLAB, use the Import Tool on the left hand side of the toolstrip or double click the file in the current folder browser.
At each step, calculate the distance walked by each rat (I'd use hypot and diff to do this) and divide by the time.
For example:
x = 0:10
y = 0:10
t = 0:10
rates = hypot(diff(x),diff(y))./diff(t)
% hypot(Difference in x difference in y) divided by difference in t

1 Comment

I dont get it exactly.. sorry! i do have this right now (attached m-file). Is this right?

Sign in to comment.

Products

Asked:

on 20 Mar 2014

Commented:

on 20 Mar 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!