Borrar filtros
Borrar filtros

Random path coordinates in 2D within a unit square

5 visualizaciones (últimos 30 días)
KalMandy
KalMandy el 4 de Mayo de 2017
Comentada: KalMandy el 5 de Mayo de 2017
Hi all, I want to generate a random path within a unit square and get the x,y coordinates of 1000 points on it. Can you suggest a way to do it?
start point and the end point should lie diagonally on the opposite corners. For example, if the starting point is (0,0), end point should be (1,1). and if the starting point is (0,1), end point should be (1,0)
I would like to generate random path like this and obtain the coordinates along the path. Please see the attached figure.

Respuestas (2)

James Tursa
James Tursa el 4 de Mayo de 2017
Editada: James Tursa el 4 de Mayo de 2017
Any restrictions on the path? E.g., would 1000 random points suffice:
mypath = rand(1000,2); % <-- each row is an (x,y) point in a unit square
  9 comentarios
KalMandy
KalMandy el 5 de Mayo de 2017
@David I want to have all of the path inside the unit square.
KalMandy
KalMandy el 5 de Mayo de 2017
@John yes you are right.

Iniciar sesión para comentar.


Image Analyst
Image Analyst el 5 de Mayo de 2017
Editada: Image Analyst el 5 de Mayo de 2017
See my attached random walk programs and adapt as needed.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by