I want to add Gaussian random noise to a variable in my model for each separate time-step and not to generate a noise array and add it to my signal afterwards. In this way I want to examine a standard dynamic effect of my system.
So, I want to generate each time-step a random noise (i.e. a single value) and it to my signal (e.g. add noise then it calculates the next state, add noise it calculates the next state, etc.). I thought to do this via NumPy using the following in the dynamic section of my model over a set of time-steps:
self.x = self.x + self.a * ((d-f)/100)
self.x = self.x + np.random.normal(0, 0.5, None)`
the second line is drawing random samples from a normal distribution and adds it to my variable.
0
is the mean of the normal distribution I am choosing from, 0.5
is the standard deviation of the normal distribution and the third argument is the size.
I am wondering if numpy.random.normal
is the correct way to do it and, if so, what parameter I should use for the size argument?
Aucun commentaire:
Enregistrer un commentaire