how to calculate time lag from cross correlation data for 365 days?
4 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!