Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a random real symmetric square matrix with uniformly distributed entries

Tags:

People also ask

How do you generate a random square matrix in Matlab?

rand (MATLAB Functions) The rand function generates arrays of random numbers whose elements are uniformly distributed in the interval ( 0 , 1 ). Y = rand(n) returns an n -by- n matrix of random entries.

What does rand() do in matlab?

X = rand returns a random scalar drawn from the uniform distribution in the interval (0,1). X = rand( n ) returns an n -by- n matrix of uniformly distributed random numbers.

How do you generate random uniform numbers?

Use rand to generate 1000 random numbers from the uniform distribution on the interval (0,1). rng('default') % For reproducibility u = rand(1000,1); The inversion method relies on the principle that continuous cumulative distribution functions (cdfs) range uniformly over the open interval (0,1).

How do you create a symmetric positive definite matrix?

The matrix symmetric positive definite matrix A can be written as , A = Q'DQ , where Q is a random matrix and D is a diagonal matrix with positive diagonal elements. The elements of Q and D can be randomly chosen to make a random A.


I would like to generate a random real symmetric square matrix with entries uniformly distributed between 0 and 1. My attempt is: a = rand(5); b = a + a.'

My worry is that whilst matrix a is uniformly distributed according to the documentation http://www.mathworks.com.au/help/techdoc/ref/rand.html matrix b might not be since the average of two random numbers might not be the same as the original number.

I tried to use hist(a); hist(b) but not sure how to interpret the resulting graph. EDIT: According to Oli matrix b is no longer uniformly distributed, is there a way to make it that way?