I found a work-around for this problem by using the pcolor()
function, which is essentially a rotated surf()
function plotted in a grid format (doc). After tinkering with the spectrogram()
function more, I'm convinced that these "spotting" artifacts have nothing to do with the data format, property, or scale. The problem seems to lie in the way MATLAB plots and visualizes 3D plots. I tried plotting with the mesh()
function as well and it produced a different kind of "spotting" effect. pcolor()
works because it's a 2D visualization of a 3D plot.
This is how spectrogram()
plots the image using surf()
(adapted from the doc):
[S,T,F,P] = spectrogram(X,256,250,256,2000);
surf(T,F,abs(S),'EdgeColor','none');
axis tight; view(0,90);
... and this is how to use pcolor()
to plot a save-friendly image:
[S,T,F,P] = spectrogram(X,256,250,256,2000);
h = pcolor(T,F,abs(S));
set(h,'EdgeColor','none');