资源简介
此程序用来在MATLAB中创建泰森多边形,并且在产生随机中心点的同时,各中心点必须满足特定的距离关系,最后输出中心点坐标以及相应的顶点坐标,以在ABAQUS中建模。
代码片段和文件信息
clear
x=[];
x1=unifrnd(0300);
y1=unifrnd(0300);
x(1:)=[x1y1];
OF=1;
CF=1;
while(OF<50)
x11=unifrnd(0300);
y11=unifrnd(0300);
for i=1:size(x1)
distance=sqrt((x11-x(i1))^2+(y11-x(i2))^2);
if distance<30
CF=2;
end
end
if CF==1
x(size(x1)+11)=x11;
x(size(x1)2)=y11;
OF=OF+1;
end
CF=1;
end
Options.plot=1;
A=[00;0300;300300;3000];
P=polytope(A);
Options.pbound=P;
mpt_voronoi(xOptions);
[vc]=voronoin(x);
for n=1:50
disp([‘点(‘ num2str(x(n1)) ‘‘ num2str(x(n2)) ‘)周围的voronoi边的顶点的坐标是:‘])
disp([v(c{n}1)v(c{n}2)])
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 687 2015-09-14 15:46 voronoi.m
文件 14980 2015-09-14 15:34 voronoi.mat
----------- --------- ---------- ----- ----
15667 2
- 上一篇:PCS
- 下一篇:MeanShift 均值漂移算法的MATLAB代码
评论
共有 条评论