当前位置:文档之家› 泰森多边形算法

泰森多边形算法

%%%% -----PPP作图----- %%%%
%%%% Part1 %%%%
Lambda = 20; % Lambda:poisson(Lambda)
v = exp(-Lambda) %判定条件
u = unifrnd(0,1)
N = 0;
while u >= exp(-Lambda)
u = u*unifrnd(0,1);
N=N+1;
end
N %取点个数
poissrnd(Lambda,1,N)
% % POISSON点的分布图
% x = 0:N;
% y = poisspdf(x,Lambda);
% plot(x,y,'+')

%%%% Part2 %%%%
a = 0;c = 0;b = 100;d =100;%取[0,100]*[0,100]的布点区域;
M = N;
% A = [];
% B = [];
while N > 0 %%scatter in the [0,100]*[0,100]
N = N-1;
u1 = unifrnd(0,1);
A(M-N) = (b-a)*u1;
u2 = unifrnd(0,1);
B(M-N) = (d-c)*u2;
figure(1) %%base stations 分布图
plot(A(M-N),B(M-N),'rP');
hold on;
end
%Voronio作图
figure(2) %poisson-voronio图
[Vx,Vy] = voronoi(A,B);
h = plot(Vx,Vy,'-',A,B,'rP');
set(h(1:end-1),'xliminclude','off','yliminclude','off')
% plot(Vx,Vy,'-',A,B,'.');
% set(h(1:end-1),'xliminclude','off','yliminclude','off')
figure(3) %%%可以用于基站的叠加
voronoi(A,B);
hold on;






相关主题
文本预览
相关文档 最新文档