% The codes investigate the performance of a greedy algorithm [1] in OFDM which
% allocates the power to subchannel in optimum way to reach the required
% Data rate
% By Hamid Ramezani 23-Mar-2008
% setting the parameters
numOfSubChannels = 16; % number of subchannels
modBitRate = [0;1;2;4;6];% the provided bit rate bits/Hz/Sec for
% example based on BPSK, QPSK, 16QAM and
% 64QAM modulation
% zero is required to states that
% subchannels can convey no data
reqSNR =10.^(.1*[-Inf;9;12;18;24]);
% Reqired SNR for the receiving the
% the bits through modulation on 10^-4 BER
% condition ref[2]
% zero is required to states that
% subchannels can convey no power
%Attention
% The single-side noise power spectral density (N0) is assumed to be 1
% otherwise the parameter setting must be modified
% SNR = Pt*CSI^2/(N0*B/N) which is assumed to SNR = Pt*CSI^2 (it is
% a kind of normalization)
requiredRate = 23; % bits/Sec/Hz
% channel coefficient generation
% rayleigh fading channel (with Rician absulute)
CSI = 1/sqrt(2) * abs ( randn(numOfSubChannels,1) + ...
sqrt(-1)*randn(numOfSubChannels,1));
% calling the mex function
[subChannelrequiredPower,subChannelRate] = ...
greedyAlgSingleUser(requiredRate,CSI,modBitRate ,reqSNR);
% Graphical observation
f1 = figure(1);
set(f1,'color',[1 1 1]);
subplot(2,2,1)
bar(subChannelRate)
xlabel('Subchannel Indice');
ylabel('number of bits conveied by subchannels');
subplot(2,2,2)
bar(10*log10(subChannelrequiredPower))
xlabel('Subchannel Indice');
ylabel('amount of power required by subchannels in dB');
subplot(2,2,3)
bar(20*log10(CSI))
xlabel('Subchannel Indice');
ylabel('channel response in different subchannels');
subplot(2,2,4)
bar(10*log10(subChannelrequiredPower./(CSI.^2)))
xlabel('Subchannel Indice');
ylabel('SNR in different subchannels');
% References
% Ref[1] C. Y. Wong, R. S. Cheng, K. B. Letaief and R. Murch, "Multiuser
% OFDM with Adaptive Subcarrier, Bit, and Power Allocation", IEEE
% Journal on Selected Areas In Communications, Vol. 17, No. 10,
% OCTOBER 1999
% Ref[2] Y. Zhang, and K. B. Letaief, Multiuser Adaptive Subcarrier-and-Bit
% Allocation With Adaptive Cell Selection for OFDM Systems, IEEE Transaction
% on wireless communications, Vol. 3, No. 5, Sep 2004