Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

ノイズの中の遅延信号の相互相関

この例は、相互相関列を使用して、ノイズで破損したシーケンスの時間遅延を検出する方法を示しています。出力シーケンスは加法性ホワイト ガウス ノイズを伴う入力シーケンスの遅延バージョンです。2 つのシーケンスを作成します。1 つのシーケンスは他方の遅延バージョンです。遅延は 3 サンプルです。N(0,0.32) ホワイト ノイズを遅延信号に加算します。サンプルの相互相関列を使用して遅れを検出します。

信号を作成し、プロットします。再現性のある結果を得るために、乱数発生器を既定の状態に設定します。

rng default

x = triang(20);
y = [zeros(3,1);x]+0.3*randn(length(x)+3,1);

subplot(2,1,1)
stem(x,'filled')
axis([0 22 -1 2])
title('Input Sequence')

subplot(2,1,2)
stem(y,'filled')
axis([0 22 -1 2])
title('Output Sequence')

Figure contains 2 axes objects. Axes object 1 with title Input Sequence contains an object of type stem. Axes object 2 with title Output Sequence contains an object of type stem.

サンプルの相互相関列を求め、最大絶対値を使用して遅れを推定します。サンプルの相互相関列をプロットします。相互相関列の最大値は、予想どおりラグ 3 で発生します。

[xc,lags] = xcorr(y,x);
[~,I] = max(abs(xc));

figure
stem(lags,xc,'filled')
hold on
stem(lags(I),xc(I),'filled')
hold off
legend(["Cross-correlation",sprintf('Maximum at lag %d',lags(I))])

Figure contains an axes object. The axes object contains 2 objects of type stem. These objects represent Cross-correlation, Maximum at lag 3.

関数 finddelay を使用して結果を確認します。

finddelay(x,y)
ans = 3

参考

|