set() clears tiled chart layout plots when using to change axis scale.
조회 수: 4 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (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])
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Spectral Estimation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!