MATLAB Answers

Representing base 4 numbers as "random walks"

1 ビュー (過去 30 日間)
Tyler Kastner
Tyler Kastner 2018 年 3 月 20 日
回答済み: Roger Stafford 2018 年 3 月 20 日
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.

  0 件のコメント

サインイン to comment.

回答 (2 件)

Image Analyst
Image Analyst 2018 年 3 月 20 日
See attached random walk demos. I think one of them goes up, down, left, and right rather than in random directions. Adapt as needed.

  0 件のコメント

サインイン to comment.


Roger Stafford
Roger Stafford 2018 年 3 月 20 日
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.

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

タグ


Translated by