![축 환경 내에서 브라운 운동을 어떻게 그리나요?](https://rvso.com/image/476249/%EC%B6%95%20%ED%99%98%EA%B2%BD%20%EB%82%B4%EC%97%90%EC%84%9C%20%EB%B8%8C%EB%9D%BC%EC%9A%B4%20%EC%9A%B4%EB%8F%99%EC%9D%84%20%EC%96%B4%EB%96%BB%EA%B2%8C%20%EA%B7%B8%EB%A6%AC%EB%82%98%EC%9A%94%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;
}
그렇다면 매크로를 어떻게 조정해야 할까요? 표준 브라운 운동의 경로는 실제로 다음과 같아야 합니다.