www.pudn.com > space-timecodingBrankaVuceticJinhongYuan.rar > averg_allo.m, change:2006-11-30,size:445b


function [Capacity PowerAllo] = averg_allo(PtotA,ChA,B,N0,M); 
% 
% 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/M ; 
PowerAllo = PowerAllo.';     
Capacity  = sum(log2(1+ PowerAllo.' .* H));