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