Path: news.mathworks.com!not-for-mail
From: "Doug Hull" <hull@mathworks.SPAMPROOFcom>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Random matrix/normal distribution
Date: Tue, 29 Sep 2009 20:14:02 +0000 (UTC)
Organization: The MathWorks Inc
Lines: 18
Message-ID: <h9tpqa$8lg$1@fred.mathworks.com>
References: <h9tpd6$bh9$1@fred.mathworks.com>
Reply-To: "Doug Hull" <hull@mathworks.SPAMPROOFcom>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1254255242 8880 172.30.248.37 (29 Sep 2009 20:14:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 29 Sep 2009 20:14:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 869436
Xref: news.mathworks.com comp.soft-sys.matlab:573792


A .^ 2

This will take your matrix and square it element by element.

.* is similar.

Doug

"Michael Grosswald" <michaelgrosswald@yahoo.co.uk> wrote in message <h9tpd6$bh9$1@fred.mathworks.com>...
> 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!