cellex.m

来自「两个画蜂窝系统的程序。第一个画出六边形蜂窝图。以(0」· M 代码 · 共 19 行

M
19
字号
% =======================================================================
% Cellex program
% DESCRIPTION: This program draws cellular figure
%=======================================================================
clear all
n=6;                 %the number of ringes of the cell.
a=0:2*pi/n:2*pi;
y0=sin(a);x0=cos(a);
p=6;q=5;              %p is the number of cells in x-axis.
                      %q is the number of cells in y-axis.
for i=(-1*p):p
    for j=(-1*q):q
        x=x0+i*1.5;
        y=y0+(j+mod(i,2)/2)*sqrt(3);
        plot(x,y),hold on
    end
end
axis equal

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?