필터 지우기
필터 지우기

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

조회 수: 12 (최근 30일)
sangeet sagar
sangeet sagar 2018년 8월 4일
답변: Adam Danz 2018년 8월 6일
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