How to generate a random positive semi-definite matrix of certain size with real numbers in a certain range?

조회 수: 6 (최근 30일)
I'm looking for a way to generate a *random positive semi-definite matrix* of size n with real number in the *range* from 0 to 4 for example.
I didn't find any way to directly generate such a matrix. However, I found that *Lehmer* matrix is a positive definite matrix that when you raise each element to a nonnegative power, you get a positive semi-definite matrix.
So, I did something like this
A=16*gallery('lehmer',100) %matrix of size 100*100 in range 0-16
B=A.^(1/2) %scale down to range 0-4
So my questions are:
1. I wonder if that maintains the randomness of the matrix?
2. Is there any direct way to generate random positive semidefinite matrix?
Thanks,

채택된 답변

Walter Roberson
Walter Roberson 2011년 10월 21일
  댓글 수: 2
Khanh
Khanh 2011년 10월 26일
The problem with the solutions in the thread that you referred to is that you have C=A*A'. (C is the result here)
So if you want C[i][j] to be in a range say 0 to 5. Then you need A=sqrt(5)*rand(n).
Then the result C will not truly random in the range 0 to 5, I think.
Walter Roberson
Walter Roberson 2011년 10월 26일
Your question as phrased was about constructing random PD matrices whose entries were all within a certain range.
That is a different matter than constructing matrices whose entries have a uniform distribution within a given range and the matrix as a whole is PD. Such matrices appear to be relatively rare to start with; to require uniform random distribution on the entries appears to make them difficult to generate.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by