MATLAB Lecture 9 School of mathemat ciences Xiamen University http://gdjpkc.xmu.edu.cn >>t=(l/16:1/8:1)*2*pi >>x=sin(t); y=cos(t) 回当4俄回某日目日口 >> fll(xy,'r) >> axIs sq 2 Mesh and Surface plots Mesh plots mesh(X,Y, 2) draws a wireframe mesh with color determined by Z so color is proportional to urface height. If X and Y are vectors, length(X)=n and length(Y)=m, where [m, n size(Z). In this case, (XO,Y(, Z(iD)are the intersections of the wireframe grid lines; X and Y correspond to the columns and rows of Z, respectively. If X and Y are matrices X(j,Y(i,j, Z(,)) are the intersections of the wireframe grid line mesh(z) draws a wireframe mesh using X=1: n and Y=1 m, where [m, n]= size(z). The height, Z, is a single-valued function defined over a rectangular grid Color is proportional to mesh(, C) draws a wireframe mesh with color determined by matrix C MATLAB performs a linear transformation on the data in C to obtain colors from the current colormap. IfX, Y and Z are matrices, they must be the same size as C -8: 8: y=-8: 8: X, Y]=meshgrid(x y); >>X-8: 8: y=-8: 8: X, Y]=meshgrid(x,y) >>Z=X^2/42-Y.^2/5^2] >>Z=X^2/42-Y.^2/5^2] >>mesh(X,Y, Z > mesh(x, y, 2) lit Yie Insert Tools Bealeton tinto Has 回4俄a回长日□MATLAB Lecture 9 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Lec94 >> t = (1/16:1/8:1)'*2*pi; >> x = sin(t); y = cos(t); >> fill(x,y,'r') >> axis square ² Mesh and Surface Plots ¸ Mesh Plots mesh(X,Y,Z) draws a wireframe mesh with color determined by Z so color is proportional to surface height. If X and Y are vectors, length(X) = n and length(Y) = m, where [m,n] = size(Z). In this case, (X(j),Y(i),Z(i,j)) are the intersections of the wireframe grid lines; X and Y correspond to the columns and rows of Z, respectively. If X and Y are matrices, (X(i,j),Y(i,j),Z(i,j)) are the intersections of the wireframe grid lines. mesh(Z) draws a wireframe mesh using X = 1:n and Y = 1:m, where [m,n] = size(Z). The height, Z, is a singlevalued function defined over a rectangular grid. Color is proportional to surface height. mesh(...,C) draws a wireframe mesh with color determined by matrix C. MATLAB performs a linear transformation on the data in C to obtain colors from the current colormap. If X, Y, and Z are matrices, they must be the same size as C. >> x=8:8; y=8:8; [X, Y]=meshgrid(x,y); >> x=8:8; y=8:8; [X, Y]=meshgrid(x,y); >> Z=[X.^2/4^2Y.^2/5^2]; >> Z=[X.^2/4^2Y.^2/5^2]; >> mesh(X,Y,Z) >> mesh(x,y, Z)