1 / 11

Matlab 制作 3 维模型

Matlab 制作 3 维模型. 仝鑫龙. 坐标控制. 函数的调用格式为: axis([xmin xmax ymin ymax zmin zmax]) axis equal 纵、横坐标轴采用等长刻度 axis square 产生正方形坐标系 ( 缺省为矩形 ) axis auto 使用缺省设置 axis off 取消坐标轴 axis on 显示坐标轴 grid on/off 命令控制是画还是不画网格线,不带参数的 grid 命令在两种状态之间进行切换。

ayita
Download Presentation

Matlab 制作 3 维模型

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Matlab 制作3维模型 仝鑫龙

  2. 坐标控制 • 函数的调用格式为: • axis([xmin xmax ymin ymax zmin zmax]) • axis equal 纵、横坐标轴采用等长刻度 • axis square 产生正方形坐标系(缺省为矩形) • axis auto 使用缺省设置 • axis off 取消坐标轴 • axis on 显示坐标轴 • grid on/off命令控制是画还是不画网格线,不带参数的grid命令在两种状态之间进行切换。 • box on/off命令控制是加还是不加边框线,不带参数的box命令在两种状态之间进行切换。

  3. 曲面的绘制 三维网线图——mesh mesh(z) z为n×m的矩阵,x与y坐标为元素的下标 [X,Y]=meshgrid(x,y)以x ,y 向量为基准,产生在x-y平面的各栅格点坐标值的矩阵 mesh(x,y,z,c) x,y,z分别为三维空间的坐标位置 c为各点的颜色矩阵 meshc(x,y,z)为立体网状图加等高线 meshz(x,y,z)为立体网状图加‘围裙’ Slide No. 3

  4. 曲面的绘制 x=-5:0.1:5; y=x; [X,Y]=meshgrid(x,y); Z=peaks(X,Y);mesh(X,Y,Z) figure meshz(X,Y,Z) Slide No. 4

  5. 曲面的绘制 三维曲面图—— surf surf(x,y,z,c) —绘制三维曲面图,x,y,z 为图形坐标向量 与三维网线图的区别: 网线图:线条有颜色,空挡是黑色的(无颜色) 曲面图:线条是黑色的,空挡有颜色(把线条之间的空挡填充颜色,沿z轴按每一网格变化) surfc(X,Y,Z) — 带等高线的曲面图 surfl(X,Y,Z) —— 被光照射带阴影的曲面图 surf(x+x’,y+y’,z+z’);//the center is (x’,y’,z’) Slide No. 5

  6. 曲面的绘制 Slide No. 6 [X,Y,Z]=peaks(30);surf(X,Y,Z)//多峰函数 figure surfc(X,Y,Z)

  7. 曲面的绘制 cylinder(r,n) — 三维柱面绘图函数 [x,y,z]=cylinder(30);subplot(1,2,1);surf(x,y,z); subplot(1,2,2);mesh(x,y,z);

  8. 曲面的绘制 cylinder(r,n) — 三维柱面绘图函数 r 为半径;n为柱面圆周等分数 绘制三维陀螺锥面 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 Slide No. 8

  9. 曲面的绘制 Sphere(n) n为球面等分数,缺省为20 绘制三维球面 [x,y,z]=sphere(30);surf(x,y,z); Slide No. 9

  10. Patch:Create one or more filled polygons patch(X,Y,Z,C) creates a patch in 3-D coordinates. If the coordinate data does not define closed polygons, patch closes the polygons. The data can define concave or intersecting polygons. However, if the edges of an individual patch face intersect themselves, the resulting face might be only partly filled. In that case, it is better to divide the face into smaller polygons.

  11. xdata = [2 2 0 2 5; • 2 8 2 4 5; • 8 8 2 4 8]; • ydata = [4 4 4 2 0; • 8 4 6 2 2; • 4 0 4 0 0]; • zdata = ones(3,5); • p = patch(xdata,ydata,zdata,'b')

More Related