% Wif4AdhVer2Tor
% Pot: Potential
% Rem: Remaining
% Set: Set
%PsTx = 1;
% Le rapport entre ces débit et la qualit? minimale
% Débit, Mbps : 1 : 2 : 5.5 : 11
% Gamma Min (dB) : 2 : 5 : 9.5 : 14
GamMindB = 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érence reçu 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érence -> 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
end
end
% 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);
matlab_无线局域网的ad hoc网络
版权申诉
158 浏览量
2022-06-18
23:37:36
上传
评论
收藏 8KB ZIP 举报
wouderw
- 粉丝: 272
- 资源: 2960
最新资源
- FreePic2Pdf-v5.01 图片批量转换pdf/双层pdf 书签提取/导入
- 基于区块链的信息追溯系统的设计与实现+详细文档+全部资料(高分毕业设计).zip
- IMG_0796.PNG
- Hyper+Lightning5+SDXL大模型比较推荐
- 基于matlab 模糊神经网络的预测算法-嘉陵江水质评价源代码+详细教程
- PHP8 PDO MYSQL示例
- 毕业设计 基于区块链以及人脸识别的NFT交易系统源码+详细文档+全部资料(高分项目).zip
- 基于matlab 小波神经网络的时间序列预测-短时交通流量预测源代码+详细教程
- 基于区块链以及人脸识别的NFT交易系统源码+详细文档+全部资料(高分项目).zip
- 基于matlab 思维进化算法优化BP神经网络-非线性函数拟合源代码+详细教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