How do I measure density of random point with a fixed area in MATLAB?
Mostrar comentarios más antiguos
There had a 9x9 area and I have generate a lot of point with this area in random.
How do I measure density of the red point (e.g. Bottom left).
Somebody can give something sample code to let me study with this topic? It is very helpful to my project research.

3 comentarios
Mathieu NOE
el 20 de En. de 2021
hello
you can count the number of points by making this - assuming the data points coordinates are given in a 2 columns matrice (x coordinates = 1st column , y coordinates = 2ndt column
x = rand(1000,1);
y = rand(1000,1);
% area definition
xlow = 0.25;
xhigh = 0.5;
ylow = 0.25;
yhigh = 0.5;
area = (xhigh-xlow)*(yhigh-ylow);
indx = find(x >=xlow & x <=xhigh);
indy = find(y >=ylow & y <=yhigh);
ind = intersect(indx,indy);
plot(x,y,'*g',x(ind),y(ind),'or');
density = numel(ind)/area
Chun Yin Lui
el 21 de En. de 2021
Mathieu NOE
el 21 de En. de 2021
hello
these are plot format option * = star, g = green, o = circle , r = red
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Distribution Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
