mesh,surf,contour.
3
- surf:
% the first two matrix arguments, must have length(x) = n and
% length(y) = m where [m,n] = size(Z). In this case, the vertices
% of the surface patches are the triples (x(j), y(i), Z(i,j)).
% Note that x corresponds to the columns of Z and y corresponds to
% the rows.
(需要注意的是X和Y必须为向量,如果X和Y的长度分别为m和n,则Z必须为m*n的矩阵,即[m,n]=size(Z),在这种情况下网格线的顶点为(X(j),Y(i),Z(i,j)))
meshgrid: 生成绘制3-D图形所需的网格数据。
xgrid = -10:0.1:10;
ygrid = -10:0.1:10;
[x,y] = meshgrid(xgrid,ygrid)
z=x.^2+y.^2
surf(x,y,z)
2. mesh 是生成网格图。
3.contour是生成等高线图。
ex :