導航:首頁 > 五金知識 > 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函數相關的資料

熱點內容
連接火車車廂的軸承是什麼 瀏覽:628
玻璃切機械價格是多少 瀏覽:566
下列裝置常用於實驗製取氣體 瀏覽:775
遼寧大型機電設備哪裡有 瀏覽:339
上古卷軸機械裝置 瀏覽:343
需要計量證的儀器有哪些 瀏覽:360
放大車駕駛室裡面的工具箱 瀏覽:26
傳動裝置的零件組成 瀏覽:318
最新佛愛我羊工具箱 瀏覽:854
08年款指南者如何調儀表盤中文 瀏覽:53
機械旋轉安全防護裝置 瀏覽:827
自動控制原理判斷校正裝置 瀏覽:836
自動封麻袋口的裝置 瀏覽:549
怎麼判斷是前軸承還是後軸 瀏覽:253
博世電動工具執行標准 瀏覽:300
廢水收集自動裝置 瀏覽:706
拆空調關了閥門為什麼會有氣 瀏覽:426
安徽奧普五金製品有限公司 瀏覽:886
恩平美時塑料五金製品 瀏覽:961
衛生間有哪些設備 瀏覽:653