📄 wif3adhtor.m
字号:
% Wif3Adh
% Version #0.3 - date 28/06/05 - (c) ? Godlewski
% Pot: Potential
% Rem: Remaining
% Set: Set
LinkMatrTor= zeros(NoMsTor,NoMsTor);
TxMsVct= zeros(1,NoMsTor);
RxMsVct= zeros(1,NoMsTor);
TxSet= zeros(1,NoMsTor);
TxSet= [];
RemMsSet= 1:NoMsTor;
NoRemMs= NoMsTor;
RemMsIndicVct= ones(1,NoMsTor);
while NoRemMs>1,
%intersect
PotMsSet= RemMsSet;
NoPotMs= NoRemMs;
while NoPotMs>1,
TxIndex= ceil(NoPotMs*rand(1,1));
TxMs= PotMsSet(TxIndex);
zVct= CnxMatrTor(TxMs,:);
zRxSet= find((zVct.*RemMsIndicVct)==1);
lgzRx= length(zRxSet);
if lgzRx>0 %There is a Rx Ms for TxMs
RxIndex= ceil(lgzRx*rand(1,1));
RxMs= zRxSet(RxIndex);
TxMsVct(TxMs)= RxMs;%only for records
RxMsVct(RxMs)= TxMs;%only for records
LinkMatrTor(TxMs,RxMs)= 1;
TxSet=[TxSet,TxMs];
NoPotMs= 0;
RemMsSet= setdiff(RemMsSet,find(ItfMatrTor(TxMs,:)==1));
% Remark Viciny of TxMs are eliminated byt not RxMs ones
RemMsSet= setdiff(RemMsSet,TxMs);
RemMsIndicVct= zeros(1, NoMsTor);
RemMsIndicVct(RemMsSet)=1;
NoRemMs= length(RemMsSet);
else %There is no Rx Ms for TxMs
PotMsSet= setdiff(PotMsSet,[TxMs]);
RemMsSet= setdiff(RemMsSet,[TxMs]);
NoRemMs= NoRemMs-1;
RemMsIndicVct= zeros(1, NoMsTor);
RemMsIndicVct(PotMsSet)= 1;
NoPotMs= length(PotMsSet);
end
end
end
% Calculer le nombre emetteur pour les Ms dans (0,1000)
%TxSetCountDown = TxSet > 4*NoMs;
%TxSetCountUpp = TxSet < 5*NoMs;
%TxSetCount = TxSetCountUpp==TxSetCountDown;
%sum(TxSetCount)
%clf(FigIndx)
FigIndx=1;
figure(FigIndx)
hold on
[LinkX, LinkY]= gplot(LinkMatrTor,MsPosTor);
axis([-Marg MapSideX+2*Marg -Marg MapSideY+2*Marg ])
h21 = plot(LinkX, LinkY,'g-');
TxMsSet= find(TxMsVct>0);
set(h21,'EraseMode','background','LineWidth',3); %edge Link
Wif2AdhMapPlot2Tor
hold off
figure(FigIndx)
hold on
h22 = plot(MsPos1Tor(TxMsSet,1),MsPos1Tor(TxMsSet,2),'r.');%Tx Node, Ms small disk
set(h22,'EraseMode','background','MarkerSize',15);%Node, Ms small disk size
hold off
%SNIR derivation
% NoTxMs= length(TxSet);
% Sinr= zeros(1,NoTxMs);
% if NoTxMs>1;
% RxIndSet= find(RxMsVct>0);
% TxIndSet= find(TxMsVct>0);
% RxTotItfVct= ones(1,NoTxMs)*GNuMatr(TxIndSet,RxIndSet);
% for ii= 1:NoTxMs
% RxMs=RxIndSet(ii);
% Sg= GNuMatr(RxMsVct(RxMs),RxMs);
% Sinr(ii)= Sg/(RxTotItfVct(ii)-Sg);
% end
% end
% SinrdB= 10*log10(Sinr);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -