8/6/2019 Hw3 Mimo Cap
1/18
ELECTRICAL ENGINEERING DEPARTMENT, KFUPM
MIMO Capacity and gain of
Optimal power allocation
using Water-Filling
algorithmEE 575 Information Theory
Assignment # 3
Submitted by:
Raza Umar
Student ID: g200905090
5/23/2010
In this assignment, capacity of parallel Gaussian channels has been compared for equal power allocation
and optimal power allocation based on water-filling algorithm. Mean capacity comparisons,
Complementary CDF comparisons and Outage probability comparisons have been analyzed for SISO,
SIMO, MISO, MIMO and MIMO using Water-Filling power allocation.
8/6/2019 Hw3 Mimo Cap
2/18
8/6/2019 Hw3 Mimo Cap
3/18
Table of ContentsProblem 1: Parallel Gaussian Channels .................................................................................................... 4
Part (1a) Total capacity of parallel channels for equal power distribution ........................ ................... 4
Part (1b) Water-filling algorithm ..................... ............................ ................... ............................ ........ 5
Part (1c) Total capacity of parallel channels for optimal power distribution ......................... .............. 5
Problem 2 + Problem 3: MIMO Capacity + Water filling for 4x4 MIMO Channel ............................ ........... 6
Part (2a+3a) Mean capacity comparisons for MIMO channels ........................ ...................... .............. 6
Part (2b+3b) Complementary CDF comparison for flat fading channels ........................... ................... 8
Part (2c+3c) Outage probability vs. SNR for flat adding channels .......................... ................... ........... 9
Appendix A ............................................................................................................................................ 10
Appendix B ............................................................................................................................................ 13
8/6/2019 Hw3 Mimo Cap
4/18
Problem 1: Parallel Gaussian Channels
Given received signal:
Where,
~ 0, 1 0 0 00 7 0 00 0 5 00 0 0 3
Total Power transmission=Pt=20
Part (1a) Total capacity of parallel channels for equal power distribution
As we have 4 parallel channels
M=4=Nt=Nr
N1=1, N2=7, N3=5, N4=3
For equal power distribution:
204 5 , 1 , 2 , , 4
max: ; 12 log 1
12 log 1 2.8888 /
8/6/2019 Hw3 Mimo Cap
5/18
Part (1b) Water-filling algorithm
Matlab implementation of Water filling algorithm is available in Appendix A.
Part (1c) Total capacity of parallel channels for optimal power distribution
For, N1=1, N2=7, N3=5, N4=3
Water level obtained from Matlab code = v=9 &
P1=8, P2=2, P3=4, P4=6 using,
With optimal power allocation;
12
log 1
2.9827 /
Hence, 0.0939 /
8/6/2019 Hw3 Mimo Cap
6/18
Problem 2 + Problem 3: MIMO Capacity + Water filling for 4x4 MIMO
Channel
Matlab Implementation for MIMO Capacity and Water filling for 4x4
MIMO Channel is available in Appendix B.
Part (2a+3a) Mean capacity comparisons for MIMO channels
8/6/2019 Hw3 Mimo Cap
7/18
Water filing Capacity Gain
-10 -5 0 5 10 15 20 25 300
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9WF gain in capacity
SNR in dB --->
WFgaininbps/Hz
--->
8/6/2019 Hw3 Mimo Cap
8/18
Part (2b+3b) Complementary CDF comparison for flat fading channels
0 5 10 150.9
0.91
0.92
0.93
0.94
0.95
0.96
0.97
0.98
0.99
1
Mean Capacity bps/Hz --->
1-OutageProbability
--->
Complementary CDF comparisons (vs capacity) at SNR=10dB
4x4 MIMO WF
4x4 MIMO
4x1 MISO
1x4 SIMO
1X1 SISO
8/6/2019 Hw3 Mimo Cap
9/18
Part (2c+3c) Outage probability vs. SNR for flat adding channels
2 4 6 8 10 12 14 16 18 20
10-5
10-4
10
-3
10-2
10-1
100
SNR in dB --->
Outa
geProbability
Outage probability vs SNR for 4 bps/Hz
4x4 MIMO
4x1 MISO
1x4 SIMO
1X1 SISO
4x4 MIMO WF
8/6/2019 Hw3 Mimo Cap
10/18
Appendix A
%% Function: wfill% This routine optimally allocates the power among "m" channel using water% filling algorithm% Input:% 1. Pt: Total Power budget% 2. m: Total available parallel channels% 3. N: Un-correlated Noise variances ( a row vector of lenght m)% Output:% 1. v: water level% 2. P: power levels corresponding to "m" (arranged in the same order as% N) according to water filling algo.
function [v P] = wfill(Pt,m,N) % Optimum power allocation function
res=1; % resolution of step sizeP=zeros(1,m); % initialize transmitted power over each parallel channel to be
0[N_sorted,index]=sort(N); % Noise power sorted in ascending orderstep=(N_sorted(2)-N_sorted(1))/res;N_sorted_temp=N_sorted;for p=1:length(N_sorted_temp)-1if ((max(N_sorted_temp)-min(N_sorted_temp))>Pt)
m=m-1;N_sorted_temp=N_sorted_temp(1:end-1);
end
end
if step>Pt/2step=Pt/2;
endif step
8/6/2019 Hw3 Mimo Cap
11/18
N_sorted(i)=N_sorted(i)+step;P(i)=P(i)+step;
if(sum(abs((N_sorted(1).*ones(1,q))-N_sorted(1:q))step)
step =step_old;j=0;
endif (sum(P)>Pt)
k=k+1;N_sorted(1:i)=N_sorted(1:i)-step;P(1:i)=P(1:i)-step;% find how many channels(out of m) are at same levelcheck = abs(N_sorted-N_sorted(1).*ones(1,length(N)))2)display(['Warning: Power alltoment exceeding budget ',num2str(k),'rd
time']);sum(P)
end
if iepsilon)
%if water has gone above the next level, set the step such that when water%is added to the next level, its level becomes the same as previous level
if ((z~=1)&&(step~=N_sorted(i)-N_sorted(i+1)))step_old=step;step=N_sorted(i)-N_sorted(i+1);
z=0;endif (step< 0.001)
j=1;endi=i+1;elseif i>1 % if water is below next entry of N,
%re-initiazlize it to point at 1st entry and start re-filling wateri=1;
endend
else % if i is pointing at the last entry of N, re intialize it to
point at 1st entry
8/6/2019 Hw3 Mimo Cap
12/18
i=1;endif (abs(sum(P)-Pt) < epsilon2)
if i>1&&(N_sorted(i) < N_sorted(i-1))N_sorted(1:i-1)=N_sorted(1:i-1)-step;P(1:i-1)=P(1:i-1)-step;step=(step*(i-1))/i;
N_sorted(1:i)=N_sorted(1:i)+step;P(1:i)=P(1:i)+step;
j=0;i=1;z=1;
endend
if (abs(sum(P)-Pt) < epsilon2)flag_vector2=abs(N_sorted(1).*ones(1,length(find(P)))-
N_sorted(1:length(find(P))))< epsilon2.*ones(1,length(find(P)));flag_vector=find(flag_vector2-ones(1,length(find(P))));if isempty(flag_vector)
break;end
endif iter>1000
display('Warning: wf took more than 1000 iterations');end
endv= N_sorted(1); % water levelN_sorted;
N;P=P(index);if(abs(sum(P)-Pt) > epsilon2)
display('Warning: Power above budget');end
8/6/2019 Hw3 Mimo Cap
13/18
Appendix B
%% Main function to calculate MIMO channel capacity and associated figures%% of merit like complementary CDF & Outage probability% Objective: (1)This function compares Mean channel capacity for different% MIMO realizations (SISO, SIMO,MISO, MIMO)as a function of SNR% (2) compares complementary CDF for different MIMO realizations% (SISO, SIMO,MISO, MIMO)as a function of capacity in bps/Hz% (3) compares Outage probability for different MIMO realizations% (SISO, SIMO,MISO, MIMO)as a function of SNR% Author: Raza Umar as part of EE 575 Information Theory Assignment% Date: May 08, 2010
%% >>>>>>>>>>>>>>>>>>>>>>>> ... CLEANING ...
8/6/2019 Hw3 Mimo Cap
14/18
count11_norm=cumsum(count11)/max(cumsum(count11));if(isempty(find(abs(range11-c_outage)>>>>>>>>>>>>>>>>>>> ... MIMO (4x4) ...
8/6/2019 Hw3 Mimo Cap
15/18
%%
%%complementary CDF at SNR=10dB
c44_all=abs(c44_i(21,:)); % channel realizations at 10dB SNRrange_44=0:0.1:max(c44_all);count44=histc(c44_all,range_44);count44_norm=cumsum(count44)/max(cumsum(count44));comp_CDF_44=1-count44_norm;%%MIMO WFc44_all_wf=abs(c44_i_wf(21,:)); % channel realizations at 10dB SNRrange_44_wf=0:0.1:max(c44_all_wf);count44_wf=histc(c44_all_wf,range_44_wf);count44_norm_wf=cumsum(count44_wf)/max(cumsum(count44_wf));comp_CDF_44_wf=1-count44_norm_wf;
%%%outage prob
j1= 1;for i1=find(SNR_dB==2):find(SNR_dB==20)
c44_all=abs(c44_i(i1,:));range44=0:0.1:max(c44_all);count44=histc(c44_all,range44);count44_norm=cumsum(count44)/max(cumsum(count44));if(isempty(find(abs(range44-c_outage)>>>>>>>>>>>>>>>>> ... SIMO (1x4) ...
8/6/2019 Hw3 Mimo Cap
16/18
SNR_i= SNR(i1); % for one specific value of SNR
h14=1/sqrt(2).*complex(randn(Nr*Nt,ch_realizations),randn(Nr*Nt,ch_realizatio
ns));% complex normal r.v. having var=1/2 per dim.h14_mag_sq=abs(h14).^2;h14_mag_sq_sum=sum(h14_mag_sq);c14_i(i1,1:ch_realizations)=log2(1+SNR_i.*h14_mag_sq_sum); %
instantaneous cap.c14(i1)=mean(c14_i(i1,:)); % mean capacity
end
%complementary CDF at SNR=10dBc14_all=c14_i(21,:); % channel realizations at 10dB SNRrange_14=0:0.1:max(c14_all);count14=histc(c14_all,range_14);count14_norm=cumsum(count14)/max(cumsum(count14));comp_CDF_14=1-count14_norm;
%outage probabilityj1= 1;for i1=find(SNR_dB==2):find(SNR_dB==20)
c14_all=abs(c14_i(i1,:));range14=0:0.1:max(c14_all);count14=histc(c14_all,range14);count14_norm=cumsum(count14)/max(cumsum(count14));if(isempty(find(abs(range14-c_outage)>>>>>>>>>>>>>>>>>>> ... MISO (4x1) ...
8/6/2019 Hw3 Mimo Cap
17/18
%complementary CDF at SNR=10dBc41_all=c41_i(21,:); % channel realizations at 10dB SNRrange_41=0:0.1:max(c41_all);
count41=histc(c41_all,range_41);count41_norm=cumsum(count41)/max(cumsum(count41));comp_CDF_41=1-count41_norm;
%outage probabilityj1= 1;for i1=find(SNR_dB==2):find(SNR_dB==20)
c41_all=abs(c41_i(i1,:));range41=0:0.1:max(c41_all);count41=histc(c41_all,range41);count41_norm=cumsum(count41)/max(cumsum(count41));if(isempty(find(abs(range41-c_outage)>>>>>>>>>>>>>>>>>> ... Plotting ...
8/6/2019 Hw3 Mimo Cap
18/18
',SNR_dB(find(SNR_dB==2):find(SNR_dB==20)),outage14, 'gs-
',SNR_dB(find(SNR_dB==2):find(SNR_dB==20)),outage11, 'b:');legend('4x4 MIMO WF','4x4 MIMO','4x1 MISO','1x4 SIMO','1X1
SISO','Location','SouthEast');title('Outage probability vs SNR for 4 bps/Hz');xlabel('SNR in dB --->');ylabel('Outage Probability --->');axis([2 20 1e-6 1]);
% MIMO water-filling capacity gainfigure('Name','capacity gain of water-filling');plot(SNR_dB,abs(c44_wf)'-abs(c44));grid on;title('WF gain in capacity');xlabel('SNR in dB --->');ylabel('WF gain in bps/Hz --->');