wcoherenceのプロットにおいて、位相の矢印を非表示にする方法はありますか?
11 views (last 30 days)
Show older comments
MathWorks Support Team
on 16 Jun 2023
Answered: MathWorks Support Team
on 16 Jun 2023
>> 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 コマンドを使用してコヒーレンスと影響円錐をプロットする方法を教えてください。
Accepted Answer
MathWorks Support Team
on 16 Jun 2023
下記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 Comments
More Answers (0)
See Also
Categories
Find more on Wavelet Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!