最近在研究这个,其中算法不是很明白,求解答?clear;time_now=0;time_end=10;throughtoutput=0;systemband=20;%MHzbs_power=46;%dBmru_num=27;slot_num=20;subcarrier=48;r_cell=1;%kmsigma=8;unaccess_num=0;throughtoutput_center=zeros(1,10);throughtoutput_edge=zeros(1,10);total_throughtoutput=zeros(1,10);centerratio=0.1;edgebandratio=0.9yy=zeros(46,10);m=1;while centerratio<=1 time_now=0; total_output=0; center_output=0; edge_output=0; while time_now<time_end i=1; ru_center=0; ru_edge=0; while i<=ru_num*slot_num x = rand * sqrt(3.0)/2; y = (1-2*rand ); if y<(-1/sqrt(3)*x +1) && y>(-1/sqrt(3)*x) && x<(sqrt(3)/2) userposi = [x,y]; r_user=x^2+y^2; else continue; end% r_user =sqrt(rand(1,1));% user_angle = rand(1,1)*2*pi/3+pi/6;% userposi = [r_user*cos(user_angle),r_user*sin(user_angle)];% if r_user < (35/1000)% continue;% end% if user_angle>=pi/6 && user_angle
sqrt(3)/(2*cos(user_angle - pi/6))% continue;% elseif user_angle>=pi/3 && user_angle<2*pi/3 && r_user > sqrt(3)/(2*cos(user_angle - pi/2))% continue;% elseif user_angle>=2*pi/3 && user_angle<5*pi/6 && r_user > sqrt(3)/(2*cos(user_angle - 5*pi/6))% continue;% end if r_user<centerratio ru_center=ru_center+1; else ru_edge=ru_edge+3; end [baseinfo] = basest; bstranspower = bs_power -30-10*log10(27); %单位db interference=zeros(1,19);%db sigle_interference=0;%w total_interference=0;%w A = 13; noise = 9 - 174 + 10*log10(systemband/27*10^3)-30;%db noise = 10^(noise/10);%w if r_user<centerratio for cell=1:19 userposi_to_allbase=userposi-baseinfo(cell,; pl = dist(userposi_to_allbase(1),userposi_to_allbase(2)); interference(cell)=bstranspower+A-pl-shadow(sigma); if cell==1 continue; end sigle_interference=10^(interference(cell)/10); total_interference=total_interference+sigle_interference; end%end for else userposi_to_allbase=userposi; pl = dist(userposi_to_allbase(1),userposi_to_allbase(2)); interference(1)=bstranspower+A-pl-shadow(sigma); for cell=8:2:18 userposi_to_allbase=userposi-baseinfo(cell,; pl = dist(userposi_to_allbase(1),userposi_to_allbase(2)); interference(cell)=bstranspower+A-pl-shadow(sigma); sigle_interference=10^(interference(cell)/10); total_interference=total_interference+sigle_interference; end%end for end SINR=interference(1)-10*log10(noise+total_interference); if SINR <-3.14 rb_output=0; unaccess_num=unaccess_num+1; elseif SINR>=-3.14 &&SINR<-0.73 rb_output=48*2*(1/12)/5; %qpsk 1/12 kbps elseif SINR>=-0.73 &&SINR<2.09 rb_output=48*2*(1/6)/5; %qpsk 1/6 kbps elseif SINR>=2.09 &&SINR<4.75 rb_output=48*2*(1/3)/5; %qpsk 1/3 kbps elseif SINR>=4.75 &&SINR<7.86 rb_output=48*2*(1/2)/5; %qpsk 1/2 kbps elseif SINR>=7.86 &&SINR<9.94 rb_output=48*2*(2/3)/5; %qpsk 2/3 kbps elseif SINR>=9.94 &&SINR<13.45 rb_output=48*4*(1/2)/5; %16qam 1/2 kbps elseif SINR>=13.45 &&SINR<18.6 rb_output=48*4*(2/3)/5; %16qam 2/3 kbps elseif SINR>=18.6 && SINR<24.58 rb_output=48*6*(2/3)/5; %64qam 2/3 kbps elseif SINR>=24.58 rb_output=48*6*(5/6)/5; %64qam 5/6 kbps end% total_output=total_output+rb_output*3/1000; if r_user<centerratio if ru_center<=((1-edgebandratio)*ru_num*slot_num) center_output=center_output+rb_output*3/1000; %3 sector thoughtoutput, Mbps else center_output=center_output+0; end else if ru_edge<=(edgebandratio*ru_num*slot_num) edge_output=edge_output+rb_output*3/1000; else edge_output=edge_output+0; end end ma = 0; for x= -30:2:60 ma=ma+1; if SINR<=x yy(ma,m) = yy(ma,m)+1; end count(ma)=x; end i=i+1; end%end while time_now=time_now+1; end%end while ru_center throughtoutput_center(m)=center_output/time_end; throughtoutput_edge(m)=edge_output/time_end; total_throughtoutput(m)=throughtoutput_center(m)+throughtoutput_edge(m); for ma=1:46 yy(ma,m)=yy(ma,m)/(ru_num*slot_num*time_end); end centerratio=centerratio+0.1; m=m+1;end%end while centerratiocoverage=1-unaccess_num/270/time_end;throughtoutput_centerthroughtoutput_edgetotal_throughtoutput |
|
|
|
|
共 1 个关于本帖的回复 最后回复于 2015-1-14 13:26