필터 지우기
필터 지우기

help with wavelet analysis - wcoherence plot

조회 수: 10 (최근 30일)
Carlotta Dentico
Carlotta Dentico 2024년 2월 19일
답변: Sulaymon Eshkabilov 2024년 2월 19일
Hi,
I have two time series of monthly observation organized as independent vectors
a = gsg_deseasonalized; dimension 1x384
b = pt_deseasonalized; dimension 1x384
time = TT; dimension 1x384
I want to plot the wavelet coherence between these two variables. The data are sampled monthly.
I specified the sampling interval as 1/12 but in my plot I am not able to display the periods in years. I used this code and I got the attached plot.
figure
wcoherence(a, b, 1/12, 'PhaseDisplayThreshold', 0.7)
I wuold like to have the time (years) on the xaxis and the frequency (years) on the axis. Hopw ca I do it?
Thans

답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2024년 2월 19일
If understood your question correctly, follow this doc:
See this example how to set axis values, labels, etc, and use your data instead of t, x, y data, and use years().
%% DEMO Example
t = 0:1/12:36;
x = cos(2*pi*10*t).*(t>=0.5 & t<1.1)+ ...
cos(2*pi*50*t).*(t>= 0.2 & t< 1.4)+ ...
0.25*randn(size(t));
y = sin(2*pi*10*t).*(t>=0.6 & t<1.2)+ ...
sin(2*pi*50*t).*(t>= 0.4 & t<1.6)+ ...
0.35*randn(size(t));
[wcoh,~,period,coi] = wcoherence(x,y,years(1/12));
figure
period = years(period);
coi = years(coi);
h = pcolor(t,log2(period),wcoh);
h.EdgeColor = "none";
ax = gca;
ytick=round(pow2(ax.YTick),3);
ax.YTickLabel=ytick;
ax.XLabel.String="Time";
ax.YLabel.String="Period";
ax.Title.String = "Wavelet Coherence";
hcol = colorbar;
hcol.Label.String = "Magnitude-Squared Coherence";
hold on
plot(ax,t,log2(coi),"w--",linewidth=2)
hold off
wcoherence(x,y,years(1/12))

카테고리

Help CenterFile Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by