在matlab中交叉关联每对矩阵列

Cross Correlating each pair column of matrices in matlab

当我想在 matlab 中对两个矩阵进行互相关时遇到问题。代码如下所示:

load a.dat
load b.dat
x1 = a(:,m)
x2 = b(:,m)
m = 1:3;
for m=1:3;
x = xcrorr(x1,x2);
end

a和b都是(1500 x 3)矩阵,我想对每一列做交叉关联,得到3列的值,即和数据一样

load a.dat
load b.dat
for m=1:3
  x1 = a(:,m);
  x2 = b(:,m);
  x(:,m) = xcorr(x1,x2);
end

您可以将其缩短为:

load a.dat
load b.dat
for m=1:3
  x(:,m) = xcorr(a(:,m),b(:,m));
end