フィルターのクリア

Cross-correlation without using xcorr (vectorized)

12 ビュー (過去 30 日間)
Albert Zurita
Albert Zurita 2022 年 7 月 4 日
編集済み: Albert Zurita 2022 年 7 月 4 日
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)]);
clear bf;
for k=1:(2*bsize)
bf(k) = sum(b0.*circshift(b1,k));
end
plot(abs(ifftshift(ifft(fft(block0,2*bsize).*conj(fft(blockWPC,2*bsize))))),'*-');hold on;
plot(abs(xcorr(block0,blockWPC)),'o-');
plot(abs(bf));

回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by