wcoherence​のプロットにおいて、​位相の矢印を非表示に​する方法はありますか​?

조회 수: 14 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2023년 6월 16일
답변: MathWorks Support Team 2023년 6월 16일
>> doc wcoherence
ドキュメントでは、 [wcoh,~,period,coi] = wcoherence(x,y,ts); の場合に
pcolor コマンドを使用してコヒーレンスと影響円錐をプロットする方法を説明しています。
私は、[wcoh,wcs,f] = wcoherence(x,y,fs) の場合に pcolor コマンドを使用してコヒーレンスと影響円錐をプロットする方法を知りたいと考えています。
私は、プロットに位相矢印を含めることを望んでいません。
[wcoh,wcs,f] = wcoherence(x,y,fs) の場合に、pcolor コマンドを使用してコヒーレンスと影響円錐をプロットする方法を教えてください。

채택된 답변

MathWorks Support Team
MathWorks Support Team 2023년 6월 16일
下記2つの方法例をご紹介します。
1) 
%% 周波数軸を線形に表示する
rng default
t = 0:0.001:2;
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));
% Return COI as output argument
[wcoh,wcs,f,coi] = wcoherence(x,y,1000);
h = pcolor(t*1000,f,wcoh);
h.EdgeColor = 'none';
hold on
plot(t*1000,coi,'w--','LineWidth',1.5)
ax = gca;
ax.XLabel.String='Time [msec]';
ax.YLabel.String='Frequency[Hz]';
ax.Title.String = 'Wavelet Coherence';
hcol = colorbar;
hcol.Label.String = 'Magnitude-Squared Coherence';
% ログスケーリングが必要な場合は、次のようにします。
ax.YScale = 'log';
%%
2) 2をベースとして、すべてをログスケールで表示する
%%
rng default
t = 0:0.001:2;
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));
% Return COI as output argument
[wcoh,wcs,f,coi] = wcoherence(x,y,1000);
figure
h = pcolor(t*1000,log2(f),wcoh);
h.EdgeColor = 'none';
hold on
plot(t*1000,log2(coi),'w--','LineWidth',1.5)
ax = gca;
ax.XLabel.String='Time [msec]';
ax.YLabel.String='log2(Frequency)[Hz]';
ax.Title.String = 'Wavelet Coherence';
hcol = colorbar;
hcol.Label.String = 'Magnitude-Squared Coherence';
%%

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by