Contents Previous Next Subchapters

Combined Surface and Contour Plots (Mlmode)
Syntax surfc(Z)
See Also mlmode_surf , mlmode_contour , contour , mesh , grotate

Draw a surface plot with a contour plot below it in the current viewport .

Make a simple surface plot with row index corresponding to the positive y direction and column index corresponding to the positive x direction. Values of z near the maximum of Z are in blue, and values of z near the minimum of Z are in red. For more specific control of the coloring and levels, use the functions gcolor , glevel , mesh , contour .

Same as surfc(Z) except that the integer, real or double-precision vectors x and y specify the x and y axis values. To be specific, the row index value i corresponds to y(i) on the y axis and the column index value j corresponds to x(j) on the x axis.

The following program plots the function
     z(xy) = x^2 - y^2

x = -2 : .2 : +2;
y = -2 : .2 : +2;
[X, Y] = meshgrid(x, y);
Z = X .^ 2 - Y .^ 2;
surfc(x, y, Z)

If you run this program in Mlmode , the following plot will result