实验五matlab三维图形绘制实验

上传人:灯火****19 文档编号:139179733 上传时间:2020-07-20 格式:DOC 页数:4 大小:45.50KB
返回 下载 相关 举报
实验五matlab三维图形绘制实验_第1页
第1页 / 共4页
实验五matlab三维图形绘制实验_第2页
第2页 / 共4页
实验五matlab三维图形绘制实验_第3页
第3页 / 共4页
实验五matlab三维图形绘制实验_第4页
第4页 / 共4页
亲,该文档总共4页,全部预览完了,如果喜欢就下载吧!
资源描述

《实验五matlab三维图形绘制实验》由会员分享,可在线阅读,更多相关《实验五matlab三维图形绘制实验(4页珍藏版)》请在金锄头文库上搜索。

1、软件学院 MATLAB软件应用 课程实验报告实验五 三维图形绘制一、实验目的1掌握通用绘图函数的使用2掌握基本三维图形绘制3熟悉可视化图形绘制的基本技巧二、实验内容1通用绘图函数的使用2. 三维图形绘制三、实验环境1.工具软件:MATLAB2015b 四、实验步骤1. 通用绘图函数的使用(1) plot3函数-三维曲线图形绘制函数t = 0:pi/50:10*pi;plot3(sin(t),cos(t),t)xlabel(sin(t)ylabel(cos(t)zlabel(t)grid onaxis square(2)plot3函数的操作2 t = 0:pi/50:2*pi; x=sin(t)

2、 sin(t); y=cos(t) cos(t);z= sin(t).2+cos(t).2 sin(t).2+cos(t).2+1;plot3(x,y,z)(3)mesh函数三维网格曲面 x = -4:0.1:4; y=x m=ones(size(y)*x; n=y*ones(size(x); p=sqrt(m.2+n.2)+eps; z=sin(p)./p; mesh(z)(4)mesh函数的操作2 x = -4:0.1:4;x,y=meshgrid(x);p=sqrt(x.2+y.2)+eps;z=sin(p)./p;mesh(z);xlabel(x-axis),ylabel(y-axis

3、),zlabel(z-axis);title(mesh)(5)surf函数三维曲面x=0:0.1:2*pi;x,y=meshgrid(x);z=sin(y).*cos(x); surf(x,y,z);xlabel(x-axis),ylabel(y-axis),zlabel(z-axis);title(surf);(6)比较surf函数、mesh函数及plot3函数x=0:0.1:2*pi;x,y=meshgrid(x);z=sin(y).*cos(x);分别使用mesh(x,y,z)、surf(x,y,z)、plot3(x,y,z),比较得到的图形异同2. 三维图形绘制(1)改进的三维绘图函数

4、x,y=meshgrid(-8:0.5:8);z=sin(sqrt(x.2+y.2)./sqrt(x.2+y.2+eps);% p=sqrt(x.2+y.2)+eps;z=sin(p)./p;subplot(2,2,1);meshc(x,y,z);title(meshc(x,y,z)%等高线subplot(2,2,2);meshz(x,y,z);title(meshz(x,y,z)%边界面subplot(2,2,3);surfc(x,y,z) %等高线title(surfc(x,y,z) subplot(2,2,4);surfl(x,y,z)title(surfl(x,y,z)%光照面(2)

5、标准三维曲面球面sphere函数 x,y,z=sphere(20); surf(x,y,z)三维柱面cylinder函数x,y,z=cylinder(0:0.2:4,20);surf(x,y,z)%圆锥 t=0:pi/25:2*pi; R=sin(t); cylinder(R,20)(3)条形图、填充图、阶梯图和杆图形式的曲面绘制使用bar3、stem3、pie3和fill3函数1)绘制魔方阵的三维条形图。2)以三维杆图形式绘制曲线y=2sin(x)。3)已知x= 1300,1800,2000,3025,绘制三维饼图。4)用随机的顶点坐标值画出五个黄色三角形。subplot(2,2,1);ba

6、r3(magic(4);subplot(2,2,2);y=2*sin(-pi:pi/8:2*pi);stem3(y);subplot(2,2,3);pie3(1300,1800,2000,3025);subplot(2,2,4);fill3(rand(3,5),rand(3,5),rand(3,5), y )(4)三维图形的精细处理从不同视点绘制多峰函数曲面 subplot(2,2,1);mesh(peaks); view(-37.5,30); %指定子图1的视点 title(azimuth=-37.5,elevation=30) subplot(2,2,2);mesh(peaks); vie

7、w(0,90); %指定子图2的视点 title(azimuth=0,elevation=90) subplot(2,2,3);mesh(peaks); view(90,0); %指定子图3的视点 title(azimuth=90,elevation=0) subplot(2,2,4);mesh(peaks); view(-7,-10); %指定子图4的视点 title(azimuth=-7,elevation=-10)(5)色彩处理colormap(m)函数和shading函数 z=peaks(20);colormap(copper); subplot(2,2,1);surf(z); subplot(2,2,2); surf(z);shading flat; subplot(2,2,3);surf(z);shading interp;subplot(2,2,4);surf(z);shading faceted;五、分析与思考1、plot3、mesh、surf函数的适用情况,试举例说明2、绘制一个带有灯光、照明效果的球体三维图形(自定义灯光、照明、大小等参数)六、实验总结

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号