⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tanlansuanfa.m

📁 可以运行的m4k20功率分配图
💻 M
字号:
clc
clear
BER=1.3e-3;
rate=60;
numbertotalsub=18;
sigma=rand(1,numbertotalsub);
%%%%初始化%%%%%%%%%
subcarrierallocate=zeros(1,numbertotalsub);
powerallocate=zeros(1,numbertotalsub);
bitallocation=zeros(1,numbertotalsub);
%%%第一次分配,增加一个比特,增加功率最少功率的子载波被选择%%%%%%%%%
%%%同时这个完成该子载波的功率加载,同时用户的速率需求降低1比特到19%%
%%假设使用QAM调制
%delta=+inf;
%numbersub=1;
for n=1:numbertotalsub
     bitallocation(n)=bitallocation(n)+1;
     powerallocate(n)=1/3*sigma(n)*erfcinv(BER/2)* erfcinv(BER/2)*(2^bitallocation(n)-1);
end
minpower=min(powerallocate);
minindex=find(powerallocate~=minpower);
bitallocation(1,minindex)=0;
powerallocate(1,minindex)=0;
rate=rate-1;

while rate>0
     rate;
    for n=1:numbertotalsub
     powerallocate(n)=1/3*sigma(n)*erfcinv(BER/2)* erfcinv(BER/2)*(2^bitallocation(n)-1);  
     bitallocation01(n)=bitallocation(n)+1;
     powerallocate01(n)=1/3*sigma(n)*erfcinv(BER/2)* erfcinv(BER/2)*(2^bitallocation01(n)-1);
     chazhi(n)=powerallocate01(n)-powerallocate(n);
    end
   minchazhi=min(chazhi);
   minindex=find(chazhi==minchazhi);
   bitallocation(minindex)=bitallocation(minindex)+1;
   powerallocate(minindex)=powerallocate(minindex)+minchazhi;
   rate=rate-1;
   minchazhi=0;
end
bitallocation

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -