interpreting xcorr for time series plots
4 ビュー (過去 30 日間)
古いコメントを表示
i'm using xcorr to work out the lag between two time series.
When I plot the results of xcorr, and ask it to return the maximum lag, the result I get is -58.3.
This is the maximum positive c value, but the spike at 0 into negative c values is the largest overall - is this the result i should be using instead?
0 件のコメント
回答 (1 件)
Jatin
2024 年 9 月 10 日
編集済み: Jatin
2024 年 9 月 10 日
The result you should choose depends on the context of your analysis. The "xcorr" function represents "the similarity between a vector x and shifted (lagged) copies of a vector y as a function of the lag." If your goal is to find the exact shift needed to align the signals, you should select the highest correlation value, whether it occurs at a positive or negative lag.
Since you mentioned that the spike at lag 0 is the largest, this indicates the signals are best aligned without any shift. Therefore, if you're looking for the best overall alignment, you can use the lag at 0.
Refer the below documentation on "xcorr" for more details on how the function works:
Hope this helps!
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!