📄 chow_algo.m
字号:
function[bits_alloc,energy_alloc] = chow_algo(SNR,num_subc,M);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 应用Chow算法实现特别的比特和能量分配
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i = 1:num_subc
% 假设每个子信道都是平坦衰落信道
% 初始化每个子信道的比特数
tempbits = log2(1+abs(SNR(i)));
roundtempbits = round(tempbits); %取整
% 将比特数限制在2~15之间
if(roundtempbits>8)
roundtempbits = 8;
end
if(mod(roundtempbits,2)==1&roundtempbits~=1)
rountempbits = roundtempbits-1;
end
% 计算每个子信道的功率
if(roundtempbits>0)
energy_alloc(i) = (2^roundtempbits-1)/SNR(i);
else
energy_alloc(i) = 0;
end
% 更新每个子信道的比特率
bits_alloc(i) = roundtempbits;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -