Correlation matrix of two vectors of the same length

조회 수: 5 (최근 30일)
YEMY
YEMY 2018년 11월 13일
댓글: YEMY 2018년 11월 13일
Hello,
I have two vectors A and B of the same length (1x12) and I want to make the correlation matrix (12x12) of these two, I made C = corr(A,B) and it gave me a 12x12 NaN.
Thank you.
  댓글 수: 2
KSSV
KSSV 2018년 11월 13일
Read about corr2
YEMY
YEMY 2018년 11월 13일
Doesn't help.

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

채택된 답변

the cyclist
the cyclist 2018년 11월 13일
This will happen regardless of whether or not you have NaN values in your vectors, because what you are asking for is not very sensible.
Each entry in your 12x12 matrix is going to be the "correlation" of a single value from a with a single value from b. So
M(1,1) = corr(a(1),b(1))
which is NaN, regardless of values, because the correlation of two numbers is not defined.
Are you sure you don't want a single correlation value for the two vectors?
M = corr(a',b')
?
  댓글 수: 1
YEMY
YEMY 2018년 11월 13일
Yeah, logically a correlation between two numbers means nothing. Thank you for your reponse.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by