Cross-correlation maximum in frequency domain

55 vues (au cours des 30 derniers jours)
Albert
Albert le 23 Fév 2022
Commenté : Rochelle le 9 Fév 2024
I need to compute the complex cross-correlation between two signals a and b and the take only the maximum value of the cross-correlation, regardless of the lag time where this occurs. I can do it either in time domain or in frequency domain. This needs to be later incorporated in a FPGA, so I want to be efficient.
An alternative is to go to frequency domain correlation, but I would need to do
max(IFFT(FFT(a)*conj(FFT(b))))
which is probably computationally costly. Is there a way to avoid going back and forth twice to the frequency and time domain and still compute the maximum cross-correlation?
thanks

Réponses (1)

vidyesh
vidyesh le 19 Oct 2023
Hi Albert,
I understand that you want to calculate the maximum value of the cross-correlation of two signals in an efficient manner.
To accomplish this task, you can utilize the 'xcorr' function in MATLAB. This function enables the computation of the cross-correlation between two discrete-time sequences. The following code snippet demonstrates how to obtain the desired value:
val = max(xcorr(a,b));
It's important to note that if you intend to calculate the value using the method mentioned in the question, which involves "max(IFFT(FFT(a)*conj(FFT(b))))", you will need to apply "zero-padding" to both signals beforehand. After padding, the length of the cross-correlation between 'a' and 'b' should be equal to the sum of the lengths of 'a' and 'b' minus one (length(a) + length(b) - 1).
aa = [a zeros(1, length(b) - 1)];
bb = [b zeros(1, length(a) - 1)];
val = max(ifft(fft(aa).*conj(fft(bb))));
Refer to the following documentation for more information:
Hope this answer helps.
  2 commentaires
Albert Zurita
Albert Zurita le 24 Oct 2023
excellent, thank you!
Rochelle
Rochelle le 9 Fév 2024
Vidyesh, Within the xcorr function both x and y are converted to fft and then back to ifft after multiplication. So, by using xcorr function, I dont think it will solve the problem. It will still be computationaly expensive.

Connectez-vous pour commenter.

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by