set() clears tiled chart layout plots when using to change axis scale.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
檮杌
il 27 Set 2023
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 Commenti
Vedere anche
Categorie
Scopri di più su Spectral Estimation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!