create_rectangles.m

来自「The Finite Difference Time Domain Method」· M 代码 · 共 15 行

M
15
字号
disp('creating rectangles');

for ind = 1:number_of_rectangles
    % convert rectangle end coordinates to node indices 
    blx = round((rectangles(ind).min_x - fdtd_domain.min_x)/dx) + 1; 
    bly = round((rectangles(ind).min_y - fdtd_domain.min_y)/dy) + 1; 

    bux = round((rectangles(ind).max_x - fdtd_domain.min_x)/dx)+1; 
    buy = round((rectangles(ind).max_y - fdtd_domain.min_y)/dy)+1; 

    % assign material type of the rectangle to the cells
    material_2d_space (blx:bux-1, bly:buy-1) ...
        = rectangles(ind).material_type;
end

⌨️ 快捷键说明

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