ch5 - 可视化2010a(3)

2019-02-16 13:00

5.2.4

【例5.2-9】

获取二维图形数据的指令ginput

clf

x=0:0.01:1; y=(x+2).^x-2; plot(x,y); grid on

10.80.60.40.20-0.2-0.4-0.6-0.8-100.10.20.30.40.50.60.70.80.91

图5.2-9 经多次试探后画出的图形 图5.2-10 局部放大图

[x,y]=ginput(1); format long x,y x =

0.69828692903537 y =

-5.884401711382421e-010

11

5.3

5.3.1

三维曲线和曲面

三维线图指令plot3

【例5.3-1】

t=(0:0.02:2)*pi;

x=sin(t);y=cos(t);z=cos(2*t); plot3(x,y,z,'b-',x,y,z,'bd') view([-82,58]),box on

xlabel('x'),ylabel('y'),zlabel('z') legend('链','宝石','Location','best') 链宝石110.50.50-0.5-11 0.50y-0.5-1-0.5x-10z图 5.3-1 宝石项链

5.3.2

【例5.3-2】

三维曲面/网线图

clf

x=-4:4;y=x; [X,Y]=meshgrid(x,y); Z=X.^2+Y.^2; surf(X,Y,Z); colormap(hot) hold on

stem3(X,Y,Z,'bo') hold off

xlabel('x'),ylabel('y'),zlabel('z') axis([-5,5,-5,5,0,inf]) view([-84,21])

12

302520z15105050y图 5.3-2 曲面图和格点 -5-5x50

5.3.3

【例5.3-3】

曲面/网线图的精细修饰

clf x=-4:4;y=x;

[X,Y]=meshgrid(x,y); Z=X.^2+Y.^2; surf(X,Y,Z) colormap(jet)

subplot(1,3,1),surf(Z),axis off

subplot(1,3,2),surf(Z),axis off,shading flat subplot(1,3,3),surf(Z),axis off,shading interp set(gcf,'Color','w')

图 5.3-4 三种浓淡处理方式faceted/flat/interp的效果比较

【例5.3-4】

clf

surf(peaks) shading interp

alpha(0.5) colormap(summer)

13

图 5.3-5 半透明薄膜

【例5.3-5】

clf;

[X,Y,Z]=sphere(40); colormap(jet) subplot(1,2,1),surf(X,Y,Z),axis equal off,shading interp light ('position',[0 -10 1.5],'style','infinite') lighting phong material shiny subplot(1,2,2),surf(X,Y,Z,-Z),axis equal off,shading flat light;lighting flat light('position',[-1,-1,-2],'color','y') light('position',[-1,0.5,1],'style','local','color','w') set(gcf,'Color','w')

图 5.3-6 灯光、照明、材质指令所表现的图形

5.3.4 透视、镂空和裁切

14

【例5.3-6】

[X0,Y0,Z0]=sphere(30); X=2*X0;Y=2*Y0;Z=2*Z0; surf(X0,Y0,Z0); shading interp hold on,mesh(X,Y,Z),colormap(hot) hold off

hidden off axis equal,axis off

图5.3-7 剔透玲珑球

【例5.3-7】

P=peaks(30); P(18:20,9:15)=NaN; surfc(P); colormap(hot)

light('position',[50,-10,5]) material([0.9,0.9,0.6,15,0.4]) grid off,box on

15


ch5 - 可视化2010a(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:安装-420轨道下山防跑车挡车装置安全技术措施

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: