1

我通过首先使用自动相关找到回声信号的参数来实现回声消除器。我的信号有多次延迟。使用 s=xcorr(x,x) 后,如何提取 s 的峰值?max 函数给出 s 中心的值,findpeaks() 给出紧邻最大峰值但高于实际延迟峰值的峰值值。

4

1 回答 1

1

简而言之

将 findpeaks 与 SORTSTR 应用于自相关的平滑版本。

更多的话

这实际上取决于您的信号有多嘈杂,但您的问题的快速解决方案是首先平滑您的自相关以限制噪声的影响,这可能会在感兴趣的峰值周围引入多个局部最大值。然后,您可以按降序排列峰值。

其他可以使用和可能组合的选项:

  • 'MINPEAKHEIGHT' 查找高于阈值的峰值(比如高于自相关最大值的 10%)
  • 'MINPEAKDISTANCE' 避免局部最大值彼此太近

或者只是编写您自己的代码,这是您最终可能需要做的事情,以使代码完全按照您的意愿行事。

在代码中:

% Create right portion of autocorrelation of a sinusoid with some noise
% This should lead to peaks of decreasing amplitude around positions 1, 26, 51, 76
% Note: This is a quick example.  A more realistic signal would show better peaks.
x=.4*sin(2*pi*(1:N)/N*4)+rand(1,N);
autocorr=xcorr(x);
autocorr=autocorr(N:(2*N-1));

% Smooth out the autocorrelation
autocorrFiltered=filter([1 1 1 1 1],[1],autocorr);
subplot(2,1,1);
plot(autocorr);
xlabel('Autocorrelation')
subplot(2,1,2);
plot(autocorrFiltered);
xlabel('Smoothed autocorrelation')
[peaks,locations]=findpeaks(autocorrFiltered,'SORTSTR','descend');

% Display locations, correcting for the filter offset
locations-3
ans =

      2    23    49    73    92

在图像中:

这是过滤器和未过滤的自动校正的并排比较,说明了为什么平滑有助于找到峰值。

在此处输入图像描述

于 2013-03-22T03:25:47.973 回答