how to reduce the execution time of xcorr() function?
Ältere Kommentare anzeigen
I want to find the windowed correlation values of x & y having array size of 1*20000. Xcorr function taking too much time to execute. Is there any way to reduce the execution time. The code is given below
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
7 Kommentare
KSSV
am 26 Feb. 2019
YOu reshape your data and use xcorr at once.
Sangeetha R
am 26 Feb. 2019
Jan
am 26 Feb. 2019
This does not work:
C = xcorr(reshape(x, w, :), reshape(y, w, :));
result = max(C, [], 1);
Sangeetha R
am 27 Feb. 2019
Bearbeitet: Sangeetha R
am 27 Feb. 2019
Jan
am 27 Feb. 2019
This can be done easily with a loop, or with the buffer command: https://www.mathworks.com/help/signal/ref/buffer.html
Sangeetha R
am 28 Feb. 2019
Jan
am 28 Feb. 2019
@Sangeetha R: Please post this as an anser and "accept" it as solution.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Correlation and Convolution finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!