【问题标题】:xcorr versus finddelay for finding delay between signalsxcorr 与 finddelay 用于查找信号之间的延迟
【发布时间】:2015-01-21 04:51:30
【问题描述】:

计算两个脉冲之间的时间延迟here,使用函数finddelay(pulse1,pulse2),我得到了8.73纳秒的正确值。但是,当我使用xcorr(pulse1,pulse2) 时,结果大约是 11.2 纳秒……我在这里做错了什么?

xcorr:

r=xcorr(pulse1,pulse2); 
[a,b]=max(r);
delay=20/4096*b;

here's 互相关图

查找延迟:

delay=finddelay(v1,v2);
t=20/4096*delay;

第一种情况延迟=2308,第二种情况延迟=1788

【问题讨论】:

  • 你是怎么得到 xcorr 的延迟的?
  • 对于一个 20nsec 的窗口,每个窗口有 4096 个点,延迟是 (20/4096)*c,其中 c 是 xcorr() 序列的最大值的位置(在我的例子中是 c=第2308章)
  • 可以放一些数据和一些代码吗? uk.mathworks.com/help/signal/ref/xcorr.html 中有一个很好的例子来说明如何正确地做到这一点。根据建议的代码尝试你的一段代码,看看你是否得到相同的

标签: matlab cross-correlation


【解决方案1】:

在您的问题中,您没有提到采样频率,因为 finddelay 和 xcorr 会延迟采样数量。

检查这个例子,

Fs = 100;
L  = 1000;
t = (-L / 2 : 1 : L / 2) / Fs;
y1 = sinc(t);
y2 = sinc(t - 1);
plot(t,y1,'b'); hold on;
plot(t,y2,'m');
d1 = finddelay(y1,y2) / Fs;
[c,lags]=xcorr(y1,y2);
d2 = -(lags(c == max(c))) / Fs;  % minus is for nature of xcorr

d1 和 d2 的答案都是 1。

【讨论】:

    【解决方案2】:

    正如上面的答案所暗示的,您的错误在于您使用了 xcorr。您需要同时询问“c”值和“滞后”:

    [c,lags]=xcorr(pulse1,pulse2);  %do the cross-correlation
    [max_c,I]=max(x);  %find the best correlation
    delay = lags(I);  %here is the delay in samples
    

    【讨论】:

    • 嗯...我也想通了!不过,感谢您的提醒! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-12
    相关资源
    最近更新 更多