Clear Filters
Clear Filters

Create a curved random walking path

2 views (last 30 days)
Dineth Senevirathne
Dineth Senevirathne on 7 Jul 2017
Commented: Walter Roberson on 7 Jul 2017
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
  4 Comments
Dineth Senevirathne
Dineth Senevirathne on 7 Jul 2017
Above path in the picture is not random.
This is a walking simulation of a person. Imagine a person is at a position (x,y) then he randomly select to walk forward or left or right.but step size is 50.(50 cm forward etc.)
Walter Roberson
Walter Roberson on 7 Jul 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.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!