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 日

0 投票

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 件のコメント

Mate 2u
Mate 2u 2012 年 5 月 11 日
No thats not what I want, when doing corrcoef on a matrix I want the mean of the bottom left values.
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 日

0 投票

pls help me in matlab code for find correlation vs covariance

タグ

質問済み:

2012 年 5 月 11 日

回答済み:

2016 年 4 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by