oldmakeh.m

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

M
46
字号
% % H = makeH(coord, [L, a])%% Parameter:% coord  - coordinate of nodes% L      - a routing matrix L(N,2) where for each link <i>, L(i,1) contains %          the index of the source node and L(i,2) is the index of the destination node. %          Default L is each node talks to itself (hence H(i,j) is fading between nodes i and j).% a      - fading coefficient (a < -2)%% Returns:% H(i,j) - fading between source of link i and destination of link j.%function H = makeH(coord,L,a)if nargin < 3	L = [];endif nargin < 4   a = -4;end    N = size(coord,1);if L == []	L = [(1:N)', (1:N)'];endl = size(L,1);H = zeros(l);for ii=1:l	for jj=1:l		i = L(ii,1);		j = L(jj,2);		if i ~= j      	H(ii,jj) = sqrt((coord(i,1)-coord(j,1))^2 + (coord(i,2)-coord(j,2))^2)^a;		else			% Now we forbid this in scheduling and			% in order to avoid numerical error, we put 0			H(ii,jj) = 0;		end	endend

⌨️ 快捷键说明

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