correlation of an array
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Tobias
il 8 Apr 2013
Isn't that basicly the xcorr function? I have not worked with that before, but did you check Cross-correlation?
Risposta accettata
Image Analyst
il 8 Apr 2013
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 Commenti
Image Analyst
il 9 Apr 2013
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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Descriptive Statistics in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!