Spectrogram function cutting off beginning and end of signal
Show older comments
Hi,
I have a 10 second audio clip (called originalsound) with a sampling frequency of 2,000 Hz (called downsampledrate) that I want to plot using spectrogram. When I do so with the following code:
figure; spectrogram(originalsound,N,[],[],downsampledrate,'yaxis')
title('Original Sound')
set(gca,'FontSize',16)
yt = get(gca, 'YTick');
set(gca, 'YTick',yt, 'YTickLabel',yt*1E+3) %change y-axis to Hz from kHz
ylabel('Frequency (Hz)') %change y-axis label
the plot generates without 0 or 10 labeled for time on the x-axis.

I tried fixing this by changing the xlim from 0-10, but then I get white bars on either side of the spectrogram.

If I am plotting a 10 second sound, why are there not 10 seconds shown in the spectrogram? Is there some sort of windowing effect going on?
Accepted Answer
More Answers (0)
Categories
Find more on Time-Frequency Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!