why are values returned by xcorr not within [-1,1]?

13 ビュー (過去 30 日間)
cgo
cgo 2016 年 12 月 12 日
コメント済み: Torsten 2025 年 12 月 4 日 11:43
I am using [r, lags] = xcorr(y1,y2) where y1 and y2 are two time series data.
I would like to know the meaning of the values returned by r and why they are the correlation values I know that should be in [-1,1].
Your insights would be great.

採用された回答

Adam
Adam 2016 年 12 月 12 日
編集済み: Adam 2016 年 12 月 12 日
Use the 'scaleopt' option as documented in the help if you want normalised results. Otherwise the results will depend on the magnitude of your data.
e.g.
a = 1:10;
b = 1:10;
xcorr( a, b )
will return values ranging from 10 to 385.
xcorr( a, b, 'coeff' )
will return values between 0 and 1;
  4 件のコメント
michal.markun
michal.markun 2025 年 12 月 4 日 11:10
I don't understand it. Correlation should always be higher than -1 and lower than +1, by definition, for any lead/lag and and irrespective of whether you compute it for the same variable (auto-) or for two variables (cross-).
Torsten
Torsten 2025 年 12 月 4 日 11:43

サインインしてコメントする。

その他の回答 (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