필터 지우기
필터 지우기

How to calculate correlation coefficient between three dimensional matrix ?

조회 수: 3 (최근 30일)
SONI SONI
SONI SONI 2016년 8월 5일
편집: SONI SONI 2016년 8월 5일
Hello,
I have two gridded matrix, matrix1 and matrix2 having latitude, longitude and months (180 x 360 x 12). I have calculated correlation coefficient and p-value between both matrices using corrcoeff function. Than I assigned three values in correlation matrix, 1 for positive correlation (p-value is <0.05), -1 for negative correlation (p-value is <0.05) and 0 for rest of the positive/negative correlation which have insignificant (>0.05) p-value. I wrote following code for correlation coefficient calculation:
for y = 1:180,
for x = 1:360,
A = matrix1(y,x,:);
B = matrix2(y,x,:);
[C,P] = corrcoef(A,B);
m = C(1,2);
n = P(1,2);
map1(y,x) = m;
pval(y,x) = n;
if map1 > 0 & pval <= 0.05;
cormap(y,x) = 1;
elseif map1 < 0 & pval <= 0.05;
cormap(y,x) = -1;
else
cormap(y,x) = 0;
end;
end;
end;
basically I want want to find significant and insignificant correlation values in correlation matrix. But using above code final output cormap is showing 0 value in entire matrix. I am not getting where I am wrong. Can anyone help me to solve this problem ?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by