Matlab绘图基础——散点生成三角网(TIN)


%例一:二维三角网TIN模型的生成
X=rand(10,2)*5;
dt=DelaunayTri(X(:,1),X(:,2));        %生成三角网
triplot(dt);hold  on ;                  %绘图
scatter(X(:,1),X(:,2), 'o' ),hold  off    %将结点展示出来(散点)
 
%例二:三维TIN的生成(由规则点生成)
[x,y]=meshgrid(1:15,1:15);z=peaks(15);
tri=delaunay(x,y);    %以X,Y为准生成Delaunay triangulation(三角网)
trisurf(tri,x,y,z);   %将该三角网显示出来
colormap  autumn ;      %方法一
%If the surface is in the form of a TriRep 
%triangulation representation, plot it as follows:
%tr=TriRep(tri,x(:),y(:),z(:));trisurf(tr);  %方法二
%plot3(x(:)', y(:)', z(:)')
%例三:离散点生成TIN三角网模型
A=rand(300,2)*20-10;X=A(:,1);Y=A(:,2); %X,Y的区间为[10,10]
R=sqrt(X.^2 + Y.^2);Z=sin(R)./R;       %函数,计算对应点坐标的函数值
tri=delaunay(X,Y);trisurf(tri,X,Y,Z);  %以X,Y为准生成Delaunay triangulation(三角网)
colormap  jet ;hold  on
scatter3(X(:),Y(:),Z(:), 'r' );hold  off %将散点展示出来
 

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM