联系QQ:

2181264433

新闻资讯
联系我们
联系:张女士
微信:扫一扫右侧二维码
QQ :2181264433
邮箱:2181264433@qq.com
地址:浙江省-嘉兴市-南湖区
网址:www.mhslogic.com
您当前位置:首页 > 国内资讯 > 正文国内资讯
MATLAB代做|FPGA代做|simulink代做——终端直通技术,cellular用户同D2D用户间的资源分配
添加时间:2020-4-14 来源:本站整理
%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%c�û������ز�����������ظɱ�getBest()���� 
%��Ҫ������location.m�ļ������� 
%************************************************************ 
P_c=20;           % �����û����书�� W 
P_d=0.25;           % D2D�û����书�� W(24dBmW) 10^(24/10)          
totalNum_RB=100;       %�ܵ�RB���� 
N_sub=12;              %ÿ��RB�����ز��ĸ��� 
Num_c=36;                %�����û��ĸ��� 
Num_d=4;                 %D2D�û��ĸ�����ռ���û�����10% 
Weff=0.57;             %��һ������ 
N0=10^(-60/10)*10^(-3) ;           %��������:-60dBmW =1e(-9) 
I=0;                 %С������Ź��� 
hb=30;%��վ�߶�(m) 
fc=2e9;%��Ƶ(hz) 
Am=10;  %20dB 
Kcd=1;                  %��׼������ 
Kdd=0.001; 
alpha=3;                  %·����IJ��� 
SINR_c_tgt = 10^(-10/10);    %���������ֵ-10dB=0.1 
SINR_d_tgt = 10^(-10/10);    %���������ֵ-10dB=0.1 
%SINR_min= 10^(-10/10); 
SINR_max= 10^(25/10);    %25dB=316.2 
bs = [-250,450;        %7��С���Ļ�վ���� 
    250,450; 
    -500,0; 
    0,0; 
    500,0; 
   -250,-450; 
   250,-450 
    ]; 
%bianchang = 250*2/(sqrt(3)); 
ds=13; 
rate=zeros(1,10); 
yinying2=normrnd(0,6,Num_c,100);%��Ӱ˥�� 
reili2=log10(raylrnd(0.7071,Num_c,100)); %����˥�� 
 
for count=1:10 
%ÿ�Σ�UE���ٶ�5Km/h�ƶ�����ÿ�ζ�Ҫ����ȷ��c,d�û���λ�� 
[d,theta,xn,yn] = dotm2(Num_c,ds,xn,yn);                                      
[dd_B1,theta2,xdn1,ydn1] = dotm2(Num_d,ds,xdn1,ydn1); 
[dd_B2,theta3,xdn2,ydn2] = dotm2(Num_d,ds,xdn2,ydn2); 
 
%-----------------------��C�û����վ������GBc------------------------- 
%reili2=log10(raylrnd(0.7071,Num_c,100)); %����˥�� 
%PL=40*(1-4*10^(-3)*hb).*log10(d/1000)-18*log10(hb)+21*log10(fc)+80; 
PL=40*(1-4*10^(-3)*hb).*log10(d/1000)+128.5; 
for i=1:100 
    PL2(:,i) = PL'; 
end 
Adb=-min((theta./65).^2,Am);%�������� 
GBc_1=10.^(-1.*(PL-Adb)./10);       
GBc=10.^(-1.*(PL2+yinying2+reili2)./10); 
 
%--------------------------��GBd(1*4)------------------------------- 
dd_B=(dd_B1+dd_B2)/2; 
%PL_d=40*(1-4*10^(-3)*hb).*log10(dd_B/1000)-18*log10(hb)+21*log10(fc)+80; 
PL_d=40*(1-4*10^(-3)*hb).*log10(dd_B/1000)+128.5; 
GBd=10.^(-1.*(PL_d)./10); 
%------------------��D�û�֮����û�����Gdd(1*4)---------------------- 
 
