help with wavelet analysis - wcoherence plot
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Sulaymon Eshkabilov
le 19 Fév 2024
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))
0 commentaires
Voir également
Catégories
En savoir plus sur Wavelet Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!