上机习题6MATLAB70三维绘图讲解.docx
- 文档编号:14489282
- 上传时间:2023-06-23
- 格式:DOCX
- 页数:15
- 大小:1.31MB
上机习题6MATLAB70三维绘图讲解.docx
《上机习题6MATLAB70三维绘图讲解.docx》由会员分享,可在线阅读,更多相关《上机习题6MATLAB70三维绘图讲解.docx(15页珍藏版)》请在冰点文库上搜索。
上机习题6MATLAB70三维绘图讲解
实验六MATLAB7.0三维绘图
实验目的:
①掌握绘制三维图能形的方法;
②掌握图形修饰处理方法;
③知道图像处理方法,了解动画制作方法。
实验要求:
给出程序和实验结果。
实验内容:
一、绘制三维曲线
t=0:
pi/100:
20*pi;
x=sin(t);
y=cos(t);
z=t.*sin(t).*cos(t);
plot3(x,y,z);
title('Linein3-DSpace');
xlabel('X');ylabel('Y');zlabel('Z');
gridon;
二、绘制三维曲面图z=sin(x+sin(y))-x/10。
[x,y]=meshgrid(0:
0.25:
4*pi);
z=sin(x+sin(y))-x/10;
mesh(x,y,z);
axis([04*pi04*pi-2.51]);
三、绘制z=x2+y2的三维网线图形;
x,y]=meshgrid(0:
0.25:
4*pi);
z=x.^2+y.^2;
mesh(x,y,z)
四、绘制三维陀螺锥面;
(仅供参考:
t1=0:
0.1:
0.9;
t2=1:
0.1:
2;
r=[t1-t2+2];
[x,y,z]=cylinder(r,30);
surf(x,y,z);
grid
)
t1=0:
0.1:
0.9;
t2=1:
0.1:
2;
r=[t1-t2+2];
[x,y,z]=cylinder(r,30);
surf(x,y,z);
grid
五、在xy平面内选择区域[-8,8]×[-8,8],利用mesh、meshc、meshz和surf绘制
。
要求用子图在一个图形窗口中绘制。
[x,y]=meshgrid(-8:
0.5:
8);
z=sin(sqrt(x.^2+y.^2))./sqrt(x.^2+y.^2+eps);
subplot(2,2,1);
mesh(x,y,z);
title('mesh(x,y,z)')
subplot(2,2,2);
meshc(x,y,z);
title('meshc(x,y,z)')
subplot(2,2,3);
meshz(x,y,z)
title('meshz(x,y,z)')
subplot(2,2,4);
surf(x,y,z);
title('surf(x,y,z)')
六、绘制光照处理后的球面,取三个不同的光照位置进行比较。
(提示:
可以利用函数sphere和light)
[x,y,z]=sphere(20);
subplot(1,2,1);
surf(x,y,z);axisequal;
light('Posi',[0,1,1]);
shadinginterp;
holdon;
plot3(0,1,1,'p');text(0,1,1,'light');
subplot(1,2,2);
surf(x,y,z);axisequal;
light('Posi',[1,0,1]);
shadinginterp;
holdon;
plot3(1,0,1,'p');text(1,0,1,'light');
七、利用peaks产生数据,绘制多峰曲面图。
[X,Y,Z]=peaks(27);
subplot(1,2,1);
mesh(Z)
subplot(1,2,2);
surf(Z)
八.
,当x和y的取值范围均为-2到2时,用建立子窗口的方法在同一个图形窗口中绘制出三维线图、网线图、表面图和带渲染效果的表面图。
[x,y]=meshgrid([-2:
0.2:
2]);
z=x.*exp(-x.^2-y.^2);
mesh(x,y,z)
subplot(2,2,1)
plot3(x,y,z)
title('plot3(x,y,z)')
subplot(2,2,2)
mesh(x,y,z)
title('mesh(x,y,z)')
subplot(2,2,3)
surf(x,y,z)
title('surf(x,y,z)')
subplot(2,2,4)
surf(x,y,z)
shadinginterp
title('surf(x,y,z),shadinginterp')
九绘制peaks函数的表面图,用colormap函数改变预置的色图,观察色彩的分布情况。
surf(peaks(30))
colormap(hot)
colormap(cool)
colormap(lines)
十、用sphere函数产生球表面坐标,绘制不透明网线图、透明网线图、表面图和带剪孔的表面图。
[x,y,z]=sphere(30);
mesh(x,y,z)
[x,y,z]=sphere(30);
mesh(x,y,z)
hiddenoff
surf(x,y,z)
z(18:
30,1:
5)=NaN*ones(13,5);
surf(x,y,z)
十一、将5.9题中的带剪孔的球形表面图的坐标改变为正方形,以使球面看起来是圆的而不是椭圆的,然后关闭坐标轴的显示。
axissquare
axisoff
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 上机习题6 MATLAB70三维绘图讲解 上机 习题 MATLAB70 三维 绘图 讲解