matlab - 代表移动通信系统中使用的蜂窝网络的六角形网格

标签 matlab wireless telecommunication cellular-network hexagonal-tiles

我对 Matlab 比较陌生,我想生成一个六边形网格来表示蜂窝网络,其中每个六边形都有特定的行为。

我的问题是如何从正方形网格到六边形网格(转移矩阵)?这是我目前所拥有的。

[X,Y] = meshgrid(0:60);
figure(1), plot(X,Y,'b')
hold on, plot(Y,X,'b')
axis square

最佳答案

几年前我写了一些代码来做到这一点:

%// Define input data:
close all
clear all
M_max = 14; %// number of cells in vertical direction
N_max = 10; %// number of cells in horizontal direction
trans = 1;  %// hexagon orientation (0 or 1)

%// Do the plotting:
hold on
for m = -M_max:M_max
    for n = -N_max:N_max
        center = [.5 sqrt(3)/2] + m*[0 -sqrt(3)] + n*[3/2 sqrt(3)/2];
        if ~trans
            plot([center(1)-1 center(1)],[center(2) center(2)])
            plot([center(1) center(1)+1/2],[center(2) center(2)+sqrt(3)/2])
            plot([center(1) center(1)+1/2],[center(2) center(2)-sqrt(3)/2])
        else %// exchange the two arguments to `plot`
            plot([center(2) center(2)],[center(1)-1 center(1)])
            plot([center(2) center(2)+sqrt(3)/2],[center(1) center(1)+1/2])
            plot([center(2) center(2)-sqrt(3)/2],[center(1) center(1)+1/2])
        end %if
    end %for
end %for
plot([-15 15],[0 0],'-.') %// adjust length manually
plot([-15 15],[-15*sqrt(3) 15*sqrt(3)],'-.') %// adjust length manually
axis image
set(gca,'xtick',[])
set(gca,'ytick',[])
axis([-10 10 -13.3 13.3]) %// adjust axis size manually
set(gca,'Visible','off') %// handy for printing the image

例如,这是使用上述数据生成的图像:

enter image description here

关于matlab - 代表移动通信系统中使用的蜂窝网络的六角形网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27963305/

相关文章:

iphone - 将 iPhone 连接到 XBee 模块

Java ArrayList Contains()方法不起作用

android - 如何显示应用程序 UI 以接受和拒绝视频通话并防止与其他正在进行的应用程序发生冲突?

signal-processing - RaptorQ 开源实现

python - 根据另一个引用数组从一个数组中选择接近的匹配项

matlab只删除顶部和右侧的刻度线,并留下盒子

c - 使用 pcap 处理来自 802.11 帧的错误 mac 地址

R 版的 scatter3(matlab)

java.lang.OutOfMemoryError : Java heap space when using this short program to Remove title bar 错误

hadoop - 我们可以将MapReduce用于分析之外的其他逻辑吗?