Average velocity at a specific time interval in a matrix

Hello, I have a file which contains time and distance in separate columns. I need to calculate an average speed the average velocity at each time interval which is 0.04 s starting at 0 s. How can I get the average distance between the first and second row, then the second and third row columns and etc.?

Answers (1)

M=[0 0.7943
0.0400 0.3112
0.0800 0.5285
0.1200 0.1656
0.1600 0.6020
0.2000 0.2630]
y=M(:,2);
a=y(1:end-1);
b=y(2:end)
out=mean([a b],2)

Categories

Tags

Asked:

on 3 Oct 2013

Answered:

on 3 Oct 2013

Community Treasure Hunt

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

Start Hunting!