Average velocity at a specific time interval in a matrix
Show older comments
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)
Azzi Abdelmalek
on 3 Oct 2013
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
Find more on Multidimensional Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!