What can I add to this function to allow me to normalize the cross-correlation of 2 signals in the frequency domain?
Afficher commentaires plus anciens
I am in the process of refining the "xcorrFD" function to include the option to normalize the cross-correlation of 2 signals in the frequency domain, mirroring the process undertaken by MATLAB's built-in "xcorr" function. I've come across answers on how to do so in the time domain but am facing some difficulties integrating them into "xcorrFD". I'm hoping someone can determine what I need to add to the current content of the function to achieve this. For a more detailed description for how the function works, I've included the author's DL link just above what is written. Thank you for your help.
xcorrFD DL Link: https://www.mathworks.com/matlabcentral/fileexchange/63353-xcorrfd-x-y
function [lags,ck,td] = xcorrFD(x,y)
a = y'; b = x';
len = length(a);
c = [ zeros(1,len-1) a ];
d = [ b zeros(1,len-1) ];
% Compute FFTs
X1 = fft(c);
X2 = fft(d);
% Compute cross correlation
X = X1.*conj(X2);
ck = ifft((X));
[~,i] = max(ck);
td = i - len;
lags = [-(len-1):len-1];
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Correlation and Convolution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
