MATLAB: What is the difference between those two functions

MATLAB

I have been using the function mesh and surf on two different occasions, but i still don't understand, what exactly is the difference between those two.

Best Answer

surf() and mesh() both create Chart Surface Objects in current releases. surf() turns on face coloring by default and uses black edges by default, whereas mesh() turns face coloring off by default and uses colored edges by default.
When you draw a large surface the edges usually get in the way of seeing anything (they are constant width but the individual tetrahedrons get smaller with larger surfaces), so I typically turn edges off.
Sometimes what you want is to see the outside of a solid surface; surf() gives you that. But the face colors hide the interior details (hidden line removal) and sometimes you need that internal detail so it is nice to have mesh() sometimes.
Just different defaults on the same graphics object. Not all that different in a way from (for example) plot() vs semilogx(), which differ only in whether the axes XScale is set to 'log' or 'normal', different defaults for the same graphics object.