MATLAB Answers

Delay using Cross correlation

89 ビュー (過去 30 日間)
Sravantej
Sravantej 2011 年 12 月 19 日
I want to find the delay between the two signals using xcorr block in the Matlab. When i give two signals to xcorr block, i'm getting the product of the two signals but not the delay.I also tried it by coding [x,lags]=xcorr(x1,x2,'coeff'), but couldn't get the delay.Can anyone please explain how can i get that delay

  0 件のコメント

サインインしてコメントする。

採用された回答

Naz
Naz 2011 年 12 月 19 日
The output of xcorr is an array of values of how one array is similar to the other. The maximum value is when two arrays match the most. Find the place (position) of the maximum value in the array (you can look it up from the variable editor, or use built-in functions such as 'find' and 'max', I don't remember exactly). So, if your max value is at position 25, it means that the delay is 25. Also, I am not sure if it matters, but make sure to feed the xcorr function, so the shorter array slides against longer (at least it make sense analytically). Not sure if this will work, but the idea is here:
cor=xcorr(shortArray,longArray);
[~,index]=max(cor);
where 'index' should be the position of the max value as well as the delay index. So, first 25 values must be skipped from the longer array

  0 件のコメント

サインインしてコメントする。

その他の回答 (1 件)

justin  Taylor
justin Taylor 2011 年 12 月 19 日
i don't understand you say.

  1 件のコメント

Sravantej
Sravantej 2011 年 12 月 19 日
hi justin, i want to find the time delay between the two signals using cross correlation(i.e, xcorr block in matlab).Can you explain how can it be done?

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by