如何在MATLAB中创建这样的图?

mod*_*ero 1 matlab plot matlab-figure

我试图在MATLAB中绘制不同蜂窝基站的范围,如下所示:

样本图

但我无法弄清楚该怎么做.

gno*_*ice 5

这是一个如何创建这样的图的示例.请注意,我通过使用均匀分布的伪随机数随机生成蜂窝基站的位置来创建绘图的样本数据:

%# Initializations:
minRange = 0;       %# Lower x and y range
maxRange = 3.5;     %# Upper x and y range
resolution = 1000;  %# The number of data points on the x and y axes
cellRange = linspace(minRange, maxRange, resolution);
[x, y] = meshgrid(cellRange);   %# Create grids of x and y coordinates
cellCoverage = zeros(size(x));  %# Initialize the image matrix to zero

%# Create the sample image data:
numBases = 200;
cellRadius = 0.75;
for iBase = 1:numBases
    point = rand(1,2).*(maxRange - minRange) + minRange;
    index = ((x - point(1)).^2 + (y - point(2)).^2) <= cellRadius^2;
    cellCoverage(index) = cellCoverage(index) + 1;
end

%# Create the plot:
imagesc(cellRange, cellRange, cellCoverage);  %# Scaled plot of image data
axis equal;  %# Make tick marks on each axis equal
set(gca, 'XLim', [minRange maxRange], ...  %# Set the x axis limit
         'YLim', [minRange maxRange], ...  %# Set the y axis limit
         'YDir', 'normal');                %# Flip the y axis direction
xlabel('X-distance (km)');  %# Add an x axis label
ylabel('Y-distance (km)');  %# Add a y axis label
colormap(jet);              %# Set the colormap
colorbar;                   %# Display the color bar
Run Code Online (Sandbox Code Playgroud)

这是由此产生的情节:

在此输入图像描述

另请注意,图像矩阵cellCoverage中的数据不包含噪声并且没有应用平滑,这就是为什么边缘看起来比帖子中的原始图像更清晰(我猜测它是从真实数据生成的,而不是"假"样本数据就像我在这里使用的那样)