Representing base 4 numbers as "random walks"

How would I go about creating a code that would convert a base 4 number into a "random walk"? What I mean by this is in base 4, let 0 be a step downwards, 1 be a step to the left, 2 a step up, and 3 a step to the right. Any tips for creating a code that when I put in a number will produce this walk? Thank you.

Antworten (2)

Image Analyst
Image Analyst am 20 Mär. 2018

0 Stimmen

See attached random walk demos. I think one of them goes up, down, left, and right rather than in random directions. Adapt as needed.
Roger Stafford
Roger Stafford am 20 Mär. 2018

0 Stimmen

The Matlab function 'dec2base' can be used to covert integers to character strings involving the characters '0', '1', '2', and '3'. From there to your 'walk' should be easy.

Kategorien

Mehr zu Random Number Generation finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 20 Mär. 2018

Beantwortet:

am 20 Mär. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by