使用plot函数绘制正弦曲线。x轴:x=0:pi/10:2*pi;设置x轴为0到2pi的范围,y:y=sin(x),绘图:plot(x,y);
使用xlabel,ylabel,legend等对图形即兴进一步的解释处理。>> xlabel('x轴')>> ylabel('y轴')>> legend('y=sin(x)')>> title('正弦曲线图')
plot3 Plot lines and points in 3-D space.plot3() is a three-dimensional analogue of PLOT().plot3(x,y,z), where x, y and z are three vectors of the same length,plots a line in 3-space through the points whose coordinates are theelements of x, y and z.plot3(X,Y,Z), where X, Y and Z are three matrices of the same size,plots several lines obtained from the columns of X, Y and Z.Various line types, plot symbols and colors may be obtained withplot3(X,Y,Z,s) where s is a 1, 2 or 3 character string made fromthe characters listed under the PLOT command.plot3(x1,y1,z1,s1,x2,y2,z2,s2,x3,y3,z3,s3,...) combines the plotsdefined by the (x,y,z,s) fourtuples, where the x's, y's and z's arevectors or matrices and the s's are strings.
plot3示例:t=0:pi/50:6*pi;plot3(t.*sin(3*t),t.*cos(3*t),t)grid
三维网格图:mesh;[X,Y] = mesh