Cross-correlation maximum in frequency domain

61 ビュー (過去 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 Center および File ExchangeCorrelation and Convolution についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by