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!