function c=correlation2D(x,y)
% c=correlation(x,y)

[n1,n2,nt]=size(x);

xm=mean(x,3);
ym=mean(y);

xa=x-xm(:,:,ones(1,nt));
ya=y(:)-ym;
ya=reshape(ya(:,ones(n1,n2))',n1,n2,nt);
c=mean(xa.*ya,3)./sqrt(mean(xa.^2,3))./sqrt(mean(ya.^2,3));
