Waterfilling algorithm

Power allocation for the maximization of sum rate in parallel Gaussian channels
1.9K Downloads
Updated 26 Jun 2010

View License

% the water-filling process
% x: a vector with each component representing noise power
% P: total power
%
% The returned vector p maximizes the total sum rate given by
% sum(log(1 + p./x)), subject to the power constraint sum(p)== P, p>=0.
%
% The return a vector p also minimizes
% norm(p+x)
% subject to the constraints
% sum(p)==P; p>=0
%
%
% The second output "level" is the water level
%
% Sample usage:
% Three parallel Gaussian channels with noise powers 1, 2 and 3.
% The total power is 2.
%
% >> waterfill([1 2 3],2)
% ans =
% 1.5000 0.5000 0
%
%
% Author: Kenneth Shum, 2010
%
% Reference:
% T. M. Cover and J. A. Thomas, "Elements of Information Theory", John Wiley & Sons, 2006

Cite As

Kenneth Shum (2024). Waterfilling algorithm (https://www.mathworks.com/matlabcentral/fileexchange/28022-waterfilling-algorithm), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0