for i=1:Num_d 
    %app=abs(xnd1(1,j)-xnd2(1,j)); 
    temp_d=sqrt(abs(xdn1(1,i)-xdn2(1,i))^2+(abs(ydn1(1,i)-ydn2(1,i)))^2); 
    dd(1,i)=temp_d; 
end 
Gdd=Kdd.*dd.^(-alpha); 
%------------------------��Gcd(4*36)--------------------------------- 
for n=1:Num_d 
    for m=1:Num_c 
        temp_cd=sqrt(abs(xdn1(1,n)-xn(1,m))^2+(abs(ydn1(1,n)-yn(1,m)))^2); 
        cd(n,m)=temp_cd; 
    end 
end 
Gcd=Kcd.*cd.^(-alpha); 
 
%-----------------------��xcd--------------------------------- 
[TF, NumPerUser, B, Index] = getBest(GBc);%������ظɱȷ������ز� 
c = 1; 
D=1:Num_d; 
xcd=zeros(Num_d,Num_c); 
SINR_c=zeros(1,Num_c); 
SINR_d=zeros(1,Num_d); 
while ( ~isempty(D) && c<Num_c+1) 
    B(c);  % ������c�������ŵ����� 
    Index(c);  % �����������c���û�c,,,,far��Gcd��ֵ 
    [far,index] =min(Gcd(:,Index(c)));%index��ָ����Index(c)��Զ���û�d 
    temp_SINR_c=(P_c*GBc_1(Index(c)))/(N0+I+P_d*far); 
    SINR_c(1,c)=temp_SINR_c; 
    if ( ismember(index,D) ) 
        temp_SINR_d=(P_d*Gdd(index))/(N0+I+P_c*GBd(index)); 
        SINR_d(1,index)=temp_SINR_d; 
        if( (temp_SINR_c>SINR_c_tgt)&&(temp_SINR_d>SINR_d_tgt)) 
            xcd(index,Index(c))=1; 
            D = setdiff(D, index); 
        end 
    end 
    c=c+1; 
end 
if isempty(D) 
    while c<Num_c+1 
        B(c);  % ������c�������ŵ����� 
        Index(c);  % �����������c���û�c,,,,far��Gcd��ֵ 
        temp_SINR_c=(P_c*GBc_1(Index(c)))/(N0+I); 
        SINR_c(1,c)=temp_SINR_c; 
        temp_SINR_d=(P_d*Gdd(index))/(N0+I); 
        SINR_d(1,c)=temp_SINR_d; 
        c=c+1; 
    end 
end 
%%--------------------���һ��������---------------------------     
mc=sum(TF'); 
rate_c=zeros(1,Num_c); 
rate_d=zeros(1,Num_d); 
sum_rate=0; 
%SINR_cc=zeros(1,36); 
%SINR_dd=zeros(1,36); 
for i=1:Num_c 
    %SINR_cc(1,i)=(P_c*GBc_1(Index(c)))/(N0+I+P_d*far);    
    if (SINR_c(1,i)>SINR_max) 
        temp_rate_c=4.7; 
    end 
    if(SINR_c(1,i)<SINR_max) 
        temp_rate_c=Weff*log(SINR_c(1,i)+1); 
    end 
    rate_c(1,i)=temp_rate_c; 
    sum_rate = sum_rate+mc(1,i)*temp_rate_c; 
end 
for i=1:Num_d 
    if (SINR_d(1,i)>SINR_max) 
        temp_rate_d=4.7; 
    end 
    if(SINR_d(1,i)<SINR_max) 
        temp_rate_d=Weff*log(SINR_d(1,i)+1); 
    end 
    for j=1:Num_c 
        if (xcd(i,j)==1) 
            rate_d(1,i)=temp_rate_d; 
            sum_rate = sum_rate+mc(1,j)*temp_rate_d; 
        end 
    end 
end 
rate(1,count)=sum_rate; 
end 
 
rate; 
x=10:10:100; 
y=rate./max(rate); 
figure;  
fig1 = plot(x,y); 
xlabel('Times'); 
ylabel('Normalized throughput');  
title('AAA'); 
axis([10,100,0.1,1]); 
grid on;

扫一扫,关注我们