Colored Noise - Generate colored noise signal - Simulink (original) (raw)

Generate colored noise signal

Libraries:
DSP System Toolbox / Sources

Description

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 theNoise 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.

Examples

expand all

Generate two-channels of pink noise from the Colored Noise block and compute the power spectrum based on a running average of 50 PSD estimates.

The Colored Noise block generates two-channels of pink noise with 1024 samples. The Spectrum Analyzer computes modified periodograms using a Hamming window and 50% overlap. The running average of the PSD uses 50 spectral averages.

Ports

Output

expand all

Colored noise output signal. The size and data type of the signal depend on the values of the Number of output channels, Number of samples per output channel, and Output data type parameters.

Data Types: single | double

Parameters

expand all

Color of the noise the block generates. You can set this parameter to:

Inverse power spectral density component, α, specified as a real-valued scalar in the interval [-2 2]. The inverse exponent defines the power spectral density of the random process by 1/|f|α. The default value of this property is1. When Power of inverse frequency is greater than 0, the block generates lowpass noise, with a singularity (pole) at_f_= 0. These processes exhibit long memory. When Power of inverse frequency is less than0, the block generates highpass noise with negatively correlated increments. These processes are referred to as antipersistent. In a log-log plot of power as a function of frequency, processes generated by the Colored Noise block exhibit an approximate linear relationship, with the slope equal to –α.

Dependencies

To enable this parameter, set Noise color tocustom.

Select the parameter to make the output bounded between +1 and −1.

When you select the parameter, the internal random source that generates the noise is uniform. If Noise color is set towhite, there is no color filter applied to the output of the random source. The output is uniform noise of amplitude between +1 and −1. If Noise color is set to any other option, then a coloring filter is applied to the output of the random source, followed by a gain that ensures the absolute maximum output never exceeds 1.

When you do not select the parameter, the internal random source is Gaussian. The output is not bounded.

Number of output channels, specified as a positive integer scalar. This parameter defines the number of columns in the generated signal.

Data type of the output specified as double orsingle.

Number of samples in each frame of the output signal, specified as a positive integer scalar. This parameter defines the number of rows in the generated signal.

Sample time of the output signal, specified as a positive scalar in seconds.

Initial seed of the random number generator algorithm, specified as a real-valued positive integer scalar.

Specify the type of simulation to run. You can set this parameter to:

Block Characteristics

Data Types double | single
Multidimensional Signals No
Variable-Size Signals No

More About

expand all

Many phenomena in diverse fields, such as hydrology and finance, produce time series with PSD functions that follow a power law of the form

where α is a real number in the interval [-2,2] and L(f) is a positive, slowly-varying or constant function. Plotting the PSD of such processes on a log-log plot displays an approximate linear relationship between the log frequency and log PSD with slope equal to -α

It is often convenient to plot the PSD in dB as a function of the frequency on a base-2 logarithmic scale. The slope of the plot is then dB/octave. Rewriting the preceding equation, you obtain

with the slope in dB/octave given by

If α > 0, S(f) goes to infinity as the frequency, f, approaches 0. Stochastic processes with PSDs of this form exhibit long memory. Long-memory processes have autocorrelations that persist for a long time as opposed to decaying exponentially like many common time-series models. If α<0, the process is antipersistent and exhibits negative correlation between increments [1].

Special examples of 1|f|α processes include:

Algorithms

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:

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:

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:

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].

References

[1] Beran, J., Feng, Y., Ghosh, S., and Kulik, R. Long-Memory 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.

Extended Capabilities

Version History

Introduced in R2015a