MATLAB三维绘图

绘制三维图像
一、plot3函数

x=0:pi/50:10*pi;
sin=sin(x);
cos=cos(x);
plot3(sin,cos,x);
title(‘helix’),text(0,0,0,’origin’);
xlabel(‘sin(x)’),ylabel(‘cos(x)’),zlabel(‘x’)
这里写图片描述
二、mesh函数

x=0:0.15:2*pi;
y=0:0.15:2*pi;
z=sin(y’)*cos(x);
mesh(x,y,z)
title(‘三维网格图像’)
这里写图片描述
三、surf函数

x=0:0.15:2*pi;
y=0:0.15:2*pi;
z=sin(y’)*cos(x);
surf(x,y,z)
这里写图片描述
四、view视角函数

p=peaks;
subplot(2,2,1);
mesh(peaks,p);
view(-37.5,30);
subplot(2,2,2);
mesh(peaks,p);
view(-10,60);
这里写图片描述
五、contour3等高线绘图

[x,y,z]=peaks(30);
contour3(x,y,z,8);
contour3(x,y,z,26);
title(‘等高线’);
这里写图片描述

猜你喜欢

转载自blog.csdn.net/Azuresmh/article/details/82184827