Why do spectrograms produced using the exact same code in 2015b and 2016a look so different?
1 view (last 30 days)
Show older comments
I have a signal for which I am looking at the spectrogram of, when I upgraded from 2015b to 2016a, the spectrogram suddenly looked very different despite using the exact same options in the spectrogram function. Why is this?
Here is the code that is run in both 2015b and 2016a:
% Spectrogram settings
Ny = length(y);
nsc = floor(Ny/10);
nov = floor(0.9*nsc);
nff = 0:20000;
% Spectrogram
spectrogram(y,nsc,nov,nff,Fs,'yaxis');
And here are the resultant spectrograms, with both colourmaps set to Jet using colormapeditor, left is 2015b and right is 2016a.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158768/image.png)
3 Comments
Chad Greene
on 28 Mar 2016
This is either a difference in the display or a difference in the calculation of the values being displayed. It's most likely an issue of the display, not the underlying values. Could be the figure renderer or some other minor difference in default settings.
Matlab figure windows have never been the best way to display data, so screenshots of figure windows do not offer a good direct comparison. Try using export_fig to get a more accurate picture of the plot in both releases.
On a related note, if you are concerned about potentially nonphysical speckles being introduced into the display of your data, be warned that the jet colormap inherently introduces false gradients and puts emphasis on arbitrary values. The lightness profile of a jet colormap does not increase linearly with the values it represents. It is possible that the differences you're seeing are very small differences that have been amplified by effects of the jet colormap. Perhaps a more linear-lightness colormap like parula or cubehelix or Jan Brewer's colormaps will mute the effect you're seeing.
Answers (0)
See Also
Categories
Find more on Colormaps 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!