【问题标题】:Hexagonal grid representing a cellular network as used in mobile communication systems表示移动通信系统中使用的蜂窝网络的六边形网格
【发布时间】:2015-03-13 20:07:43
【问题描述】:

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

我的问题是如何从方形网格变为六角网格(传输矩阵)?这是我目前所拥有的。

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

【问题讨论】:

    标签: matlab wireless telecommunication cellular-network hexagonal-tiles


    【解决方案1】:

    几年前,我为此编写了一些代码:

    %// 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
    

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

    【讨论】:

      猜你喜欢
      • 2021-05-15
      • 2022-01-14
      • 1970-01-01
      • 2021-05-17
      • 1970-01-01
      • 2021-08-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多