📄 wif0adhmaintor.m
字号:
% Wif0AdhMainTor
% Version #0.51 - date 28/06/05 - (c) ? Godlewski
% This program may NOT be used outside ENTS
% Ce programme ne peut pas etre utilis? hors de l'ENST
%Reprendre les memes bases que Wif0AdhMain, mais avec les effets de bord (en ajoutant les m恗es cartes autour de l'initiale)
% Need for subsequent scripts or functions
% Wif3Adh
% PathGaindBVsDstSq() (function computing "path gain" or equivalently, path loss
% Wif2AdhMapPlot2
% Tri1ToVect
% VectToTri1
%==========
%-Naming and Acronyms:
% ---------
% G: Gain
% Lg: Length
% Nu: Natural unit
% Ppg: Propagation (previously: Prpg)
% Shdw: Shadowing
% Sigm: Sigma
%==========
%clear;
%ConfigFlag= input('Congiguration index? (e.g.,=1) =');
ConfigFlag= 1; %For working and testing (if no config 1 is selected)
if ConfigFlag==1,
%
NoMs= 80;
TriLg= NoMs*(NoMs-1)/2;
MapSideX= 1000;
MapSideY= 1000;
MapArea= MapSideX*MapSideY;
Marg= 0;
%==========
PpgModelIndex=11; %used in fuction PathGaindBVsDstSq
SigmShdw= 3; %Standart deviation of shadowing (e.g. 3 dB)
%Not Usefull part
%Wifi Propag Model #12 (PpgModeleIndex=12); "SqCas" or squared case
%BrkPtDstSq= 8*8;% BrkPtDst=8
%kk1dB=-58.3 + 33*log10(8);
%kk2dB=-32.45-20*log10(2.4514);
%AA1SqCas=33/2;AA2SqCas=10;%AA=Alpha*10 where Alpha="Exp. propag. fact."
%EndOf Wifi Propag Model #11
%EndOfNot Usefull part
%==========
elseif ConfigFlag==2,
'Part not in use - TwoSlopePpgInit'
else
'Information missing #0.1'
end
%- Radio parameters
TxLvDBm= 20 ; % 20 dBmW = 100 mW = 1 W
SsitivdBm = -80 ;% dBm
SsThrhdBm= SsitivdBm - 7; %Other value: SsitivdBm - 10
% SIRdB= 2;
% Remark
% dintf/R = (1+ 10^( SIRdB/(10*Alpha)); DeltadB= 10*Alpha*log10((1+ 10^( SIRdB/(10*Alpha)))
%-- Exemple of MatLab Script
% SIRdB=[2,5,9,14];Alpha=3.3;DsOvR=(1+ 10.^(SIRdB/(10*Alpha))), DeltadB=10*Alpha*log10(DsOvR)
%--- Result of the script
% DsOvR = 2.1498 2.4175 2.8738 3.6561 % distance x 2.14 ...
% DeltadB = 10.9688 12.6509 15.1292 18.5795
%-- EndOf Result of the script
%- EndOf Radio parameters
%- Ms location and distance matrix computation
MsPos= ceil(MapSideX*rand(NoMs,2));
% Pour cr閑r le torrus
MsPosTemp = MsPos-MapSideY;
NoMsTor = NoMs*9;
MsPosTor = zeros(NoMs*9,2);
ii =1;
for mm=0:2
for nn=0:2
for iMs=1:NoMs
MsPosTor(ii,1) = MsPosTemp(iMs,1)+(mm*MapSideX);
MsPosTor(ii,2) = MsPosTemp(iMs,2)+(nn*MapSideX);
ii=ii+1;
end
end
end
% TriLg Tor
TriLgTor= NoMsTor*(NoMsTor-1)/2;
%- Room for arrays Tor
CnxMatrTor = zeros(NoMsTor,NoMsTor);
ItfMatrTor = zeros(NoMsTor,NoMsTor);
Dst2MatrTor= zeros(NoMsTor,NoMsTor);
Dst2VctTor = zeros(1,TriLgTor); % reshaped and compacted of Dst2Matr
GdBMatrTor = zeros(NoMsTor,NoMsTor);
GdBVctTor = zeros(1,TriLgTor); % reshaped and compacted of GdBMatr
%- EndOf Room for arrays
for iMs=1:NoMsTor-1,
for jMs=(iMs+1):NoMsTor
DifPos= MsPosTor(iMs,:)-MsPosTor(jMs,:);
Dst2MatrTor(iMs,jMs)= DifPos*DifPos';
%Dst2MatrTor(iMs,jMs)= PosTor(iMs,jMs,MsPos);
end
end
Dst2VctTor = Tri1ToVect(Dst2MatrTor);
Dst2MatrTor= Dst2MatrTor + Dst2MatrTor';
%- EndOf Ms location and distance matrix computation
GdBVctTor = PathGaindBVsDstSq(Dst2VctTor,PpgModelIndex)+ SigmShdw*randn(1,TriLgTor);
GdBMatrTor= VectToTri1(GdBVctTor,NoMsTor);
GdBMatrTor= GdBMatrTor + GdBMatrTor';
GNuMatrTor= 10.^(GdBMatrTor/10);
ItfMatrTor= TxLvDBm+GdBMatrTor>SsThrhdBm;
CnxMatrTor= TxLvDBm+GdBMatrTor>SsitivdBm;% {0,1} matrix
ItfMatrTor= ItfMatrTor-eye(NoMsTor);
CnxMatrTor= CnxMatrTor-eye(NoMsTor);
InitFlag=1;
FigIndx=1;
%clf(FigIndx)
Wif2AdhMapPlot2Tor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -