如何创建一个带有重叠圆圈的图,其中重叠区域根据重叠的圆圈数量进行颜色编码?
clear;
noOfNodes = 200;
x = rand(1,1000 )*1000;
y = rand(1,1000 )*1000;
R = 8;
netXloc = x;
netYloc = y;
grid on
set(gca, 'GridLineStyle', '-');
grid(gca,'minor')
hold on
scatter ( x, y, 'R.');
axis square
hold on
axis ( [ 0.0, 1000.0, 0.0, 1000.0 ] )
title ( 'WSN coverage' );
hold off
for i = 1:1000
ctr = [x(i) y(i)]-R;
diameter = 2*R;
h = rectangle('Position',[ctr,diameter,diameter],'FaceColor',[0.5 0.5 0.5],'Curvature',[1,1],'LineWidth',.5,'LineStyle','-');
alpha .6;
end;