correlation of an array
5 次查看(过去 30 天)
显示 更早的评论
i've an array in which i've stored different matrices. i want to calculate the correlation between the matrices stored in an array
like:
A=[ 12 23 12 34 21 32 43 65 65 76 1 23 43 21 54 98 ]
21 43 2 13 76 87 34 22 89 67 45 88 55 77 54 65
32 45 56 78 89 87 84 54 22 33 43 54 78 98 97 65
67 54 33 44 88 77 66 54 21 15 16 48 90 80 21 66
like if i've array=[A;B;C;D]
i want the correlation between A and B
correlation between A and C
correlation between A and D
correlation between B and C
correlation between B and D
correlation between C and D
help me in doing so
2 个评论
Tobias
2013-4-8
Isn't that basicly the xcorr function? I have not worked with that before, but did you check Cross-correlation?
采纳的回答
Image Analyst
2013-4-8
Extract the 4 submatrices and correlate all the permutations.
A = fullMatrix(:, 1:4);
B = fullMatrix(:, 5:8);
C = fullMatrix(:, 9:12);
D = fullMatrix(:, 13:16);
% Now correlate:
AB = xcorr2(A, B);
AC = xcorr2(A, C);
AD = xcorr2(A, D);
BC = xcorr2(B, C);
BD = xcorr2(B, D);
CD = xcorr2(C, D);
There is no need for complicated loops when you have this few matrices, and just a few simple lines of code will do it for you.
8 个评论
Image Analyst
2013-4-9
I don't understand - those look like pixel values, not ID numbers of blocks. I thought you just had 16 blocks and each block was a 4 by 4 array. You wouldn't compute correlation of single pixel values - you do it with 2D arrays. But frankly I don't know what you're after since you didn't give us the whole picture, the larger context, so I don't know if your approach is even correct to do what you think you want to do, or not.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Descriptive Statistics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!