下个mpt工具箱
里面的mpt_voronoi可以实现你的要求
MPT_VORONOIComputesthevoronoidiagramviampLP
[Pn]=mpt_voronoi(points,Options)
---------------------------------------------------------------------------
DESCRIPTION
---------------------------------------------------------------------------
Thevoronoidiagramisapartitionofthestatespace;Foragivensetof
pointspj,eachregionPn(j)isdefinedas
Pn(j)={x\inR^n|d(x,pj)<=d(x,pi),\foralli\neqj}
---------------------------------------------------------------------------
INPUT
---------------------------------------------------------------------------
points-Optionalinput:
Matrixptimesnxofpoints:nxisstatespacedimensionand
pisthenumberofpoints
Theentryisgraphicalin2Difnoparametersarepassed.
Options.pbound-A"boundingpolytope".Ifprovided,thevoronoicellswill
beboundedbythispolytope.Ifnotprovided,thecellswill
beboundedbyahypercubeasbigas1.5xthemaximum
coordinateofanyoftheseedpoints
Options.plot-Ifsetto1,plotsthevoronoidiagram(0isdefault)
Options.sortcells-Ifsetto1,resultingVoronoipartitionwillbeordered
inawaysuchthatPn(i)correspondstoseedpointi.
(Defaultis1)