How to find phase difference between two monthly time series ?

3 ビュー (過去 30 日間)
Smith J
Smith J 2020 年 9 月 2 日
コメント済み: Star Strider 2020 年 9 月 3 日
Dear All,
I have two monthly time series and I want to find phase difference between these two time series. Any lead will be helpful. I tried xcorr but dont know how to interpret the results.
An example of the time series are provided below :
T1=[ 2002.2464 -0.0336111001
2002.3285 -0.0340004094
2002.5804 -0.0461633684
2002.6653 -0.0424074503
2002.7474 -0.0373439799
2002.8323 -0.0371806156
2002.9144 -0.036254101
2003 -0.0346929255
2003.0849 -0.0314283391
2003.1615 -0.032081157
2003.2464 -0.030455973
2003.3285 -0.0350536673
2003.4956 -0.0428239858
2003.5804 -0.043654849
2003.6653 -0.0414177932
2003.7474 -0.0402629993
2003.8323 -0.0397198955
2003.9144 -0.0372285111
2004 -0.0386886688]
and
T2=[ 2002.2464 0.0283014575
2002.3285 0.0297969597
2002.5804 0.0356608957
2002.6653 0.0332108386
2002.7474 0.0297147113
2002.8323 0.0288490848
2002.9144 0.027610488
2003 0.026754985
2003.0849 0.0252721022
2003.1615 0.0246729691
2003.2464 0.0247586197
2003.3285 0.0278359036
2003.4956 0.0335587753
2003.5804 0.0341979019
2003.6653 0.0330755219
2003.7474 0.031480688
2003.8323 0.0305930355
2003.9144 0.0287892619
2004 0.0289496422]

回答 (1 件)

Star Strider
Star Strider 2020 年 9 月 3 日
This would indicate to me that they are completely out of phase:
[r,lags] = xcorr(T1(:,2), T2(:,2));
figure
plot(lags, r)
grid
.
  3 件のコメント
Smith J
Smith J 2020 年 9 月 3 日
I obtained the plot like this after using the above formula
Star Strider
Star Strider 2020 年 9 月 3 日
I doubt that it is possible to convert the lags to degrees, since there is no explicit relationship between them.
This is the best I can do in that respect (the sampling times are not contant, something I did not originally test for, however to use the Fourier transform, they must be, thus the resample calls):
Fs = 10;
[T12r,T11r] = resample(T1(:,2), T1(:,1), Fs); % Resample To Constant Sampling Interval, 10 Cy/Yr
[T22r,T21r] = resample(T2(:,2), T2(:,1), Fs); % Resample To Constant Sampling Interval, 10 Cy/Yr
L = numel(T12r);
Fn = Fs/2;
FTT12r = fft(T12r)/L;
FTT22r = fft(T22r)/L;
Fv1 = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv1);
Fv2 = linspace(-Fn, Fn, L);
Fconv = FTT12r .* FTT22r;
[Amax,idx] = max(abs(fftshift(Fconv)));
figure
subplot(2,1,1)
plot(Fv2, abs(fftshift(Fconv)), 'LineWidth',1.5)
grid
ylabel('Amplitude')
text(Fv2(idx), Amax, sprintf('\\uparrow\nAmp = %.2E\nFreq = %.2f', Amax, Fv2(idx)), 'HorizontalAlignment','left', 'VerticalAlignment','top')
subplot(2,1,2)
plot(Fv2, rad2deg(angle(fftshift(Fconv))), 'LineWidth',1)
grid
xlabel('Frequency (Cy/Yr)')
ylabel('Phase (°)')
text(Fv2(idx), rad2deg(angle(fftshift(Fconv(idx)))), sprintf('\\uparrow\nPhase = %.2f°\nFreq = %.2f', rad2deg(angle(fftshift(Fconv(idx)))), Fv2(idx)), 'HorizontalAlignment','left', 'VerticalAlignment','top')
That demonstrates that they are actually 180° out of phase.

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

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by