1
votes

I am using the surf function to plot a 3D spectrogram of some signals, which can have an important spike in some points, and also some continuous CW tones in there.

The problem that I have is that matlab surf function takes for colouring the data the last points value, so the result can be a little bit confusing. This effect can be easily seen in the next pictures.

enter image description here

enter image description here

As it can be seen in both pictures, one of the sides of the peak is yellow while the other one in yellow, effect that happens as the surf is taking the value coming form the left and colors the line to the next point with its value, so in the left side we have some lower value than the peak colored and in the right we have the peak colored till the next point.

I would like to know if there is any way or other function than surfto average those values so that the plot has a more uniform (coherent) color on the spikes.

1

1 Answers

1
votes

Do not use the jet colormap! Crap like this happens when you do.

Try to use a better colormap, such as parula, viridis, or any other. You will notice how these visual artifacts dispensary. The reason for that is because in your data, green is from ~-70 to ~-55, while orange is about 5 width. That sucks!. That is why people invented perceptually uniform colormaps. You can get them for MATLAB

Also, use caxis to bring the maximum color a bit closer to your data.

Additionally: add shading interp to make surf faces interpolated values, isntead of flat colors