フィルターのクリア

xcorr

20 ビュー (過去 30 日間)
Padma
Padma 2011 年 10 月 28 日
Hi
could someone please explain the xcorr function more in detail. I actually tried reading the content under the help section but i could not understand properly. In the statement, [c,lags] = xcorr(x,y), could you explain what exactly is 'c' and 'lags' and could you please take an example and explain the output clearly.I am a beginner to matlab, please help me get the concept clearly.

採用された回答

Honglei Chen
Honglei Chen 2011 年 10 月 28 日
C is the answer you get by dong the correlation and lags is the corresponding and what xcorr(A,B) does is really moving A around and see whether it matches up with B.
Let's use a simple example, A = [1 1] and B = [1 1]
In this case, to have non-zero correlation output, A can be moved back and force by one sample and still have some overlap with B.
So at lag = -1, you can imagine that
A: 1 1
B: 1 1
so C at this point is 1. Similarly for lag = 0, you have
A: 1 1
B: 1 1
so C at this point is 2. If you do this for every position, you get
C = [1 2 1]
lag = [-1 0 1]
i.e., if the lag is -1 (A move to the left), the correlation is 1, if A does not move, the correlation is 2, ...
From this result, A and B matches best at where the maximum of C occurs, which is lag = 0.
HTH

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by