How to compute the time lag by cross-correlation of ir-regular time series, accurately?

HI everyone,
My data set consists of monthly observations of two parameters (already normalized) over a 50 years time window?
I require to compute the time-lag between these two time series on yearly basis, at first. IN addition, I also need to compute the time lag over 5 years windows or any other window length.
May someone suggest how i can accurately compute the phase lag.
Here is what I did so far:
% Data presentation
cd_ev=readmatrix('file.csv'); % selected candidate earthquake
tim=datenum(cd_ev(:,3),cd_ev(:,4),cd_ev(:,5),cd_ev(:,6),cd_ev(:,7),cd_ev(:,8));
p1=cd_ev(:, 9);
p2=cd_ev(:, 10);
figure(1)
plot(tim, p1)
hold on
plot(tim, p2)
hold off
Cross-correlation result
[c,lags] = xcorr(p1,p2);
[c,lags] = xcorr(p1,p2,'normalized');
figure(2)
stem(lags,c)
Thank you!

3 件のコメント

KSSV
KSSV 2023 年 5 月 29 日
You may get botht the time series into same time stamp using interp1 and than you may try using crosscorr.
Andi
Andi 2023 年 5 月 29 日
@KSSV I already scale them at same interval one observation per month.
KSSV
KSSV 2023 年 5 月 29 日
Then try crosscorr

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

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeInterpolation についてさらに検索

製品

タグ

質問済み:

2023 年 5 月 27 日

コメント済み:

2023 年 5 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by