18
ELECTRICAL ENGINEERING DEPARTMENT, KFUPM MIMO Capacity and gain of Optimal power allocation using Water-Filling algorithm EE 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.

MIMO Capacity and gain of Optimal power allocation using ...ee575.pbworks.com/f/hw3_mimo_cap.pdf · Optimal power allocation using Water-Filling algorithm ... Matlab implementation

  • Upload
    doananh

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

ELECTRICAL ENGINEERING DEPARTMENT, KFUPM

MIMO Capacity and gain of

Optimal power allocation

using Water-Filling

algorithm EE 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.

Table of Contents

Problem 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

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#$%&': )$%*'+,)- .$/; 1'

� � 12 2 log� 61 �� �7 �8�9�

12 log� : 61 �� �7 � 2.8888 =>?/A�8�9�

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, >�9$BCD*'E

With optimal power allocation;

�F# � 12 2 log� 61 �� �7 � 2.9827 =>?/A�8�9�

Hence, �H>HI�J� KH�L � �F# M � � 0.0939 =>?/A�

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

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 --->

WF

gai

n in

bps

/Hz

-

-->

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 -

Out

age

Pro

babi

lity

-

-->

Complementary CDF comparisons (vs capacity) at SNR=10dB

4x4 MIMO WF

4x4 MIMO

4x1 MISO1x4 SIMO

1X1 SISO

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 --->

Out

age

Pro

babi

lity

Outage probability vs SNR for 4 bps/Hz

4x4 MIMO

4x1 MISO

1x4 SIMO1X1 SISO

