How do I plot multiple spectrogram of a wavefile in a subplot?

18 visualizzazioni (ultimi 30 giorni)
I need to plot multiple spectrograms(using STFT) in a single subplot. The first figure is the plot of wavefile (silence removed). Now the second figure should be the spectrogram using 'jet' and the third figure should be the greyscale spectrogram. But when I write the code below:
subplot(2,1,1);
plot(yEdited);
title('Silence Removal');
grid on;
subplot(2,1,2);
imagesc(t,f,S_log);
colormap('jet');
axis xy;
subplot(2,1,3);
imagesc(t,f,S_log);
axis xy;
colormap(flipud(gray));
axis xy;
The second and the third figure becomes exactly the same. I don't understand why! The second figure should be a coloured one and the third one should be the gray-scale.

Risposta accettata

Adam Danz
Adam Danz il 6 Ago 2018
That's because your command
subplot(2,1,2);
creates a grid of subplots that are [2-by-1]; hence, only 2 subplots. You're not creating 3 subplots. If you want 3 subplots stacked vertically you need to call
subplot(3,1,1);
subplot(3,1,2);
subplot(3,1,3);

Più risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by