CNOISE 1/F^alpha Power Law Noise Generation

CNOISE, a C library which generates sequences that simulate 1/f^alpha power law noise. This includes white noise (alpha = 0), pink noise (alpha = 1) and red or Brownian noise (alpha = 2), as well as noise for values of alpha between 0 and 2, by Miroslav Stoyanov.

CNOISE is based in part on an algorithm by Kasdin, as cited in the references.

Kasdin's implementation referenced a number of functions from the Numerical Recipes library (FOUR1, FREE_VECTOR, GASDEV, RAN1, REALFT, VECTOR). Numerical Recipes is a proprietary library whose components cannot be freely distributed. The implementation given here relies instead on the free source library "GSL" (the GNU Scientific Library). Thus anyone can build the code without requiring access to restricted or proprietary software.

Other features of this version of the algorithm include:

• real arithmetic is done in double precision;
• the GSL Fast Fourier Transform functions do not require that the input data be a power of 2 in size;

Versions of the algorithm are implemented which generate a vector x of size N with a 1/f^alpha frequency distribution, with three choices for the underlying distribution of the white noise vector:

• cnoise_generate_colored_noise_uniform(), a uniform distribution on (-range,+range);
• cnoise_generate_colored_noise(), a Gaussian distribution with mean 0, standard deviation std;
• cnoise_generate_colored_noise_truncated(), a Gaussian distribution with mean 0, standard deviation std, truncated to (-range,range).

Note that this code was updated on 10 June 2011. Previously, the random number generator was used in such a way that it was possible to return a value which was exactly zero. Because the logarithm of these numbers was used in the generation of the noise vectors, this meant that occasionally a floating point exception would be triggered. A minor adjustment to the algorithm has removed this problem.

Languages:

CNOISE is available in a C version and a MATLAB version.

Related Data and Programs:

BLACK_SCHOLES, a C library which implements some simple approaches to the Black-Scholes option valuation theory, by Desmond Higham.

COLORED_NOISE, a C library which generates samples of noise obeying a 1/f^alpha power law.

PINK_NOISE, a C library which computes a "pink noise" signal obeying a 1/f power law.

SDE, a C library which illustrates the properties of stochastic differential equations (SDE's), and common algorithms for their analysis, by Desmond Higham;

STOCHASTIC_RK, a C library which applies a Runge-Kutta scheme to a stochastic differential equation.

Author:

Miroslav Stoyanov, Oak Ridge National Laboratory.

Reference:

1. Martin Gardner,
White and brown music, fractal curves and one-over-f fluctuations,
Scientific American,
Volume 238, Number 4, April 1978, pages 16-32.
2. Jeremy Kasdin,
Discrete Simulation of Colored Noise and Stochastic Processes and 1/f^a Power Law Noise Generation,
Proceedings of the IEEE,
Volume 83, Number 5, 1995, pages 802-827.
3. Edoardo Milotti,
1/f noise: a pedagogical review,
arXiv:physics/0204033.
4. Sophocles Orfanidis,
Introduction to Signal Processing,
Prentice-Hall, 1995,
ISBN: 0-13-209172-0,
LC: TK5102.5.O246.
5. William Press,
Flicker Noises in Astronomy and Elsewhere,
Volume 7, Number 4, 1978, pages 103-119.
6. Miroslav Stoyanov, Max Gunzburger, John Burkardt,
Pink Noise, 1/f^alpha Noise, and Their Effect on Solutions of Differential Equations,
International Journal for Uncertainty Quantification,
Volume 1, Number 3, pages 257-278, 2011.

Source Code:

• cnoise.c, the source code.
• cnoise.sh, compiles the source code.
• cnoise.h, the include file. Information about the parameters for the three user-interface routines is included here.

Last revised on 15 June 2019.