はじめに
next stepの位置に対して、初期の進行方向に対する制限を加えた2次元のランダムウォークをアニメーションで示してみる。
コード&解説
モジュールのインポートなど
バージョン
データの準備
角度データを作成しておく。
角度を10°に制限した場合

10 から 60 °まで制限を変化させた場合

10 °のデータで100回繰り返した場合

30 °のデータで100回繰り返した場合

10 °のデータで100回繰り返した場合をアニメーションで表示
30 °のデータで100回繰り返した場合をアニメーションで表示
参考

[matplotlib] 53. 2次元ランダムウォークのヒートマップ
2次元ランダムウォークの動いた範囲を10 x 10の2次元ヒストグラム(ヒートマップ)で示す方法について説明する。

[matplotlib animation] 64. 1次元ランダムウォークアニメーション
matplotlibのFuncAnimationで1次元のランダムウォークアニメーションを表示する。

[matplotlib animation] 65. 2次元ランダムウォークアニメーション
matplotlibのFuncAnimationで2次元のランダムウォークアニメーションを表示する。

[matplotlib animation] 66. 3次元ランダムウォークアニメーション
matplotlibのFuncAnimationで3次元のランダムウォークアニメーションを表示する。
コメント