Path: news.mathworks.com!newsfeed-00.mathworks.com!oleane.net!oleane!news.ecp.fr!feeder.eternal-september.org!eternal-september.org!not-for-mail
From: dpb <none@non.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Random matrix/normal distribution
Date: Tue, 29 Sep 2009 15:09:13 -0500
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <h9tpq0$ma4$1@news.eternal-september.org>
References: <h9tpd6$bh9$1@fred.mathworks.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.eternal-september.org U2FsdGVkX1+RaGVqrptXNj696nXJFkguU9SUCs3cUItblO4/bBffgYxIi65UY2g6FfQd/3B3DHznvbRH9azFgGiYppweRObvYesOyf56lVwL8HwBWM3E3t7QrEJ0O4zkMFCXUwzaE2N3kQ9toiW2ig==
X-Complaints-To: abuse@eternal-september.org
NNTP-Posting-Date: Tue, 29 Sep 2009 20:13:53 +0000 (UTC)
In-Reply-To: <h9tpd6$bh9$1@fred.mathworks.com>
X-Auth-Sender: U2FsdGVkX1/KfsKigDVz8AbVonFvBKxLVO1H9H/9gNc=
Cancel-Lock: sha1:c+FPKEvw7eXOxMYjgiwECgZIn0M=
User-Agent: Thunderbird 2.0.0.22 (Windows/20090605)
Xref: news.mathworks.com comp.soft-sys.matlab:573791


Michael Grosswald wrote:
> I'm trying to generate random matrices whose entries are from the normal distribution.
> 
> Something like this:
> 
> (1/(sqrt(2*pi)))*exp(-(1+99*rand(5))^2/2)
> 
> Isn't going to work because squaring a matrix doesn't square each
> entry. How can I correct this or am I going about this the wrong way.

> I'm still a MATLAB beginner so go easy on me!


Well,

lookfor normal

returns

 >> lookfor normal
RANDN  Normally distributed random numbers.
...
SPRANDN Sparse normally distributed random matrix.
...

which might look interesting... :)

As for the question on squaring terms in an array (or vector), look at
".*" instead of "*"

--