4x4 MIMO WF

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 vecto r 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 size P=zeros(1,m); % initialize transmitted power over each parallel c hannel to be 0 [N_sorted,index]=sort(N); % Noise power sorted in ascending order step=(N_sorted(2)-N_sorted(1))/res; N_sorted_temp=N_sorted; for p=1:length(N_sorted_temp)-1 if ((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/2 step=Pt/2; end if step<0.001 step=.001; end j=0; k=0; epsilon=1e-5; epsilon2=1e-4; %threshold for discrepancies in water level over di fferent channels i=1; z=0; q=2; step_old=0; for iter=1:1e6*res if (sum(abs((N_sorted(1).*ones(1,m))-N_sorted(1:m))<1e -6)==m && (sum(P)< Pt)) step=(Pt-sum(P))/m; N_sorted(1:m)=N_sorted(1:m)+step; P(1:m)=P(1:m)+step; break ; end

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))<1e -6)==q && (sum(P)< Pt)) if q==(length(N)) step=2*step; end if (q<m) step=N_sorted(q+1)-N_sorted(q); q=q+1; end end if (j>0 && step_old>step) step =step_old; j=0; end if (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 leve l check = abs(N_sorted-N_sorted(1).*ones(1 ,length(N)))<epsilon; check2=find(check); i=max(check2); step=(Pt-sum(P))/(i); N_sorted(1:i)=N_sorted(1:i)+step; P(1:i)=P(1:i)+step; end if (k>2) display([ 'Warning: Power alltoment exceeding budget ' ,num2str(k), 'rd time' ]); sum(P) end if i<length(N) if ((N_sorted(i)-N_sorted(i+1))>epsilon) %if water has gone above the next level, set the st ep 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; end if (step< 0.001) j=1; end i=i+1; else if i>1 % if water is below next entry of N, %re-initiazlize it to point at 1st entry and start re-filling water i=1; end end else % if i is pointing at the last entry of N, re intia lize it to point at 1st entry

i=1; end if (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; end end if (abs(sum(P)-Pt) < epsilon2) flag_vector2=abs(N_sorted(1).*ones(1,le ngth(find(P)))-N_sorted(1:length(find(P))))< epsilon2.*ones(1,leng th(find(P))); flag_vector=find(flag_vector2-ones(1,le ngth(find(P)))); if isempty(flag_vector) break ; end end if iter>1000 display( 'Warning: wf took more than 1000 iterations' ); end end v= N_sorted(1); % water level N_sorted; N; P=P(index); if (abs(sum(P)-Pt) > epsilon2) display( 'Warning: Power above budget' ); end

Appendix B

%% Main function to calculate MIMO channel capacity and associated figures %% of merit like complementary CDF & Outage probabi lity % Objective: (1)This function compares Mean channel capacity for different % MIMO realizations (SISO, SIMO,MISO, MIMO)as a fun ction 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 MIM O realizations % (SISO, SIMO,MISO, MIMO)as a function of SNR % Author: Raza Umar as part of EE 575 Information T heory Assignment % Date: May 08, 2010 %% >>>>>>>>>>>>>>>>>>>>>>>> ... CLEANING ... <<<<<< <<<<<<<<<<<<<<<<<<<<<<<< close all ; clear all ; clc; %% >>>>>>>>>>>>>>>>> ... SIMULTAION PARAMS ... <<<< <<<<<<<<<<<<<<<<<<<<<<<< SNR_dB=-10:30; SNR=10.^(SNR_dB./10); ch_realizations=10000; % Monte Carlo sim. of 10,000 channel realizations c_outage=4; epsilon=1e-6; %% >>>>>>>>>>>>>>>>>>>>>>> ... SISO ... <<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<< % initialization and param setting c11_i=zeros(length(SNR),ch_realizations); c11=zeros(length(SNR),1); % matrix initializations to avoid matrix growing in side loop % Mean channel capacity calculations for i1=1:length(SNR) SNR_i= SNR(i1); % for one specific value of SNR h11=1/sqrt(2).*complex(randn(1,ch_realizations),ran dn(1,ch_realizations)); % complex normal r.v. with var=1/2 per dim. h11_mag_sq=abs(h11).^2; c11_i(i1,1:ch_realizations)=log2(1+SNR_i.*h11_m ag_sq); % instantaneous cap. c11(i1)=mean(c11_i(i1,:)); % mean capacity end %complementary CDF at SNR=10dB c11_all=c11_i(21,:); % channel realizations at 10dB SNR range_11=0:0.1:max(c11_all); count11=histc(c11_all,range_11); count11_norm=cumsum(count11)/max(cumsum(count11)); comp_CDF_11=1-count11_norm; %outage probability j1= 1; for i1=find(SNR_dB==2):find(SNR_dB==20) c11_all=abs(c11_i(i1,:)); range11=0:0.1:max(c11_all); count11=histc(c11_all,range11);

count11_norm=cumsum(count11)/max(cumsum(count11 )); if (isempty(find(abs(range11-c_outage)<epsilon))) outage11(j1)=1; else outage11(j1)=count11_norm(find(abs(range11- c_outage)<epsilon)); end j1=j1+1; end %% >>>>>>>>>>>>>>>>>>>>> ... MIMO (4x4) ... <<<<<<< <<<<<<<<<<<<<<<<<<<<<<<< % initialization and param setting Pt=1; % power budget for MIMO water filling Nr=4; Nt=4; I_Nr=eye(Nr); c44_i=zeros(length(SNR),ch_realizations); c44=zeros(length(SNR),1); % matrix initializations to avoid matrix growing in side loop % Mean channel capacity calculations for i1=1:length(SNR) SNR_i= SNR(i1); % for one specific value of SNR H_vec=1/sqrt(2).*complex(randn(Nr*Nt,ch_realization s),randn(Nr*Nt,ch_realizations)); % Channel matrix with elements as complex normal r. v. having var=1/2 per dim. H=reshape(H_vec,Nr,Nt,ch_realizations); for i2=1:ch_realizations H_i=H(1:Nr,1:Nt,i2); H_H_hermt=H_i*H_i'; arg=I_Nr+ (SNR_i/Nt).*H_H_hermt; arg2= det(arg); c44_i(i1,i2)=log2(arg2); % instantaneous cap. %% alternate implementation to find inst. cap. (usi ng eigen values) % lamda=eig(H_H_hermt); % arg3=(1+(SNR_i/Nt)*lamda(1))*(1+(SNR_i/Nt)*lamda(2) )*(1+(SNR_i/Nt)*lamda(3))*(1+(SNR_i/Nt)*lamda(4)); % c442i(i1,i2)=log2(arg3); % instantaneous c ap. %% MIMO water filling lamda=eig(H_H_hermt); N=1./(SNR_i.*lamda); N_wf=N'; [v P_wf]=wfill(Pt,4,N_wf); arg_wf=(1+P_wf(1)/N_wf(1)).*(1+P_wf(2)/N_wf(2)).*(1 +P_wf(3)/N_wf(3)).*(1+P_wf(4)/N_wf(4)); c44_i_wf(i1,i2)=log2(arg_wf); % instantaneous cap. using wf %% end c44(i1)=mean(c44_i(i1,:)); % mean capacity c44_wf(i1)=mean(c44_i_wf(i1,:)); % mean capacity end

%% %%complementary CDF at SNR=10dB c44_all=abs(c44_i(21,:)); % channel realizations at 10dB SNR range_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 WF c44_all_wf=abs(c44_i_wf(21,:)); % channel realizations at 10dB SNR range_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(count 44_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)<epsilon))) outage44(j1)=1; else outage44(j1)=count44_norm(find(abs(range44- c_outage)<epsilon)); end j1=j1+1; end %%MIMO WF j1= 1; for i1=find(SNR_dB==2):find(SNR_dB==20) c44_all_wf=abs(c44_i_wf(i1,:)); range44_wf=0:0.1:max(c44_all_wf); count44_wf=histc(c44_all_wf,range44_wf); count44_norm_wf=cumsum(count44_wf)/max(cumsum(c ount44_wf)); if (isempty(find(abs(range44_wf-c_outage)<epsilon))) outage44_wf(j1)=1; else outage44_wf(j1)=count44_norm_wf(find(abs(ra nge44_wf-c_outage)<epsilon)); end j1=j1+1; end %% >>>>>>>>>>>>>>>>>>>>> ... SIMO (1x4) ... <<<<<<< <<<<<<<<<<<<<<<<<<<<<<<< % initialization and param setting Nr=4; Nt=1; c14_i=zeros(length(SNR),ch_realizations); c14=zeros(length(SNR),1); % matrix initializations to avoid matrix growing in side loop % Mean channel capacity calculations for i1=1:length(SNR)

