フィルターのクリア

How do I recreate the wcoherence imagesc with the outputs wcoh, coi and f (without the arrows)?

4 ビュー (過去 30 日間)
Deepshikha Acharya
Deepshikha Acharya 2022 年 5 月 17 日
回答済み: Abhimenyu 2023 年 10 月 13 日
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.
Any help would be great! Thanks!

回答 (1 件)

Abhimenyu
Abhimenyu 2023 年 10 月 13 日
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.

カテゴリ

Help Center および File ExchangeContinuous Wavelet Transforms についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by