蜂窝小区同频干扰的Matlab仿真Word文档格式.docx
《蜂窝小区同频干扰的Matlab仿真Word文档格式.docx》由会员分享,可在线阅读,更多相关《蜂窝小区同频干扰的Matlab仿真Word文档格式.docx(19页珍藏版)》请在冰点文库上搜索。
DESCRIPTIONOFTHEEXPERIMENTS
1.Writeaprogramtocalculatethesignalinterferenceratio(SIR)intheforwardlink,andrepeatsitbyrandomlychangingthepositionoftheMS.Afteranumberofsimulations,usethesimulatedresultstodrawthehistogramoftheSIR(S=I).TrytoobtainhistogramswithdifferentpathlossexponentnandclustersizeN.Concludeyourresults.
Theco-channelinterferenceintheforwardlinkcanbecharacterizedinfigure1.AMSwillbeinterferedbytheco-channelbasestation.Inoursimulation,weconsiderthe18co-channelcell,including6cellsinthefirstloopand12cellsinthesecond,nomatterwhattheclustersizeNis.
Figure1forwardlinkco-channelinterference
(1)Firstly,weshouldrandomlychoosethepositionoftheMSinthecell.Sincethecellishexagonwhichishardtohandlewecutandpasteitintoasquare.Aswecanseeinfigure2,thecenterofthecoordinationisthecenterofthecell.ThesquarewechooseisABCD.WethenrandomlychooseapairofxandyasthecoordinateofMS.IfMSlocatesintriangle1wecutandpasteittotriangle3andifitlocatesintriangle2wemoveittotriangle4.
Weassumetherangeofthebasestationis0.1asradiusofclusteris1.FortheMSwholocatedwithinthisarea,wechangeitsdistancetobe0.1asitistooclosetothebasestaion.
Figure2randomlychoosethepositionofMSinacell
Matlabcode:
RandPOS.m
%*******************************************************************
%ThisfunctionistogettherandomlylactionoftheMSwithmtimes.
%zisam*1matrixwithcoodinatevaluex,y
%*******************************************************************function[z]=RandPOS(m)
%********getrandomvalueofx,ywithinasquare*****%x=1.5*rand(m,1)-1;
y=sqrt(3)*rand(m,1)-0.5*sqrt(3);
%********useforlooptocutthesquareintoahexagon*****%fork=1:
m
ifx(k)>
-1&
&
x(k)<
-0.5&
y(k)>
(1+x(k))*sqrt(3)x(k)=x(k)+1.5;
y(k)=y(k)-sqrt(3)/2;
elseifx(k)>
y(k)<
-(1+x(k))*sqrt(3)x(k)=x(k)+1.5;
y(k)=y(k)+sqrt(3)/2;
end
%********iftheMSistoonearlytothebasestation ******%ifsqrt(x(k)^2+y(k)^2)<
0.1
x(k)=0.1;
y(k)=0;
z=x+j*y;
.
(2)Secondly,weshouldcalculatethecoordinateofco-channelbasestation.AsweknowtheclustersizeNwecancalculatethe(i,j)pairbytheformula𝑁
=𝑖
2+𝑖
*𝑗
+𝑗
2
ClusterN.m
%*********************************************************
%Thisfunctionistofindi&
jcorrespondtoagivenN
%asN=i^2+j^2+ij
%iiandjjistheresultofi,j
%********************************************************function[ii,jj]=ClusterN(N)
%thelargestnumberofiandjissqrt(N)
fora=0:
sqrt(N)
forb=0:
ifa^2+b^2+a*b==Nii=a;
jj=b;
end;
%endifend;
%forjj
(3)TakingN=7asexample,wecancalculatethecoordinatebyreferringtofigure3.AccordingtothevalueofIjpairandanglesinthefigurewecangetthecoordinateofthefirst loop by the formula:
𝑗
×
𝑝
𝑖
+𝑗
𝑝
𝑗
𝑙
𝑜
𝑐
𝑎
𝑡
𝑛
(𝑘
)=3×
(𝑖
𝑒
6
3×
(𝑘
‒1)+𝑗
)),wherek=1,2….6.The
doublethecoordinateofthe
firstlooppoints
diagnoseofaparallelogram
secondloopcanbecalculatedbythefirstloop.Therearetwokindsofsecondloopco-channelbasestation.Onecanbecalculatedbydoublethecoordinateofthefirstlooppoints.Theothercanbedonebyaddingcoordinatesofadjacentfirstlooppointasitisthediagnoseofaparallelogram.Examplesofthosetwokindsofpoints,point1and2,canbefoundinfigure3
Figure3calculatecoordinateofco-channelbasestationbyIJpair
AdjCel.m
%**************************************************************************
%Thisfunctionistofindcellularscoordinatesx+jy
%(BaseStationsinthemiddle)foragivenN(soasi/j)
%CelLocisa18*1matrixwiththecoordinatesoftheco-interference
%cellofthefirsttwocycle.(6forthefirstcycleand12forthesecond)
%**************************************************************************function[CelLoc]=AdjCel(N)
%********CallClusterNfunctontogettheiandjvalue*******%[ii,jj]=ClusterN(N)
%********18locationsconsideringtwocycleofco-interferencecell*******%CelLoc=zeros(18,1)+j*zeros(18,1);
%********calculatethefirstco-interferencecell*******%CelLoc
(1)=sqrt(3)*(ii*exp(j*pi/6)+jj*exp(j*pi/6+j*pi/3));
%********theothercellsare60degreeshiftofthelastcell*******%fork=2:
6
CelLoc(k)=CelLoc(k-1)*(0.5+sqrt(3)/2*j);
end;
%********thesecond12co-interferencecellsarethevectoraddtionofthefirstcycle*******%
fori=1:
CelLoc(2*i+5)=CelLoc(i)+CelLoc(i);
CelLoc(2*i+6)=CelLoc(i)+CelLoc(i+1);
CelLoc(18)=CelLoc(6)+CelLoc
(1);
(4)NowwehavecoordinatesofMSandco-channelbasestation,sowecancalculateSIRby
(𝑑
𝑚
𝑠
)‒𝑛
𝑆
𝐼
𝑅
=18
∑
)‒𝑛
𝑑
theformula
𝑖
=1
𝑏
,where
𝑚
standsforthedistancefromMStothecenter
while
𝑑
𝑏
standsforthedistancefromtheco-channelbasestationtotheMS.We
simulatedit100000times.
%ForwardLink
clearallcloseall
N=input('
theclustersizeN='
);
n=input('
thepathlossexponentn='
)M=100000;
%thetimesofsimulation
%***callfunctiontogettherandomlylacationoftheuser***%MSPos=RandPOS(M);
%***callfunctiontogetthelacationof18co-interferencecells***%CelLoc=AdjCel(N);
%***dsisthe'
-n'
powerofthedistancebetweenMSandBaseStation***%ds=(abs(MSPos)).^-n;
%***calculatethe'
powerofthedistancebetweenMSandBaseStationoftheco-interferencecell***%
ditemp1=abs(MSPos*(ones(18,1))'
-ones(M,1)*CelLoc'
ditemp2=ditemp1.^-n;
%***addthedistanceofinteferencetogather.***%di=ditemp2*ones(18,1);
%***theSIR***%SIR=10*log(ds./di);
%EverageSIR=SIR*ones(1,M)/Mhist(SIR,[-20:
250])
title('
Histogram'
xlabel('
SIR(dB)'
ylabel('
numbersofMS'
(5)Rsults:
WewillsimulatetheSIRoftheco-interferenceoftheforwardinglinkwithdifferentclustersize‘N’andpathloseexponent‘n’andplaintthehistogramofeachcondition.Tomakeacomparison,wechosetwogroupofnandNas:
Whenn=3.6,weletN=1,3,4,7,12.WhenN=7,weletn=2,3,3.5,4.
IftherandomMSistoonearlytothebase
station,d<
𝑑
0ord=0,theSIRwillbetoohigh.
Sowhend<
0,weletd=𝑑
0toremovetheBS.
.0istherangeofthebasestation.
(𝑑
)‒𝑛
Figure5histogramofSIRwhileN=1,n=3.6
Figure6histogramofSIRwhileN=3,n=3.6
Figure7histogramofSIRwhileN=4,n=3.6
Figure8histogramofSIRwhileN=7,n=3.6
Figure9histogramofSIRwhileN=12,n=3.6
Figure10histogramofSIRwhileN=7,n=2
Figure11histogramofSIRwhileN=7,n=3
Figure12histogramofSIRwhileN=7,n=3.5
Figure13histogramofSIRwhileN=7,n=4
WecanseefromthehistogramthattheaverageSIRincreasewithNincrease.Sincethedistancebetweentheclusterandtheco-interferencecellislargerwhenNislarger,sotheco-interferenceissmaller.ForaconstantclustersizeN,theSIRislargerasthepathloseexponentbecomeslarger.Sincewhennischanging,theco-interferencepowerisreducedmuchmorethanthesignalpower.Eventhoughthesystemwilllosemorepower,theSIRisbecomeslarger.
2.WriteaprogramtocalculatetheSIRinthereverselink,andrepeatsitbyrandomlychangingthepositionsoftheMSs.(Notethattheinterferencesinthereverselinkaregeneratedbyco-channelMSsandisdifferentfromtheinterferenceintheforwardlink.)Afteranumberofsimulations,usethesimulatedresultstodrawthehistogramoftheSIR.TrytoobtainhistogramswithdifferentpathlossexponentnandclustersizeN.Concludeyourresults.
Theco-channelinterferenceinthereverselinkcanbecharacterizedin