导航:首页 > 五金知识 > mpt工具箱voronio函数

mpt工具箱voronio函数

发布时间:2022-07-03 08:13:25

1. 求voronoi用法,希望能给出例子和公式中各量的含义

额,我搜到一个大家看看吧
MATLAB帮助文档里的VORONOI函数吧
k=20;
x=rand(k,1);
y=rand(k,1);
z=rand(k,1);
figure('Color','w')
plot3(x,y,z,'Marker','.','MarkerEdgeColor','r','MarkerSize',10, 'LineStyle', 'none')
xlabel('X');
ylabel('Y');
zlabel('Z');
axis([0 1.5 0 1.5 0 1.5])
axis vis3d
X=[x y z];
[V,C]=voronoin(X);
V;
for k=1:20
disp(C{k})
end
for k=1:length(C)
if all(C{k}~=1)
VertCell = V(C{k},:);
KVert = convhulln(VertCell);
patch('Vertices',VertCell,'Faces',KVert,'FaceColor','g','FaceAlpha',0.5)
end
end

2. 用matlab画有边界的voronoi图,怎么画

估计你是刚刚加载吧,提示说MATLAB找不到路径,我当初加载神经网络的时候,和你的处境一样,我关了MATLAB,吃完饭一用,神奇的好了。望采纳。

3. voronoi算法

不知道你要三维的还是二维的,先给你个在MATLAB中生成三维voronoi图的,二维的你就自己查MATLAB帮助文档里的VORONOI函数吧
k=20;
x=rand(k,1);
y=rand(k,1);
z=rand(k,1);
figure('Color','w')
plot3(x,y,z,'Marker','.','MarkerEdgeColor','r','MarkerSize',10, 'LineStyle', 'none')
xlabel('X');
ylabel('Y');
zlabel('Z');
axis([0 1.5 0 1.5 0 1.5])
axis vis3d
X=[x y z];
[V,C]=voronoin(X);
V;
for k=1:20
disp(C{k})
end
for k=1:length(C)
if all(C{k}~=1)
VertCell = V(C{k},:);
KVert = convhulln(VertCell);
patch('Vertices',VertCell,'Faces',KVert,'FaceColor','g','FaceAlpha',0.5)
end
end

4. 用matlab mpt工具箱生成受限的voronoi图。请问该怎么得到各个顶点坐标呢(包括voronoi边与边界的交点)

extreme这个函数就可以得到顶点坐标。
给你个代码:
function irPoly = getIrreg(m,s)
%GETIRREGULAR Summary of this function goes here
% get irregular pixels
% the same begin & end
% clockwise order
% m - regular size
% S - low/high resolution

% get limit voronoi
x = gallery('uniformdata', [(m*s)^2 1], 0);
y = gallery('uniformdata', [(m*s)^2 1], 1);
vOut = [0,0; 0,m; m,m; m,0];
P = polytope(vOut);
Options.pbound = P;
% Options.plot = 1;
Pn = mpt_voronoi(m*[x,y],Options);

% split each polygon
for iPoly = 1:length(Pn)
thisPoly = extreme(Pn(iPoly));
% limited in [0,m]
thisPoly(thisPoly>m) = m;
thisPoly(thisPoly<0) = 0;
% make points in order
k = convhull(thisPoly(:,1), thisPoly(:,2));
% make clockwise
[pX,pY] = poly2cw(thisPoly(k,1),thisPoly(k,2));
irPoly{iPoly} = [pX,pY];
end%for iPoly

end%function

5. matlab中如何给voronoi加个边界

代码如下
A=[100*rand(10,2)rand(10,1)];
pbound=polytope([000;15000;1501500;01500;001;15001;1501501;01501]);
Options.pbound=pbound;
Options.plot=1;
mpt_voronoi(A,Options);

6. 如何将MATLAB中的voronoi图导入到cad中,已获得顶点信息,但不知顶点如何连接的信息。

extreme这个函数就可以得到顶点坐标。
给你个代码:
function irPoly = getIrreg(m,s)
%GETIRREGULAR Summary of this function goes here
% get irregular pixels
% the same begin & end
% clockwise order
% m - regular size
% S - low/high resolution

% get limit voronoi
x = gallery('uniformdata', [(m*s)^2 1], 0);
y = gallery('uniformdata', [(m*s)^2 1], 1);
vOut = [0,0; 0,m; m,m; m,0];
P = polytope(vOut);
Options.pbound = P;
% Options.plot = 1;
Pn = mpt_voronoi(m*[x,y],Options);

