Players distribution in soccer field

5 次查看(过去 30 天)
Hello,
I have the coordinates (x,y) of a lot of soccer players and i want to know their field distribution. I want to part the field (120m x 90m) in 1m2 bens. With this, i want to now how many times, players are in each bens.
Can you help me please with the best code to run this in matlab?
SQ

采纳的回答

Image Analyst
Image Analyst 2015-4-17
If you have the Statistics and Machine Learning Toolbox you can use hist3: http://www.mathworks.com/help/stats/hist3.html?s_cid=srchtitle which looks just like what you want and need.
  2 个评论
Sérgio Querido
Sérgio Querido 2015-4-19
How can i run ndhist.m's code with my requirements? - table size: 120m x 90m (the same size of soccer field) - Bean size: 1m2 - The (x,y) referencial point (0,0) is in the centre of de field.
Image Analyst
Image Analyst 2015-4-19
If xy is your N by 2 matrix of x and y locations for the players (each player is one row), then, if you have the Statistics and Machine Learning Toolbox, do this:
hist3(xy,[120, 90])
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 20;
numberOfPeopleOnField = 1000;
% Make up some X coordinates for numberOfPeopleOnField people.
x = 120 * rand(numberOfPeopleOnField, 1);
% Make up some Y coordinates for numberOfPeopleOnField people.
y = 90 * rand(numberOfPeopleOnField, 1);
xy = [x, y];
hist3(xy,[120, 90])
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Count (# of People)', 'FontSize', fontSize);
You'll note that most 1 square meter regions have only 0 or 1 plyaer in them. I had to put a lot of players on the field to get more than 2 playes in a 1 square meter square.

请先登录,再进行评论。

更多回答(1 个)

Sérgio Querido
Sérgio Querido 2015-4-19
How can i run ndhist.m's code with my requirements? - table size: 120m x 90m (the same size of soccer field) - Bean size: 1m2 - The (x,y) referencial point (0,0) is in the centre of de field.

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics and Visualization 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by