how to calculate time lag from cross correlation data for 365 days?

4 ビュー (過去 30 日間)
AA
AA 2021 年 5 月 16 日
回答済み: Asvin Kumar 2021 年 6 月 25 日
Dear All,
I am sorry if this question is too basic.
I calculated the Cross-correlation function for 365 days (each day devided into 2 segments). Now I want to calculate the lag time by keeping first as a reference.
I know it is simple if we have two function.
I have max 300 seconds as lag time on each sides (positve and negative) and total number of data poitns are 3001*1 as shown in attached picture.
How can i calculate the lag time for each day?

採用された回答

Asvin Kumar
Asvin Kumar 2021 年 6 月 25 日
I'm not a 100% clear on what you're trying to achieve but this sounds like a good use case for xcorr. You can look at the usage with the xcorr(x, y, maxlag) syntax. You can skip the second argument in the call to xcorr to calculate auto-correlation.
If it suits your use case, you can perform a max operation on the output from xcorr to identify the lag which gives the highest correlation value. Here's an example of that in the 2D case although the same principles will apply in the 1D case as well: Align two images using cross-correlation

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