Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!c8g2000yqc.googlegroups.com!not-for-mail
From: TideMan <mulgor@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Help with randn function
Date: Sun, 22 Jan 2012 16:52:09 -0800 (PST)
Organization: http://groups.google.com
Lines: 19
Message-ID: <82628bd5-8671-4083-8086-604d1b8fbecb@c8g2000yqc.googlegroups.com>
References: <jfhofu$l8u$1@newscl01ah.mathworks.com> <jfhqbi$sab$1@speranza.aioe.org>
 <jfi0ce$ea1$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: 202.78.152.105
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1327279929 27153 127.0.0.1 (23 Jan 2012 00:52:09 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Mon, 23 Jan 2012 00:52:09 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: c8g2000yqc.googlegroups.com; posting-host=202.78.152.105; posting-account=qPexFwkAAABOl8VUndE6Jm-9Z5z_fSpR
User-Agent: G2/1.0
X-Google-Web-Client: true
X-Google-Header-Order: HUALESRCNK
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1,gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:755390

On Jan 23, 10:51 am, "Francesco " <fra041...@hotmail.it> wrote:
>
> Another way you have is to call normrnd in this way:
>
> normrnd(-1,1,1,20)
>
> I hope this helps.

No, it doesn't help, because it is wrong.
The first 2 arguments are the mean and standard deviation.

A possible way of getting the distribution between -1 and 1 is to use
the universal threshold of Donoho & Johnstone:
lambda=sqrt(2*log(n))*sigma;
which gives the expected maximum of randn for n numbers.
Note that it's only the "expected" maximum, so this means lambda could
be exceeded.
But scaling the numbers by lambda will, on average, ensure they are
between -1 and 1.