How do I recreate the wcoherence imagesc with the outputs wcoh, coi and f (without the arrows)?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I can't seem to get a comparable right yaxis and coi for my data. I am using-
[wcoh,wcs,f,coi]=wcoherence(data1,data2,fs);
t=0:1/fs:(length(data1)-1)/fs;
figure; imagesc(t./60./60,f,wcoh);
hold on; plot(t./60./60,coi,'--w','LineWidth',2);
set(gca,'YDir','normal');
My yaxis and coi (figure2) don't match what I get when using wcoherence (figure1) to plot.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1001645/image.jpeg)
Any help would be great! Thanks!
0 Kommentare
Antworten (1)
Abhimenyu
am 13 Okt. 2023
Hi Deepshikha,
I understand that you are using “wcoherence” function to compute the wavelet coherence and cross-spectrum of two signals, and then plotting the results using “imagesc” and “plot”.
To ensure that the y-axis and the cone of influence (COI) match in the plot, the y-axis limits must be set correctly using the “ylim” function as shown in the example code below:
Shape[wcoh,wcs,f,coi]=wcoherence(data1,data2,fs);
t=0:1/fs:(length(data1)-1)/fs;
% Plot the coherence
figure;
imagesc(t./60./60,f,wcoh);
set(gca,'YDir','normal');
% Adjust the y-axis limits
ylim([min(f) max(f)]);
hold on;
% Plot the cone of influence (COI)
plot(t./60./60,coi,'--w','LineWidth',2);
% Adjust the y-axis limits for the COI
ylim([min(f) max(coi)]);
% Add labels and title
xlabel('Time (hours)');
ylabel('Frequency');
title('Wavelet Coherence');
% Add colorbar
colorbar;
Please refer to the following documentation link below for more information on “ylim” function,
I hope this helps!
Thank you,
Abhimenyu.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Continuous Wavelet Transforms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!