Filter löschen
Filter löschen

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

12 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Adam Danz
Adam Danz am 6 Aug. 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);

Weitere Antworten (0)

Kategorien

Mehr zu Time-Frequency Analysis finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by