![軸環境内でブラウン運動を描くにはどうすればいいでしょうか?](https://rvso.com/image/476249/%E8%BB%B8%E7%92%B0%E5%A2%83%E5%86%85%E3%81%A7%E3%83%96%E3%83%A9%E3%82%A6%E3%83%B3%E9%81%8B%E5%8B%95%E3%82%92%E6%8F%8F%E3%81%8F%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%97%E3%82%87%E3%81%86%E3%81%8B%3F.png)
0から1までの標準的なブラウン運動を描きたい。この答え、私は次のことを試しました:
\documentclass{article}
\usepackage{pgfplots, tikz}
\pgfplotsset{compat = newest}
\newcommand{\Emmett}[5] % color, x0, dt, n
{
\draw[#1] (0, #2)
\foreach\x in {1, ..., #4} {
-- ++(#3, rand * #3)
}
node[right] {#5};
}
\begin{document}
\begin{tikzpicture}[>=latex]
\begin{axis}[
axis x line = center,
axis y line = center,
xtick = {0, ..., 1},
ytick = {-1, ..., 1},
xlabel = {$t$},
ylabel = {$x$},
xlabel style = {right},
ylabel style = {above},
xmin = 0,
xmax = 1.1,
ymin = -1,
ymax = 1]
\Emmett{black}{0}{.01}{100}{};
\end{axis}
\end{tikzpicture}
\end{document}
出力は
したがって、明らかに何かが間違っています。\Emmett
マクロを完全に理解していないことを認めなければなりませんが、おそらく何かが間違っているのでしょう。コードが実際に行うべきことは次のとおりです。
t = 0;
x = x0;
for (i = 0; i < n; ++i)
{
plot (t, x);
let xi be a sample from the standard normal distribution;
x += sqrt(dt) * xi;
}
では、マクロをどのように調整すればよいのでしょうか?標準的なブラウン運動の軌跡は実際には次のようになります。