uniformly distributed coordinate points
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
can anyone help me to generate uniformly distributed coordinate points inside a rectangular field.
Thanking u advance
0 comentarios
Respuestas (5)
Sarah Wait Zaranek
el 10 de Mzo. de 2011
You can also do the following if you want a uniform grid:
[X,Y] = meshgrid(linspace(1,1000,100),linspace(1,1000,100));
This will give X coordinates and Y coordinates for each grid point inside a 1000 x 1000 rectangle. The segmenting in terms of x and y are defined by the input vectors, in this case, I am choosing 100 points per side.
scatter(X(:),Y(:))
will show you all the points.
0 comentarios
Andreas Goser
el 10 de Mzo. de 2011
This sounds like a one-liner with RAND or RANDI for me. Do you run into issues with this command or did you just not find it?
Matt Tearle
el 10 de Mzo. de 2011
xmin = -3;
xmax = pi;
npts = 42;
x = xmin + (xmax-xmin)*rand(npts,1);
Repeat for y.
4 comentarios
Oleg Komarov
el 10 de Mzo. de 2011
To get all at once:
min = [ 1 1];
max = [10 3];
npts = 1000;
xy = bsxfun(@plus, min, bsxfun(@times, max-min,rand(npts,2)));
f = scatter(xy(:,1),xy(:,2),'.');
xlim([0,11])
ylim([0,4])
sh
el 17 de Jun. de 2013
Hi, thanks for your help. can you find the x-coordinate and y-coordinates of these points by coding only? many thanks
0 comentarios
Edward Goodison
el 11 de Ag. de 2020
Editada: Edward Goodison
el 11 de Ag. de 2020
[X,Y,Z] = meshgrid(linspace(Start,stop, number of points),linspace(Start,stop, number of points), linspace(Start,stop, number of points));
p = [X(:), Y(:), Z(:)]
2 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!