Calculating effective area in Soccer

4 次查看(过去 30 天)
I am currently trying to interpret how to code the attached algorithm (pictured).
Beginning information states "In order to create a polygon on the planar dimension, at least three points are necessary (i.e., triangle). Therefore, three players need to be considered to build triangles as the combinations of N players, in which N is the total number of players within a team."
The algorithm is then given.
I am wondering how this translates into MATLAB.

采纳的回答

David Goodmanson
David Goodmanson 2018-4-20
编辑:David Goodmanson 2018-4-20

Hi William,

The algorithm draws a lot of triangles with players at the vertices. I appears that the final result for P is the polygon enclosed by the red boundary in the code below (the convex hull). After that, what the last line is doing is not so clear. Are you just looking for the area inside the boundary? If it's no more complicated than that, then the following code should get it done.

Let the players be at locations (x,y) and let vx be the vector of x coordinates and vy be the vector of corresponding y coordinates. Then

% make up some data
vx = 100*rand(1,11);
vy = 50*rand(1,11);
ind = convhull(vx,vy)             % indices of players on the boundary
plot(vx,vy,'o',vx(ind),vy(ind));
xlim([0 100]);
ylim([0 50]);
A = polyarea(vx(ind),vy(ind))
  2 个评论
William Sheehan
William Sheehan 2018-4-21
Thanks David, that looks awesome!
Is there away to formulate the code in a way that measures the change in area over time, i.e. on a second to second basis over a 30 second window?
I would like to apply this code to different 30 second periods throughout the game using (x,y) coordinate data.
David Goodmanson
David Goodmanson 2018-4-21
Hi William,
that would not be hard to do, you just need vx and vy for each of those one-second intervals. How would you be storing/accessing the vx and vy data?

请先登录,再进行评论。

更多回答(1 个)

William Sheehan
William Sheehan 2018-4-21
Data is collected and exported to excel with a separate spreadsheet for each individual (as pictured). Only values that will be relevant will be the latitude (vx) and longitude (vy) columns. Is it best to create two new spreadsheets - one with all individuals vx values over time side by side and another separate one with all the vy values?
  8 个评论
William Sheehan
William Sheehan 2018-8-14
Hi David,
This appears to work well! Instead of using the area from convhull and the conversion you provided, I am using areaint function with "earthradius" which provides the area in metres squared. Both the results were very similar. Which would be more reliable ?
David Goodmanson
David Goodmanson 2018-8-14
Hi William, probably areaint, since it is part of a Matlab toolbox. According to wikipedia, the earth's radius varies from 6353 km to 6384 km depending on location. For all I know, areaint has a lot of data and uses the radius appropriate to Sydney. earthradius gives 6371. I used 6370 so I would be interested to know how the answers compare if you changed the 6370 I used to 6371.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Antennas, Microphones, and Sonar Transducers 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by