Simulating random movememt

61 Views Asked by At

I'm trying to simulate random movement in an particle caused by temperature, by adding a random vector of length $1$ every simulation step. The problem is that as I decrease the step time, the average distance of the object from its actual location increases more and more.

Here's a plot of position vs. time for different number of simulation steps:

Plot 1

By instead adding a random vector whose size is $t$, where $t$ is the step size, I get the opposite problem:

Plot 2

Scaling the vector to $\sqrt{t}$ seems to give me what I want (more precise noise, but overall looks the same):

Plot 3

But I just found this scaling factor by chance. What's the best scaling factor to get similar-looking noise as I increase the number of simulation steps?

1

There are 1 best solutions below

0
On BEST ANSWER

Decreasing the step time by a factor $a$ will increase the number of steps by a factor of $a$. Now recall that for independent variables we have that $Var(\sum_i X_i) = \sum_i Var(X_i)$, so increasing the number of steps will also increase the variance by a factor of $a$ or equivalently increase the standard deviation by a factor of $\sqrt{a}$.

So the fact, that you found $\sqrt{t}$ to work well is not a coincidence, it is the scaling factor that keeps the variance constant at any given time for any step time.

Remark: As the step size goes to $0$ the proces will in fact converge to a Brownian motion (also called a Wiener Proces), which is a well studied stochastic process. https://en.wikipedia.org/wiki/Wiener_process#Wiener_process_as_a_limit_of_random_walk