|
Contents | Previous | Next | Subchapters |
| Syntax |
surf(Z) |
surf(x, y, Z) | |
| See Also | mlmode_contour , mesh , grotate |
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.
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