find the delay between two signals

9 views (last 30 days)
Yunyu Hu
Yunyu Hu on 13 May 2022
Commented: Yunyu Hu on 16 May 2022
I have two signals like following:
They are the same length (200),
But d = finddelay(x,y) shows
d=0;
It cannot find the correct delay between them. Which function can be used here to get the right solution?

Accepted Answer

Jonas
Jonas on 13 May 2022
use xcorr(sig1,sig2), and use the max value of xcorr. the corresponding delay can be found at the corresponding value in the lag output (second output)
  3 Comments
Yunyu Hu
Yunyu Hu on 16 May 2022
Hi, Thanks a lot for the explaination! It is quite reasonable.
And I found the reason, why both xcorr and finddelay cannot give me the correct answer for my original signals. Because the peak is downwards.
If I change the the x and y like this:
x=20-[10,11,12,13,14,15,16,15,14,12];
y=20-[10,10,10,10,11,12,13,14,15,16,15,14,12];
and run your codes, it can also not find the correct answer.
I think this is the limitation of cross correlation. But I can do conversion on signals. :-)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by