Code covered by the BSD License  

Highlights from
Capacity Maximization in Multiuser OFDMA system

image thumbnail

Capacity Maximization in Multiuser OFDMA system

by

 

The complete project of OFDMA system. It tries to maximize the network capacity.

WaterFilling(N,PtotA,ChA,B,N0)
function [Capacity PowerAllo] = WaterFilling(N,PtotA,ChA,B,N0)
%
% WaterFilling in Optimising the Capacity
%   [Capacity PowerAllo] = WaterFilling(N,Ptot,Ch,B,N0);
%   
%       N     : number of total subchannels
%       PtotA : the total power allocated to the selected channel Coeff
%       ChA   : Allocated channel Gains to the above Ptot
%       B     : the total bandwidth
%       N0    : one side noise spectral density
%
%       Capacity  : the capacity of the selected subchannels
%       PowerAllo : the amount of power allocated to the subchannels
%
%	  copyrighted by Hamid Mashhadi Ramezani
%==================
% a tipycal example
%==================
%     N     =   16;     % Number of subchannels
%     PtotA =    1;     % Total Power in Watt
%     B     =  1e6;     % Bandwidth
%     N0    = 1e-8;     % Noise 
% 
%     % Channel gain for users in different subchannels
%     ChA = [0.001,.9,.4,.001];
    
%===============
% Initialization
%===============
ChA = abs(ChA) + eps;
NA = length(ChA);     % the number of subchannels allocated to

H = ChA.^2/(B*N0/N);  % 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/N);
    PowerAlloT = (PtotA + sum(1./HT))/MP - 1./HT;
    PowerAllo(IndexP) = PowerAlloT;
end
PowerAllo = PowerAllo.';    

%PowerAllo = PtotA/N * ones(N,1);

Capacity  = 1/N * sum(log2(1+ PowerAllo.' .* H));

Contact us