Calculating distance covered from x and y coordinates
조회 수: 14 (최근 30일)
이전 댓글 표시
Hi,
I am trying to calculate the distance covered by a footballer in a ten-minute game. I have 3000 x-coordinates and 3000 y-coordinates in a 3000 by 2 matrix. Does anyone know how I can compute the distance covered?
Thank you
Ben
댓글 수: 0
채택된 답변
Star Strider
2016년 4월 9일
This would be my approach:
x = randi(99, 1, 100); % Create Data
y = randi(99, 1, 100); % Create Data
d = hypot(diff(x), diff(y)); % Distance Of Each Segment
d_tot = sum(d); % Total Distance
댓글 수: 4
Constance Woodman
2018년 2월 22일
I tried this method and it produces a matrix of all possible distances between all stated points, which is cool unless one wanted to use a large data set, and only needed the first column or would crash the computer.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!