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

11 次查看(过去 30 天)
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.

采纳的回答

Adam Danz
Adam Danz 2018-8-6
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time-Frequency Analysis 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by