When using Corrcoef

조회 수: 6 (최근 30일)
Mate 2u
Mate 2u 2012년 5월 11일
답변: Ahsanul Hasan 2016년 4월 17일
Hi all, When using corrcoef on a matrix. Is there a way to get the mean of all the values on the bottom left triangular side or the top right triangle?
All the best,

채택된 답변

Daniel Shub
Daniel Shub 2012년 5월 11일
I am not sure exactly what you want ...
EDIT but not really different
N = 10;
x = randn(N);
y = corrcoef(x);
z = mean(y(tril(true(N))))
  댓글 수: 3
Daniel Shub
Daniel Shub 2012년 5월 11일
I edited it to add the corrcoeft part and do the bottom-left and not top-right, but it doesn't change what I am doing. This what you want?
Wayne King
Wayne King 2012년 5월 11일
If you don't want to average the main diagonl, which is necessarily all 1's, then use Daniel's code with
z = mean(y(tril(true(N),-1)))

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

추가 답변 (1개)

Ahsanul Hasan
Ahsanul Hasan 2016년 4월 17일
pls help me in matlab code for find correlation vs covariance

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by