You need to provide more input arguments to spectrogram . The form of the function you need:
[S,F,T]=spectrogram(x,window,noverlap,F,fs)
See the http://www.mathworks.com/help/signal/ref/spectrogram.html full documentation, but basically you need to define:
windows : number of samples used for each spectral estimate calculationnoverlap : how many samples to include from the calculation of spectrum N-1 in spectrum NF : the frequencies you want to evaluate infs : sample rate of your signal.
Then build the spectrogram with:
subplot(313); imagesc( T, F, log(S) ); %plot the log spectrum set(gca,'YDir', 'normal'); % flip the Y Axis so lower frequencies are at the bottom
Note. The quality and interpretability of the spectrogram depends on the use of the correct inputs in the spectrogram function.
source share