フィルターのクリア

set() clears tiled chart layout plots when using to change axis scale.

7 ビュー (過去 30 日間)
Alexander
Alexander 2023 年 9 月 26 日
回答済み: 檮杌 2023 年 9 月 27 日
I need to show these spectrograms with a logarithmic axis to show low frequency details in the spectra. Each time i use the set function it clears all other tiles/subplots.
figure
tcl = tiledlayout(1,3);
ax1=nexttile(tcl)
spectrogram(e2c.signal,e1b.windowLength(1),e1b.overlap(1),e1b.freqSteps,e1b.fs,'yaxis');
set(ax1,'YScale','Log')
ax2=nexttile(tcl);
spectrogram(e2c.y1,e1b.windowLength(1),e1b.overlap(1),e1b.freqSteps,e1b.fs,'yaxis');
set(ax2,'YScale','Log')
ax3=nexttile(tcl);
spectrogram(e2c.y2,e1b.windowLength(1),e1b.overlap(1),e1b.freqSteps,e1b.fs,'yaxis');
set(ax3,'YScale','Log')
the same issue occurs using subplot.
figure
ax1= subplot(1,3,1);
spectrogram(e2c.signal,e1b.windowLength(1),e1b.overlap(1),e1b.freqSteps,e1b.fs,'yaxis');
set(ax1,'YScale','Log');
title('1')
ax2=subplot(1,3,2);
spectrogram(e2c.y1,e1b.windowLength(1),e1b.overlap(1),e1b.freqSteps,e1b.fs,'yaxis');
set(ax2,'YScale','Log');
title('2')
ax3=subplot(1,3,3);
spectrogram(e2c.y2,e1b.windowLength(1),e1b.overlap(1),e1b.freqSteps,e1b.fs,'yaxis');
set(ax3,'YScale','Log');
title('3')
Can anyone suggest a better way to achieve a logarithmic axis on the spectrogram? I couldn't work out how to through the documentiation.

回答 (1 件)

檮杌
檮杌 2023 年 9 月 27 日
I don't think I can reproduce your issue. Can you elaborate your issue by changing the sample code that I attach below?
%% Setting up a placeholder signal
N = 1024;
n = 0:N-1;
w0 = 2*pi/5;
x = sin(w0*n)+10*sin(2*w0*n);
%% Plot
figure
tcl = tiledlayout(1,3);
ax1=nexttile(tcl);
spectrogram(x,'yaxis');
set(ax1,'YScale','Log')
ax2=nexttile(tcl);
spectrogram(x,'yaxis');
set(ax2,'YScale','Log')
ax3=nexttile(tcl);
spectrogram(x,'yaxis');
set(ax3,'YScale','Log')
gcfPos = get(gcf,'position');
set(gcf, "Position", [gcfPos(1), gcfPos(2), 1200, 420])

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by