Cross-correlation without using xcorr (vectorized)
44 views (last 30 days)
Hello, I cannot use xcorr built-in function and I will correlate two discrete signals directly in my code. I have seen some answers pointing to some FileExchange submissions that go over a nested for-for loop to do the computations. This is maybe faster, I don't doubt, but I would like to do the computation with a single for. I am trying the following, where the plots show the comparison between my method with xcorr and with frequency-domain correlation. I see non-negligible differences with my code...by the way there seems to be a lag between the xcorr and frequency domain correlation.
b0 = [block0 zeros(1,bsize)];
b1 = flip([conj(blockWPC) zeros(1,bsize)]);
bf(k) = sum(b0.*circshift(b1,k));