Contents Previous Next Subchapters Current Chapters-> mlmode_mean mlmode_std mlmode_ellipke mlmode_disp mlmode_warning str2mat int2str mlmode_contour mlmode_mesh mlmode_meshc mlmode_surf mlmode_surfc mlmode_meshgrid mlmode_etime mlmode_finite mlmode_full mlmode_isieee mlmode_isunix mlmode_issparse mlmode_isstr Parent Chapters-> Omatrix6 mlmode mlmode_mfile mlmode_surfc Search Tools-> contents reference index search

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

Description
Draw a surface plot with a contour plot below it in the current viewport . ``` surfc(```Z```) ```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 . ``` surfc(```x`, `y`, `Z```) ```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.

Example
The following program plots the function ```      z(x, y) = x^2 - y^2 `````` clear 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 ``` ```