三维特殊图形
三维线性图 三维线性图的书写格式为 三维条形图 三维条形图的书写格式为 三维散点图 三维网格图 三维表面图 简易表面图 柱形立体图 实例演练 >> t=0:pi/50:10*pi; >> x=0.1*exp(t/20).*cos(2*t); >> y=0.1*exp(t/20).*sin(2*t); >> plot3(x,y,t),grid on>> year=[1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001]; >> GDP=[17.4 19.58 23.94 31.38 43.8 57.73 67.79 74.77 79.55 82.05 89.4 95.93]; >> consu=[3.1 3.4 10.7 19.6 24.8 16.5 8.3 2.8 -0.8 -1.4 0.4 0.7]; >> colormap(spring) >> bar3(year,GDP,0.3) >> figure >> colormap([0 1 1]) >> bar3(year,consu,0.3)
clear for n=0:0.5:15 r=5+5*n; theta=0:pi/12:2*pi; x=r*cos(theta); y=r*sin(theta); z=50*ones(size(x))*n-2*n.^2; c(1)=0;c(2)=0;c(3)=0; scatter3(x,y,z,3,c,'filled') hold on end axis=[-80,80,-80,80,0,320]
>> [X,Y]=meshgrid(-3:0.2:2); >> Z=exp(-X.^2-Y.^2).*sin(X).^2; >> mesh(X,Y,Z) >> title('Z=exp(-X.^2-Y.^2).*sin(X).^2,的网格图'); >> xlabel('X'); >> ylabel('Y'); >> zlabel('Z'); >> clear axis >> axis([-3,3,-3,3,0,0.3]) >> max(max(Z)) ans = 0.2713
>> A=pascal(9); >> surf(A) >> title('pascal(9)'); >> xlabel('X'); ylabel('Y'); zlabel('Z');
>> [X,Y]=meshgrid(0:0.25:10); >> Z=exp(-(0.15*X).^2-(0.15*Y).^2).*sin(X).*sin(Y); >> surfc(X,Y,Z) >> title('Z=exp(-(0.15*X).^2-(0.15*Y).^2).*sin(X).*sin(Y)的表面图') >> xlabel('X'); ylabel('Y'); zlabel('Z');
>> ezsurf('x*exp(-x^2-y^2)',[-3,3],[-3,3]);grid on
>> syms r theta >> x=r*cos(theta); >> y=r*sin(theta); >> z=r^2; >> ezsurf(x,y,z)
>> zeta=-pi/2:pi/12:pi/2; >> r=0.5+cos(zeta); >> r=[0.5,r,0.5]; >> [x,y,z]=cylinder(r,12); >> surf(x,y,z),grid on
>> theta=-pi/2:pi/12:0; >> v=1+3*cos(theta); >> v1=0.5:0.1:1; >> V=[v1,v]; >> [x,y,z]=cylinder(V,120); >> surf(x,y,z),grid on >> title('漏斗'); >> xlabel('X'); ylabel('Y'); zlabel('Z');