36 views (last 30 days)

I create a vector of randomly selected values from a normal distribution of mean = 0 and std = 1. I calculate the mean and expect as a result zero. And I calculate the mean of the absolute value and I expect as a result but instead I get a non-zero mean and a result of for the mean of the absolute value.

How is that?

>> noise=randn(1,1000000);

>> mean(noise)

ans =

0.0013

>> mean(abs(noise))

ans =

0.7985

Jos (10584)
on 8 Aug 2019

The numbers are randomly drawn from a normal distribution. Although this underlyin distribution has a mean of 0 and a standard deviation of 1, this does not mean that your selected numbers should have this mean and standard deviation! Think about it when you draw only a few numbers from this distribution. Would you expect the mean to be 0 all the time?

To make the mean and std of your selection of numbers (almost) equal to 0 and 1, respectively, you can do:

R = randn(1,100) ;

R = (R - mean(R))./ std(R) ;

mean(R), std(R)

Walter Roberson
on 8 Aug 2019

Sign in to comment.

Sign in to answer this question.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/475367-why-is-the-mean-of-value-of-gaussian-white-noise-not-zero#comment_733047

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/475367-why-is-the-mean-of-value-of-gaussian-white-noise-not-zero#comment_733047

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/475367-why-is-the-mean-of-value-of-gaussian-white-noise-not-zero#comment_733086

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/475367-why-is-the-mean-of-value-of-gaussian-white-noise-not-zero#comment_733086

Sign in to comment.