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

-
what you mean by range? From the definition of normal distribution, the 'range' is from -\infty to \infty. In your case, 0.2 is the standard deviation. –  chaohuang Jul 16 '12 at 4:01
^ +1 - randn() generates numbers all along the real line, just with very very little probability beyond +/- 3*sigma. –  Ansari Jul 16 '12 at 4:13

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

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

ans =

-0.6464    0.7157

-

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.

-
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "http://stackoverflow.com/questions/11497703/whats-the-range-of-random-variable-with-randn-in-matlab", "fetch_time": 1430907380000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2015-18/segments/1430458521872.86/warc/CC-MAIN-20150501053521-00007-ip-10-235-10-82.ec2.internal.warc.gz", "warc_record_offset": 196664609, "warc_record_length": 16762, "token_count": 389, "char_count": 1461, "score": 3.5625, "int_score": 4, "crawl": "CC-MAIN-2015-18", "snapshot_type": "latest", "language": "en", "language_score": 0.9048020243644714, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00025-of-00064.parquet"}