Correlation for a 3dimensional field of time series (MATLAB)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a 4 dimensional matrix with for example absolute values of a flow velocity. Just to get a picture of it:
the first two dimensions are longitude and latitude, the third dimension is the depth and the forth dimensions is time. So for every point in a 3dim space I have a time series. Now I want the correlation of each of these points with some external variable (here it's the nao-index as a function of time)
Is there some way to get a threedimensional matrix full of correlation coefficients without using a loop? (My matrices are very big, so a loop takes hours in computing time)
I have the following test code:
%produce some flow matrix:
flow(:,:,1,1) = [0.5 0.2 0.6
0.4 0.7 0.3
0.6 0.1 0.8
0.4 0.2 1.1];
flow(:,:,2,1) = flow(:,:,1,1)+0.1;
flow(:,:,1,2) = flow(:,:,1,1)-0.2;
flow(:,:,2,2) = flow(:,:,1,1)+0.2;
flow(:,:,1,3) = flow(:,:,1,1)-0.3;
flow(:,:,2,3) = flow(:,:,1,1)+0.3;
flow(:,:,1,4) = flow(:,:,1,1)-0.4;
flow(:,:,2,4) = flow(:,:,1,1)+0.4;
flow(:,:,1,5) = flow(:,:,1,1)-0.5;
flow(:,:,2,5) = flow(:,:,1,1)+0.5;
nao = [4 5 6 7 8];
C = corrcoef(flow(1,1,1,:),nao)
%but I need: matrix which contains the non-diagonal element of the correlation matrix for all points
0 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!