what is different between 'corr' and 'corrcoef'?

조회 수: 47 (최근 30일)
syen lai
syen lai 2012년 7월 3일
댓글: Michael Moore 2018년 6월 12일
I wanna compute correlation coefficient of two matrices,which function should I use? Thanks previously.

채택된 답변

Wayne King
Wayne King 2012년 7월 3일
편집: Wayne King 2012년 7월 3일
If you want a single correlation coefficient between two matrices, then neither, see corr2.
For two matrices, corr() returns the pairwise correlation between the columns of the two matrices if that is what you want.
If you input two matrices into corrcoef(), it converts the matrices to column vectors first and then just computes the correlation coefficient between those two vectors.
So for example:
X = randn(8,8);
Y = randn(8,8);
corrcoef(X,Y)
is the same as
X1 = X(:);
Y1 = Y(:);
corrcoef(X1,Y1)
  댓글 수: 3
Abhivyakti
Abhivyakti 2012년 8월 21일
What if we enter one matrix to the above functions, i.e corr, corrcoef and corr2. ?
Michael Moore
Michael Moore 2018년 6월 12일
I think that this answer is obsolete.

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by