% split each polygon
for iPoly = 1:length(Pn)
thisPoly = extreme(Pn(iPoly));
% limited in [0,m]
thisPoly(thisPoly>m) = m;
thisPoly(thisPoly<0) = 0;
% make points in order
k = convhull(thisPoly(:,1), thisPoly(:,2));
% make clockwise
[pX,pY] = poly2cw(thisPoly(k,1),thisPoly(k,2));
irPoly{iPoly} = [pX,pY];
end%for iPoly

end%function

7. matlab中 voronoi函数能否得到一个点周围voronoi边的顶点的坐标,其顺序与给定点的坐标的顺序是怎样的

用voronoin
例子

x=[0 -.5 1 1 -1];
y=[0 -1 -.5 1 1];
voronoi(x,y);axis([-2 2 -2 2])
[v,c]=voronoin([x;y]')
%v就是所有的voronoi边的顶点坐标,c{i}就是第i个点周围的voronoi边的顶点下标
%比如说第1个点(0,0)周围的voronoi边的顶点就是横坐标:v(c{1},1),纵坐标:v(c{1},2)
%对于坐标为(inf,inf)的点就是无穷远点,应该不难理解。
for n=1:4
disp(['点(' num2str(x(n)) ',' num2str(y(n)) ')周围的voronoi边的顶点的坐标是:'])
disp([v(c{n},1),v(c{n},2)])
end

8. 请帮我看一下下面的matlab代码,关于voronoi图的。希望能逐句解释一下。

figure(2)%建立第二张图片
[vx,vy]=voronoi(X,Y);%使用voronoi函数
plot(X,Y,'r*',vx,vy,'b-');%X,Y的二维点使用红色*表示,vx,vy使用蓝色-表示;
hold on;%保持图像
voronoi(X,Y);%使用voronoi函数
axis([0 xm 0 ym]);%设置图像X轴的区间为0到XM,Y轴区间为0到Ym
title('Voronoi')%给图像命名为Voronoi

9. matlab中生成voronoi图时,能否设定一个边界使得voronoi顶点不出现无穷远点

下个mpt工具箱
里面的_voronoi可以实现你的要求

MPT_VORONOI Computes the voronoi diagram via mpLP

[Pn]=mpt_voronoi(points,Options)

---------------------------------------------------------------------------
DESCRIPTION
---------------------------------------------------------------------------
The voronoi diagram is a partition of the state space; For a given set of
points pj, each region Pn(j) is defined as
Pn(j)={x \in R^n | d(x,pj)<=d(x,pi), \forall i \neq j}

---------------------------------------------------------------------------
INPUT
---------------------------------------------------------------------------
points - Optional input:
Matrix p times nx of points: nx is state space dimension and
p is the number of points
The entry is graphical in 2D if no parameters are passed.
Options.pbound - A "bounding polytope". If provided, the voronoi cells will
be bounded by this polytope. If not provided, the cells will
be bounded by a hypercube as big as 1.5x the maximum
coordinate of any of the seed points
Options.plot - If set to 1, plots the voronoi diagram (0 is default)
Options.sortcells - If set to 1, resulting Voronoi partition will be ordered
in a way such that Pn(i) corresponds to seed point i.
(Default is 1)

阅读全文

与mpt工具箱voronio函数相关的资料

热点内容
停车后仪表台前方闪光是什么 浏览:982
制纸机械多少钱一台 浏览:777
双列圆柱滚子轴承怎么拆 浏览:146
微机保护装置采样保持插件的作用 浏览:356
仪表盘皮损坏如何修复 浏览:511
消防水池阀门在什么位置 浏览:528
排气阀门气泵 浏览:573
液压管道上的阀门属于阀门还是材料 浏览:822
连接火车车厢的轴承是什么 浏览:628
玻璃切机械价格是多少 浏览:566
下列装置常用于实验制取气体 浏览:775
辽宁大型机电设备哪里有 浏览:339
上古卷轴机械装置 浏览:343
需要计量证的仪器有哪些 浏览:360
放大车驾驶室里面的工具箱 浏览:26
传动装置的零件组成 浏览:318
最新佛爱我羊工具箱 浏览:854
08年款指南者如何调仪表盘中文 浏览:53
机械旋转安全防护装置 浏览:827
自动控制原理判断校正装置 浏览:836