D=10;
U=10;
N=20;
Pni=0.1;%initial power(lambda)
noisee=(3.981*10^(-18)*10*10^(6))/20;
noiseb=(3.981*10^(-18)*10*10^(6))/20;
% as for each self interference factor, a cdf has to be plotted against user rate,we use different
% values of beta
beta=10^(-10); %self-interference factor at BS
%beta=10^(-7);
%beta=10^(-8);
%beta=10^(-8.5);
%beta=10^(-9);
load gain.mat;
load finalpower.mat;
%optimal power allocation strategy for the uplink users given the downlink subcarrier and power allocation
%1. calculating inter-user interference for uplink
for u=1:U
for d=1:D
for n=1:N
Interd(d,n)=Pun(u,n)*gud(u,d);
end
end
end
%2.getting the positions of each of the channels with the highest SNR
for n=1:N
T(n)= hdn(n)./(noisee + Interd(n));
end
n=find(T==max(T));
if length(n)>1
n=n(1); %taking one occurence at a time
end
%3.Calculating hdln for power allocation
for u=1:U
for d=1:D
for n=1:N
hdln(d,n)=(hdn(d,n)/(noisee + Interd(d,n)));
end
end
%hdln(u)=max(hdln(u,:));
end
for n=1:N
hdlnm(n)=max(hdln(:,n));
end
%downlink power allocation
for d=1:D
R(d)=abs((1/Pni)-(1/hdln(d)));
Pnf(d)=max(0,R(d));
end
%optimal power allocation strategy for the downlink users given the uplink power allocation
%1. calculating inter-user interference for uplink
for u=1:U-1
for d=u+1:U
for n=1:N
Interu(u,n)=Pdn(d,n)*hdn(d,n);
end
%T(d)= hdn(d)./(noisee + Inter(d));
end
end
%2. calculating the huln for uplink power allov=cation
for d=1:D
for u=1:U-1
for n=1:N
huln(u,n)=(hun(u,n)/(noisee + Interu(u,n) + Pn(n)*beta));
end
end
end
for n=1:N
hulnm(n)=max(huln(:,n));
end
%3.uplink power allocation
for d=1:D
for u=1:U-1
Pns(u)=Pni-R(d);%initial power given for downlink power allocation - downlink power
S(u)=abs((1/Pns(u))-(1/huln(u)));
Pnsf(u)=max(0,S(u));
end
end
%calcuating user rate for 1 uplink and 1 downlink channel
RUL(1)=log2(1 + Pnsf(u)*hulnm(1));
RDL(1)=log2(1 + Pnf(d)*hdlnm(1));
USERRATE(1)=RUL(1)+RDL(1);
%calcuating user rate for uplink and downlink channel
for n=2:N
RUL(n)=log2(1 + Pnsf(u)*hulnm(n));
RDL(n)=log2(1 + Pnf(d)*hdlnm(n));
USERRATE(n)=RUL(n)+RDL(n);
if ((USERRATE(n)/USERRATE(n-1))< 0.00001)
break
end
end
%calculating gain in spectral efficiency between two successive iterations
for n=2:N
avggain(n)=(USERRATE(n)/USERRATE(n-1));
end
%if you want to see the plots of uplink user rate (RUL) and downlink user
%rate (RDL),remove the commnets below and comment on cdfplot and then save
%the file and run it.
% plot(RUL,'-ob')
% hold on
% plot(RDL,'->r')
cdfplot(USERRATE);%(cdf vs sumrate)
% h1=cdfplot(USERRATE);
[h, stats] = cdfplot(USERRATE);
%hold on
M=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20];
%plot(M,avggain,'sb');
阿里matlab建模师
- 粉丝: 4613
- 资源: 2868
最新资源
- 此repo包含David Tedaldis ICRA14论文的matlab脚本,是一种鲁棒且易于实现的IMU校准方法.zip
- 此存储库包含MATLAB和Simulink文件,用于如何使用Simscape电气视频设计电机控制器.zip
- 此存储库包含MATLABSimulink源代码,以重现在《电力电子控制应用微控制器编程入门》一书中提出的实验.zip
- 此存储库包含一个基于正则表达式的MATLAB语言语法,供GitHub Linguist用于突出显示GitHub上的MA.zip
- 此存储库包含各种流行的路径规划算法的MATLAB代码,如势场可见性图RRT和RRT.zip
- 此存储库包含使用其射频信号用于无人机检测和识别的所有MATLAB和Python代码.zip
- 从第二版FORTRAN程序翻译过来的MATLAB程序我没有写这些程序,这些是来自Constantine A Balan.zip
- 此存储库包含用MATLABOctave编写的算法。在MATLAB环境中开发算法使您能够探索和改进想法,并使您能够测试和.zip
- Unity 实现四叉树加载逻辑工程源码
- 从GAN到Pixel2Pixel CycleGAN的生成对抗网络的MATLAB实现.zip
- 独立MATLAB实现的置换TFCE校正.zip
- 存储库用于使用MIMO软件定义无线电MSc项目的UE跟踪波束成形的模型和代码.zip
- 电子顺磁共振EPR波谱的MATLAB工具箱.zip
- 读写SEGY格式的文件使用MatlabOctave.zip
- 独立低秩矩阵分析的MATLAB脚本.zip
- 对球形麦克风阵列捕获的球形谐波信号进行声阵列处理的MATLAB例程集合.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页