필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
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 CenterFile Exchange에서 Continuous Wavelet Transforms에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by