Cross-correlation maximum in frequency domain

조회 수: 44 (최근 30일)
Albert
Albert 2022년 2월 23일
댓글: Rochelle 2024년 2월 9일
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

답변 (1개)

vidyesh
vidyesh 2023년 10월 19일
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
Albert Zurita
Albert Zurita 2023년 10월 24일
excellent, thank you!
Rochelle
Rochelle 2024년 2월 9일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by