Generates temporally autocorrelated random numbers with a mean, standard deviation, and autocorrelation you specify.
colored_noise(timesteps, mean, sd, phi)
timesteps | The number of temporally autocorrelated random numbers (one per timestep) you want. |
---|---|
mean | The mean of the temporally autocorrelated random numbers. |
sd | The standard deviation of the temporally autocorrelated random numbers. |
phi | The temporal autocorrelation. 0 is white noise (uncorrelated), positive values are red noise (directly correlated) and negative values are blue noise (inversely correlated). |
A vector of temporally autocorrelated random numbers.
rednoise <- colored_noise(timesteps = 30, mean = 0.5, sd = 0.2, phi = 0.3) rednoise#> [1] 0.02403951 0.56254582 0.52191719 0.57133523 0.42367128 0.30415940 #> [7] 0.45307423 0.18894676 0.45875479 0.41613884 0.57361293 0.37173426 #> [13] 0.45887483 0.27928007 0.66271957 0.74312923 0.60517579 0.83779279 #> [19] 0.40200955 0.31664068 0.47377982 0.10376443 0.40437424 0.08594860 #> [25] 0.38835688 0.25780445 0.30823115 0.31639904 0.54815457 0.55938039