# How to generate random positive semi-definite matrix with ones at the diagonal positions?

조회 수: 4 (최근 30일)
Mr M. 2015년 5월 26일
답변: Abhiram Bhanuprakash 2015년 5월 26일
I can create random positive semi-definite matrix, but how to force the ones at the diagonal positions? I need a random correlation matrix.
##### 댓글 수: 1이전 댓글 -1개 표시이전 댓글 -1개 숨기기
Mr M. 2015년 5월 26일
But I don't know the meaning of K and p !?

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

### 채택된 답변

Abhiram Bhanuprakash 2015년 5월 26일
Hi Mr. M,
I went through the code in the File Exchange submission 'RandomCorr.m' which you mentioned.
I could see that, in line 62 of that code,
p=min(eig(C));
So I guess this is to check whether the minimum eigen value of the correlation matrix is >= 0 (in other words, to check if the correlation matrix 'C' is PSD or not)
But, I am not sure about the variable 'K'. Perhaps if you refer to the paper or contact the author of the File Exchange submission himself, you would get a better answer.
See a related post here
Hope this helps,
Cheers!
Abhiram

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

### 카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by