MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

New to MATLAB?

# Thread Subject: white and color gaussian noise and his statistics

Subject: white and color gaussian noise and his statistics

From: MICHAEL

### michael (view profile)

(MICHAEL)

Date: 20 Jul, 2010 12:26:04

Message: 1 of 4

hi

i need to generate 2 noises kind of samples: white and color
the white is easy - randn
the color is too: filter the white through a filter (for example y(n)=a*y(n-1)+(1-a)*x(n))

how do i compute the statistics of the noise - the mean vector and variance matrix

practically:
in case of white noise it's kind of easy - all with the same distribution so i can use the mean and var functions
in color - each sample is with it's own variance and also covariance is needed, so it's problematic to compute.

Subject: white and color gaussian noise and his statistics

From: Wayne King

### Wayne King (view profile)

Date: 20 Jul, 2010 13:29:22

Message: 2 of 4

"michael" <bezenchu@gmail.com> wrote in message <i244ks$ovd$1@fred.mathworks.com>...
> hi
>
> i need to generate 2 noises kind of samples: white and color
> the white is easy - randn
> the color is too: filter the white through a filter (for example y(n)=a*y(n-1)+(1-a)*x(n))
>
> how do i compute the statistics of the noise - the mean vector and variance matrix
>
> practically:
> in case of white noise it's kind of easy - all with the same distribution so i can use the mean and var functions
> in color - each sample is with it's own variance and also covariance is needed, so it's problematic to compute.

Hi Michael, For a number of random processes, it is possible to determine the mean and variance fairly easiliy. For example, if you generate the colored noise as a wide-sense stationary AR process of some order (p), there are expressions for the mean and variance of the process as well as an analytic expression for the power spectral density. The derivations of these results are available in most time series analysis texts.

As a simple example, take an AR(1) model of the form:

y(n)=0.9y(n-1)+e(n)

where e(n) is zero-mean white noise process. Since the coefficient, 0.9, is smaller in absolute value than 1, the above is a wide-sense stationary random process (it corresponds to a low pass system)
you can see that with:

fvtool(1,[1 -0.9])

% Now let's get a realization of this AR(1) process
A = [1 -0.9];
% resetting the random number generator so you can get
% reproducible results
reset(RandStream.getDefaultStream)
y = filter(1,A,randn(1000,1));

for this AR(1) process the variance is
\sigma^2/(1-0.9^2) where \sigma^2 is the variance of the white noise input

For this example, we should have
VarAr1 = 1/(1-0.9^2)

which you should find is pretty close to

var(y) % 5.7090

Obviously, for higher order stationary AR models, the variance becomes a more complicated expression of the parameters.

Hope that helps get you started,
Wayne

Subject: white and color gaussian noise and his statistics

From: MICHAEL

### michael (view profile)

(MICHAEL)

Date: 20 Jul, 2010 14:12:04

Message: 3 of 4

thank you

can you give me some reference?

what about the color? doesn't the different variables have different distributions?

Subject: white and color gaussian noise and his statistics

From: Wayne King

### Wayne King (view profile)

Date: 20 Jul, 2010 14:26:06

Message: 4 of 4

"michael" <bezenchu@gmail.com> wrote in message <i24ark$84u$1@fred.mathworks.com>...
> thank you
>
> can you give me some reference?
>
>
> what about the color? doesn't the different variables have different distributions?

Hi,

Perival and Walden, Spectral Analysis for Physical Applications
Priestly, M.B. Spectral Analysis and Time Series
Brockwell and Davis Time Series: Theory and methods

As just a few examples.

The term "colored" just indicates that the theoretical autocorrelation is not zero at non-zero lags. People use different colors as common descriptions of various shapes imparted to the PSD. Red noise is commonly used to refer to an AR(1) process for example. The example I gave you produces a colored noise, i.e. the filtering of the white noise introduces autocorrelation.

Wayne