ABSTRACT

Similarly, three-dimensional faceted surface plots are drawn with the command surf. Try surf(eye(20)).

To draw the graph of a function z = f (x, y) over a rectangle, first define vectors xx and yy, which give partitions of the sides of the rectangle. The function [x,y]=meshgrid(xx,yy) then creates a matrix x, each row of which equals xx (whose column length is the length of yy) and similarly a matrix y, each column of which equals yy. A matrix z, to which mesh or surf can be applied, is then computed by evaluating the function f entry-wise over the matrices x and y.