0
$\begingroup$

I am trying to model random walk of a gyro, given some manufacturer specifications of maximum random walk in units of degrees per root-hour.

My first step was to generate white noise with a standard deviation derived from the specifications, like so.

imu_rate  = 200   # hz
stop_time = 3600  # sec
n_samples = imu_rate * stop_time
time = np.arange(n_samples) / imu_rate

# monte carlo
runs = 5
arw = 0.05                           # deg/rt-hour (MAX
arw /= 60                            # deg/rt-sec  
sigma = arw * np.sqrt(imu_rate) / 3  # deg - standard deviation of noise

white_noise = np.random.normal(0, sigma, size=(n_samples, runs))
random_walk = white_noise.cumsum(0) / imu_rate

plt.plot(time, random_walk);

enter image description here

Now, to the point of the question, I want to verify that that this method of modelling the sensor noise required to generate random walk within these bounds is correct. I want to do so by generating random walk and plotting it against some sort of bounds.

My first inclination was just to take the square root of time do a cumulative sum at each time step. However, that gives me really large bounds, completely dwarfing the scale of the random walk.

bounds = arw * np.sqrt(t)
plt.plot(time, random_walk);
plt.plot(time, bounds.cumsum())

enter image description here

So as the title says, how do I compute the bounds of random walk vs time?

$\endgroup$
1
  • $\begingroup$ I think I figured out that I just have to not use the cumulative sum, as that bounds curve fits the data... but that doesn't make sense to me since random walk is cumulative. $\endgroup$ Commented Sep 15, 2023 at 0:03

1 Answer 1

0
$\begingroup$

It is more appropriate for this site to use equations rather than code.

You are basically constructing a random walk: $$ Y=\sum_{n=1}^N X_n $$ with $(X_n)$ iid centered gaussian variables of variance $\sigma^2$. You need to be careful of what you mean by bound. If you are talking about the standard variation of $Y$: $\Delta Y$, then it is just (you don’t even need the fact that it is gaussian): $$ \Delta Y^2=n\sigma^2\\ \Delta Y=\sqrt n\sigma $$ If in your first time step, your were computing the cumulative sum of the square root of time, then you are pretty off: $$ \sum_{n=1}^N\sqrt n\sim \sqrt n^3 $$ which dwarfs the $\sqrt n$ growth of the variance.

Another definition of the bound could be the quantiles. Since $Y$ is also a centered gaussian of variance $ n\sigma^2$, then these also grow as $\sqrt n$.

Hope this helps.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.