|
hi,
i need someone to explain me these following matlab code
thanks.
function [NodeFlowMetric,MinHopMetric]=FlowCreate(NodeInfo,InterFlowNo,ExterFlowNo)
global NodeAmount; %????
global TransDistance; %???????
NodeFlowMetric=zeros(NodeAmount,(InterFlowNo+ExterFlowNo));
MinHopMetric=zeros(1,(InterFlowNo+ExterFlowNo));
NodeInfo=sortrows(NodeInfo,-4);
for i=1:InterFlowNo
Source=ceil(NodeAmount*rand);
while Source<3
Source=ceil(NodeAmount*rand);
end
Destination=ceil(NodeAmount*rand);
while Destination<3 || Destination==Source
Destination=ceil(NodeAmount*rand);
end
SourceNode=NodeInfo(Source,1);
DestinationNode=NodeInfo(Destination,1);
NodeFlowMetric(SourceNode,i)=-1;
NodeFlowMetric(DestinationNode,i)=1;
SDDistance=((NodeInfo(Source,2)-NodeInfo(Destination,2))^2+(NodeInfo(Source,3)-NodeInfo(Destination,3))^2)^0.5;
MinHop=ceil(SDDistance/TransDistance)+1;
MinHopMetric(1,i)=MinHop;
end
|