⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wif4adhver2tor.m

📁 假设在一个ad hoc网络中
💻 M
字号:
% Wif4AdhVer2Tor% Pot: Potential% Rem: Remaining% Set: Set%PsTx = 1;% Le rapport entre ces d閎it et la qualit? minimale% D閎it, Mbps           : 1 : 2 : 5.5 : 11% Gamma Min (dB)        : 2 : 5 : 9.5 : 14GamMindB = 2;GamMin = 10.^(GamMindB/10);AllMatr = ones(NoMsTor,NoMsTor)-eye(NoMsTor);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);        NoTxMs= length(TxSet);        PsRx=10.^((-100.46)/10);         % On somme tous les interferences pour le point         for ii=1:NoTxMs            PsRx=PsRx+GNuMatrTor(TxSet(ii),TxMs);        end        % S'il l'interf閞ence re鐄 est plus petit que IN (11e-11)        if PsRx<1.2e-10 %INthres            zVct= AllMatr(TxMs,:);                  zRxSet= find((zVct.*RemMsIndicVct)==1);            lgzRx= length(zRxSet);            while (lgzRx>0) %There is a RxMs for TxMs                  RxIndex= ceil(lgzRx*rand(1,1));                RxMs= zRxSet(RxIndex);                % On veut tester si le SIR est plus grande que gamma                % SIR = Interference / Somme de tous Interference                % Interf閞ence -> GNuMatr(RxMs,TxMs)                PsTx = GNuMatrTor(RxMs,TxMs);                PsRx=10.^((-100.46)/10);                 % On somme tous les interferences pour le point                 for ii=1:NoTxMs                   PsRx=PsRx+GNuMatrTor(TxSet(ii),RxMs);                end                SIR = PsTx/PsRx;                if SIR > GamMin                    LinkMatrTor(TxMs,RxMs)= 1;                    TxSet=[TxSet,TxMs];                    NoPotMs= 0;                    %RemMsSet= setdiff(RemMsSet,[TxMs]);                    %PotMsSet= setdiff(PotMsSet,[TxMs]);                    TxMsVct(TxMs)= RxMs;%only for records                    RxMsVct(RxMs)= TxMs;%only for records                    RemMsSet= setdiff(RemMsSet,[RxMs]);                    PotMsSet= setdiff(PotMsSet,[RxMs]);                    % RemMsSet= setdiff(RemMsSet,find(ItfMatr(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);                    NoPotMs= length(PotMsSet);                    lgzRx = 0;                else                    lgzRx = lgzRx-1;                    % Retirer le RxMs                     %zRxSet= setdiff(zRxSet,[RxMs]);                end            end                            PotMsSet= setdiff(PotMsSet,[TxMs]);            RemMsSet= setdiff(RemMsSet,[TxMs]);            NoRemMs= NoRemMs-1;            RemMsIndicVct= zeros(1, NoMsTor);            RemMsIndicVct(PotMsSet)= 1;            NoPotMs= length(PotMsSet);        else            RemMsSet= setdiff(RemMsSet,[TxMs]);            PotMsSet= setdiff(PotMsSet,[TxMs]);            NoRemMs= length(RemMsSet);            NoPotMs= length(PotMsSet);                     end    endend% Calculer le nombre emetteur pour les Ms dans (0,1000)TxSetCountDown = TxSet > 4*NoMs;TxSetCountUpp = TxSet < 5*NoMs;TxSetCount = TxSetCountUpp==TxSetCountDown;NoTx=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 + -