简体   繁体   中英

What's the range of random variable with randn in matlab?

I am using matlab to plot the random variables satisfying the normal distribution. I plot the histogram as

w = 0.2;
y = randn(1, 1000)*w;
hist(y);

this shows the variables in the histogram ranges from -40 to 40, but what's that? I think since the width of the normal distribution is 0.2, I think the range of the variable should be within -1 to 1, right? So why the hist shows from -40 to 40? How do I know the actual range of the random variable? Thanks.

In the normal random variable, sometimes called Gaussian distribution, the range could be from -infinity to +infinity in theory. However, the distribution has a bell shape, this means the larger values have lower probability of occurring, but there is a chance that they happen. So if instead of randn(1, 1000) you use randn(1,1000000) with a high probability you will see a larger range. The value 0.2 that you multiply the randn() with just changes the energy of this random signal.

Can you give a bit more information?

When I run your snippet, I get a Gaussian histogram with min and max:

>> [min(y) max(y)]

ans =

   -0.6464    0.7157

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM