Generate colored noise signal
DSP System Toolbox / Sources
The Colored Noise block generates a colored noise signal with a power
spectral density of 1/f^{α} over its entire frequency range. The inverse power spectral density
component, α, can be any value in the interval [2
2]
. The type of colored noise the block generates depends on the
Noise color option you choose in the block dialog box. When you
set Noise color to custom
, you can
specify the power density of the noise through the Power of inverse
frequency parameter.
Data Types 

Multidimensional Signals 

VariableSize Signals 

The figure shows the overall process of generating the colored noise.
The random stream generator produces a stream of white noise that is either Gaussian or uniform in distribution. A coloring filter applied to the white noise generates colored noise with a power spectral density (PSD) function given by:
$$S(f)=\frac{L(f)}{f{}^{\alpha}}$$
When α, the inverse frequency power, equals 0, no coloring filter is
applied to the output of the random stream generator. If the bounded option is enabled, the
output is uniform white noise with amplitude between +1 and −1. If the bounded output is not
enabled, the output is a Gaussian white noise and the values are not bounded between +1 and
−1. If α is set to any other value, then a coloring filter is applied to
the output of the random stream generator. If the bounded output option is enabled, a gain
g is applied to the output of the coloring filter to ensure that the
absolute maximum output never exceeds 1
.
For details on colored noise processes and how the value of α affects the PSD of the colored noise, see Colored Noise Processes.
When the inverse frequency power α is positive, the colored noise is generated using an auto regressive (AR) model of order 63. The AR coefficients are:
$$\begin{array}{l}{a}_{0}=1,\\ {a}_{k}=(k1{\scriptscriptstyle \frac{\alpha}{2}})\frac{{a}_{k1}}{k},\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}k=1,2,\dots ,63\end{array}$$
Pink and brown noises are special cases, which are generated from specially tuned SOS filters of orders 12 and 10, respectively. These filters are optimized for better performance.
When the inverse frequency power α is negative, the colored noise is generated using a moving average (MA) model of order 255. The MA coefficients are:
$$\begin{array}{l}{b}_{0}=1,\\ {b}_{k}=\left(k1+\frac{\alpha}{2}\right)\frac{{b}_{k1}}{k},\text{\hspace{0.17em}}\text{\hspace{0.17em}}k=1,2,\cdots ,255\end{array}$$
Purple noise is generated from a first order filter, B = [1 −1].
The coloring filters applied (except pink, brown, and purple) are detailed on pp. 820–822 in [2].
[1] Beran, J., Feng, Y., Ghosh, S., and Kulik, R. LongMemory Processes: Probabilistic Properties and Statistical Methods. Springer, 2013.
[2] Kasdin, N.J. "Discrete Simulation of Colored Noise and Stochastic Processes and 1/f^{α} Power Law Noise Generation". Proceedings of the IEEE^{®}. Vol. 83, No. 5, 1995, pp. 802–827.