symdist.m

来自「这是一个超宽带的源码」· M 代码 · 共 24 行

M
24
字号
% function sd = symdist(i,j,coord,area)%% Arguments:% i,j - node indices% coord - coordinates of nodes% area - size of torus (x,y)%% Returns:% sd - distance between nodes% % calculates distance between nodes <i> and <j> with coordinates from <coord>% assuming they are placed on a torus with dimensions <area>. % function sd = symdist(i,j,coord,area)sd = Inf;cd = [coord(j,:); coord(j,:) + [area(1),0]; coord(j,:) - [area(1),0]; ...		coord(j,:) + [0, area(2)]; coord(j,:) - [0, area(1)]];for k=1:5	sd = min(sd, sqrt((coord(i,1)-cd(k,1))^2 + (coord(i,2)-cd(k,2))^2));end	

⌨️ 快捷键说明

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