如何减少 xcorr 函数的执行时间?

How to reduce the execution time of the xcorr function?

我想找到 xy 的 windowed 相关值,它们是大小为 1*20000 的数组。另外,我想从每个 window.

中提取最大相关值

xcorr 函数执行时间过长。有什么办法可以减少执行时间吗?我的代码如下:

k=1;
for i = 1 : stepsize : (length(x)-w+1)
    corrValue_w = xcorr(x(i:i+w-1),y(i:i+w-1));
    maxCorrValue_w(k) = max(corrValue_w);
    k=k+1;
end

问题是信号的长度。尝试使用 FFT。这里有一些提示:Cross-correlation in matlab without using the inbuilt function? and https://dsp.stackexchange.com/questions/12630/cross-correlation-with-fft-and-fftshift。第一个似乎最相关!