SNR_i= SNR(i1); % for one specific value of SNR h14=1/sqrt(2).*complex(randn(Nr*Nt,ch_realizations) ,randn(Nr*Nt,ch_realizations)); % 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_m ag_sq_sum); % instantaneous cap. c14(i1)=mean(c14_i(i1,:)); % mean capacity end %complementary CDF at SNR=10dB c14_all=c14_i(21,:); % channel realizations at 10dB SNR range_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 probability j1= 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)<epsilon))) outage14(j1)=1; else outage14(j1)=count14_norm(find(abs(range14- c_outage)<epsilon)); end j1=j1+1; end %% >>>>>>>>>>>>>>>>>>>>> ... MISO (4x1) ... <<<<<<< <<<<<<<<<<<<<<<<<<<<<<<< % initialization and param setting Nr=1; Nt=4; c41_i=zeros(length(SNR),ch_realizations); c41=zeros(length(SNR),1); % matrix initializations to avoid matrix growing in side loop % Mean channel capacity calculations for i1=1:length(SNR) SNR_i= SNR(i1); % for one specific value of SNR h41=1/sqrt(2).*complex(randn(Nr*Nt,ch_realizations) ,randn(Nr*Nt,ch_realizations)); % complex normal r.v. having var=1/2 per dim. h41_mag_sq=abs(h41).^2; h41_mag_sq_sum=sum(h41_mag_sq); c41_i(i1,1:ch_realizations)=log2(1+(SNR_i./Nt). *h41_mag_sq_sum); % instantaneous cap. c41(i1)=mean(c41_i(i1,:)); % mean capacity end

%complementary CDF at SNR=10dB c41_all=c41_i(21,:); % channel realizations at 10dB SNR range_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 probability j1= 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)<epsilon))) outage41(j1)=1; else outage41(j1)=count41_norm(find(abs(range41- c_outage)<epsilon)); end j1=j1+1; end %% >>>>>>>>>>>>>>>>>>>> ... Plotting ... <<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<< % Mean channel capacity figure( 'Name' , 'Mean Capacity comparisons (vs SNR) for Flat Fading MIMO channels' ); plot(SNR_dB,abs(c44_wf), 'bx-' ,SNR_dB,abs(c44), 'ro' ,SNR_dB,c41, 'c+-' ,SNR_dB,c14, 'gs-' ,SNR_dB,c11, 'b:' ); legend( '4x4 MIMO WF' , '4x4 MIMO' , '4x1 MISO' , '1x4 SIMO' , '1X1 SISO' , 'Location' , 'NorthWest' ); title( 'Mean Capacity vs SNR' ); xlabel( 'SNR (dB) --->' ); ylabel( 'Mean Capacity bps/Hz --->' ); axis([-10 30 0 40]); %complementary CDF at SNR=10dB figure( 'Name' , 'Complementary CDF at SNR = 10dB' ); plot(range_44_wf,comp_CDF_44_wf, 'bx-' ,range_44,comp_CDF_44, 'ro' ,range_41,comp_CDF_41, 'c+-' ,range_14,comp_CDF_14, 'gs-' ,range_11,comp_CDF_11, 'b:' ); legend( '4x4 MIMO WF' , '4x4 MIMO' , '4x1 MISO' , '1x4 SIMO' , '1X1 SISO' , 'Location' , 'NorthEast' ); title( 'Complementary CDF comparisons (vs capacity) at SNR =10dB' ); xlabel( 'Mean Capacity bps/Hz --->' ); ylabel( '1 - Outage Probability --->' ); axis([0 15 0.9 1]); %outage probability vs SNR for 4 bps/Hz figure( 'Name' , 'Outage probability comparisons (vs SNR) for Flat F ading Channels' ); %plot(range_44,comp_CDF_44,'bx-',range_44,comp_CDF_44,'ro',range_41,comp_CDF_41,'c +-',range_14,comp_CDF_14,'gs-',range_11,comp_CDF_11,' b:'); semilogy(SNR_dB(find(SNR_dB==2):find(SNR_dB==20)),o utage44_wf, 'bx-' ,SNR_dB(find(SNR_dB==2):find(SNR_dB==20)),outage44, 'ro' ,SNR_dB(find(SNR_dB==2):find(SNR_dB==20)),outage41, 'c+-

' ,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 gain figure( '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 --->' );