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

16 ビュー (過去 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 Center および File ExchangeWavelet Toolbox についてさらに検索

タグ

タグが未入力です。

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by