Create a curved random walking path
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I need to create a random curved walking path of a person.
- it should be plot point by point like an actual walk
- step size is 50 (length between 2 steps)
- should be random
- axes should be limited to 0 - 1000 (x=0 to 1000 and y= 0 to 1000)
can anyone help me with a code?
check the attached picture to get a clear idea
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/165842/image.jpeg)
4 comentarios
Walter Roberson
el 7 de Jul. de 2017
If your rule is that a person can randomly select between left, right, or forward, then that is a standard random walk modified so that the person cannot immediately move back to where they came from. Such walks cluster around the origin point, and can very definitely go negative x and negative y, which your xlim and ylim requirements would not be able to show. It is not what you refer to as a curved random walk.
If the rule is that you can go more-positive-y ("up") or less-positive-y ("down") or more-positive-x ("right") then you get less clustering around the origin point, because such rules would not permit moving to any point with a lesser x than you have reached. However, such a path is not one you would call curved either -- not unless you can define a bias on the random selection that acts to tend to curve the path.
Curved paths are easier to create if you do not confine to turns that are multiples of 90 degres, even if you fix the step size.
Respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!