function [shanonCapacity powerAllocated] = ofdmwaterfilling(...
nSubChannel,totalPower,channelStateInformation,bandwidth,noiseDensity);
%
%==========================================================================
% by:
% Hamid Ramezani
% my email : hamid.ramezani@gamil.com
%
% Date:
% 20 OCT 2006 , version 1
%
%
% to maximize the capacity of a frequency selective channel, the
% waterfilling algorithm is used. OFDM modulation devides the total
% bandwidth into N subchannels. Large number of subchannels cause each
% subchannel experience a flat fading channel if the proper cyclic prefix
% is added to the end of each OFDM symbol. The waterfilling algorithm
% assigns more power to subchannels which experience good condition and may
% assign no power to bad conditioned subchannels (subchannels withdeep fading).
%
% for further information see:
% J. A. C. Bingham, �Multicarrier Modulation for Data Transmission:
% an Idea whose Time Has Come,� IEEE Communications Magazine, vol. 28,
% no. 5, pp. 5-14, May 1990
%
% =========================================================================
% Parameter definition
% =========================================================================
%
% nSubChannel : Number of subchannels (4,16,32,...,2^N)
% totalPower : Total available power for each OFDM symbol
% (p watt)
% channelStateInformation : Channel state information 1_by_nSubChannel
% matrix "random('rayleigh',1,1,nSubChannel)"
% bandwidth : Total available bandwidth (in Hz)
% noiseDensity : one sided noise spectral dencity (watt/Hz)
% =========================================================================
% Example
% =========================================================================
% nSubChannel = 16;
% totalPower = 1e-5; % -20 dBm
% channelStateInformation = random('rayleigh',1/0.6552,1,nSubChannel);
% bandwidth = 1e6; % 1 MHz
% noiseDensity = 1e-11; % -80 dBm
% [Capacity PowerAllocated] = ofdmwaterfilling(...
% nSubChannel,totalPower,channelStateInformation,bandwidth,noiseDensity)
%< Parameter Computation >
subchannelNoise = ...
noiseDensity*bandwidth/nSubChannel;
carrierToNoiseRatio = ...
channelStateInformation.^2/subchannelNoise;
initPowerAllo = ... (Formula 1)
(totalPower + sum(1./carrierToNoiseRatio))...
/nSubChannel - 1./carrierToNoiseRatio;
% Until this stage maybe some subchannels were allocated negetive power
% becouse of the optimization formula 1. At the following stage these
% subchannels will be eliminated from using any power and the algorithm is
% repeated for the other subchannels, until all the remained ones, will
% be allocated the positive power.
% < Iterative part of the algorithm >
while(length( find(initPowerAllo < 0 )) > 0 )
negIndex = find(initPowerAllo <= 0);
posIndex = find(initPowerAllo > 0);
nSubchannelRem = length(posIndex);
initPowerAllo(negIndex) = 0;
CnrRem = carrierToNoiseRatio(posIndex);
powerAlloTemp = (totalPower + sum(1./CnrRem))...
/nSubchannelRem - 1./CnrRem;
initPowerAllo(posIndex) = powerAlloTemp;
end
% < Output Computation >
% amount of power allocated to each subchannel
powerAllocated = initPowerAllo';
% total capacity of a channel based on shanon theory
shanonCapacity = bandwidth/nSubChannel * ...
sum(log2(1 + initPowerAllo.*carrierToNoiseRatio));
% <Graphical Observation>
% By observing the figure, it is clear that the power like water fills the
% container which is made by noise to carrier ratio or channel state
% information
f1 = figure(1);
clf;
set(f1,'Color',[1 1 1]);
bar((initPowerAllo + 1./carrierToNoiseRatio),1,'r')
hold on;
bar(1./carrierToNoiseRatio,1);
xlabel('subchannel indices');
title('Water filling algorithm')
legend('amount of power allocated to each subchannel',...
'Noise to Carrier Ratio')
ofdmwaterfilling.zip_OFDM分配_信道状态已知_功率分配_基于注水功率分配的ofdm系统_注水
版权申诉
5星 · 超过95%的资源 118 浏览量
2022-07-14
18:23:42
上传
评论
收藏 2KB ZIP 举报
局外狗
- 粉丝: 66
- 资源: 1万+
最新资源
- 基于 Yolov5 和 Deepsort 的 GUI 入侵检测系统
- java作业管理系统设计(源代码+论文).zip
- hadoop配置文件夹
- 基于java+mysql的毕业设计6套.zip
- windows部署腾讯tmagic-editor03-DSL 解析渲染
- 基于 YOLOv5 模型的 AI 解决方案,用于检测戴口罩或不戴口罩的人
- 基于yolov5、dlib和opencv的疲劳驾驶检测系统
- 基于YOLOv5的毒蘑菇检测项目,部署在云服务器上,运行在Android设备上
- 基于爬虫+neo4j+D3实现的苏州旅游知识图谱源码+数据.zip
- Oracle PLSQL 安装json库发送http请求服务
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