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_surf Search Tools-> contents reference index search

Surface Plots (Mlmode)
 Syntax `surf(`Z`)` `surf(`x`, `y`, `Z`)` See Also mlmode_contour , mesh , grotate

Description
Surface plots in the current viewport ``` surf(```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 . ``` surf(```x`, `y`, `Z```) ```Same as `surf(`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; surf(x, y, Z) ``` If you run this program in Mlmode , the following plot will result ``` ```