# how to generate a Gaussian matrix with each matrix component having unit variance?

Started by December 2, 2010
Hi all,

I want to generate a matrix A with i.i.d zero mean Gaussian components such
that the variance of each component in the matrix (a_ij) need to have unit
variance. I used randn (M,N). But each matrix component in this case does
not have unit variance. Could someone tell me how to generate such a matrix.
Thanks a lot !

Regards,

In fact, I think you are right to use randn(M, N). It is true that each matrix
component may not have unit variance.
Y = randn returns a pseudorandom,
scalar value drawn from a normal distribution with mean 0 and standard deviation
1.
Y = randn(m,n) or Y
= randn([m n]) returns an m-by-n matrix
of the same.

This is just theoretically true. But we know that the elements are random
numbers.It is entirely possible that each elements donot mean zero with variance
1.
When the number of elements becomes larger, it will be more close to the
theoretical case (mean zero, variance unit).i.e. the following array.
>> y=randn(1,102400);
>> mean(y)

ans
0.0035

>> var(y)

ans
1.0079

See it, it is close to the theoretical condition.

Jack

________________________________
From: Maha devi
To: m...
Sent: Tue, November 30, 2010 2:54:14 PM
Subject: [matlab] how to generate a Gaussian matrix with each matrix component
having unit variance?

Hi all,

I want to generate a matrix A with i.i.d zero mean Gaussian components such that
the variance of each component in the matrix (a_ij) need to have unit variance.
I used randn (M,N). But each matrix component in this case does not have unit
variance. Could someone tell me how to generate such a matrix. Thanks a lot !

Regards,