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

📄 waterfilling_alg.m

📁 Capacity of a MIMO channel with nt transmit antenna and nr recieve antenna is analyzed. The power in
💻 M
字号:
function [Capacity PowerAllo] = WaterFilling_alg(PtotA,ChA,B,N0);
%
% WaterFilling in Optimising the Capacity
%===============
% Initialization
%===============
ChA = ChA + eps;
NA = length(ChA);     % the number of subchannels allocated to

H = ChA.^2/(B*N0);  % the parameter relate to SNR in subchannels
% assign the power to subchannel
PowerAllo = (PtotA + sum(1./H))/NA - 1./H;
while(length(find(PowerAllo < 0 ))>0)
    IndexN = find(PowerAllo <= 0 );
    IndexP = find(PowerAllo > 0);
    MP = length(IndexP);
    PowerAllo(IndexN) = 0;
    ChAT = ChA(IndexP);
    HT = ChAT.^2/(B*N0);
    PowerAlloT = (PtotA + sum(1./HT))/MP - 1./HT;
    PowerAllo(IndexP) = PowerAlloT;
end
PowerAllo = PowerAllo.';    
Capacity  = sum(log2(1+ PowerAllo.' .* H));

⌨️ 快捷键说明

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