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

62 visualizaciones (últimos 30 días)
syen lai
syen lai el 3 de Jul. de 2012
Comentada: Michael Moore el 12 de Jun. de 2018
I wanna compute correlation coefficient of two matrices,which function should I use? Thanks previously.

Respuesta aceptada

Wayne King
Wayne King el 3 de Jul. de 2012
Editada: Wayne King el 3 de Jul. de 2012
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 comentarios
Abhivyakti
Abhivyakti el 21 de Ag. de 2012
What if we enter one matrix to the above functions, i.e corr, corrcoef and corr2. ?
Michael Moore
Michael Moore el 12 de Jun. de 2018
I think that this answer is obsolete.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by