Players distribution in soccer field

3 visualizaciones (últimos 30 días)
Sérgio Querido
Sérgio Querido el 16 de Abr. de 2015
Comentada: Image Analyst el 19 de Abr. de 2015
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

Respuesta aceptada

Image Analyst
Image Analyst el 17 de Abr. de 2015
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 comentarios
Sérgio Querido
Sérgio Querido el 19 de Abr. de 2015
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 el 19 de Abr. de 2015
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.

Iniciar sesión para comentar.

Más respuestas (1)

Sérgio Querido
Sérgio Querido el 19 de Abr. de 2015
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.

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by