- https://www.mathworks.com/help/matlab/ref/tril.html
- https://www.mathworks.com/help/matlab/ref/mean.html
How do I compute the mean correlation from a n by n correlation matrix?
조회 수: 6 (최근 30일)
이전 댓글 표시
I have a 34 x 34 correlation matrix and would like to compute the mean correlation (i.e., average of correlations above or below the diagonal). I was wondering if anyone could show me how to do that.
댓글 수: 0
답변 (1개)
Jyotish Robin
2017년 3월 30일
Hi Liane!
You could accomplish the task by making use of the functions 'tril' and 'mean'.
If a is your matrix, the following command returns the upper triangular elements (not including the diagonal elements) as a column vector:
colvect= a(find(~tril(ones(size(a)))))
Now if you do
mean(colvect)
It will give you the average of upper triangular entries of the matrix a.
In a similar way, you could deal with the lower triangular entries also. You could learn more about 'tril' and 'mean' functions from the following documentations:
Hope this helps!
Regards,
Jyotish
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!