Mesh plot of a function of two variables with contour of the surface on the x-y plane.
z An mXn matrix of the function values to plot.
x Either a vector of length n or a matrix of size mXn .
y Either a vector of length m or a matrix of size mXn .

The inputs x and y should either be both vectors, or matrices of the indicated size. In the former case, the function is assumed to be of the form z[i,j]=f(x[j], y[i]) . Otherwise, the functional form z[i,j]=f(x[i,j],y[i,j]) is assumed.

The mesh plot is drawn as a set of lines enclosing each of the regions bounded by the four points (x[i,j], y[i,j], z[i,j]) , (x[i+1,j], y[i+1,j], z[i+1,j]) , (x[i+1,j+1], y[i+1,j+1], z[i+1,j+1]) and (x[i,j+1], y[i,j+1], z[i,j+1]) .

The color of the lines is determined by the average value of z along each of the line segments.

In addition to the mesh lines, a contour of the surface is also displayed on the x-y plane.