corr returns NaN
조회 수: 43(최근 30일)
표시 이전 댓글
I'm calculating the correlation coefficient between two vectors, using corr. It returns NaN, and I'm curious to know why that is the case.
c and d are the vectors.
>> [c d]
ans =
1 1
2 1
2 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
2 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
댓글 수: 0
채택된 답변
Sean de Wolski
2011년 7월 7일
read the:
doc corr
and you'll see it's not what you want. Are you looking for :
doc corrcoef %?
추가 답변(1개)
Bio_Ing_Sapienza
2019년 2월 24일
Maybe you have to ceck for "Inf" components in your array. Sometimes I was searching from Nan even if I had already checked them out. But there are other kind of Matlab numeric representation for results came from division that yields to too large numbers to be represented with floating number. So check also for these ones!
댓글 수: 0
참고 항목
범주
Find more on Numeric Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!