# MATLAB CODE

:
1. CAPACITY WITH AND WITHOUT CSIT FOR 5x10 MIMO SYSTEM
clc;
clear all;
close all;
Nt=5;
Nr=10;

%---------No. of transmitter antennas

snrdB=0:1:10; %-----------snr values in dB, for which capacity will
be computed
snr=10.^(snrdB/10);
Cut=zeros(1,length(snr));
%---------capacity of a uninformed
transmitter i.e., without CSIT
Cit=zeros(1,length(snr));
%---------capacity of an informed
transmitter i.e., with CSIT
Cut_tot=zeros(1,length(snr));
Cit_tot=zeros(1,length(snr));
count=100;
for k=1:count
H=randn(Nr,Nt)+i*randn(Nr,Nt); %---------channel matrix H
[U,S,V]=svd(H); %----------singular value decomposition of H
sv=diag(S); %--------------non-zero singular values of H
ev=sv.*sv; %--------------eigen values of H
r=rank(H); %--------------computing rank of H
for i=1:length(snr)
%CAPACITY CALCULATION FOR EQUAL POWER ALLOCATION WITHOUR CSIT
for j=1:r
Cut(i)=Cut(i)+log2(1+((snr(i)/Nt)*ev(j)));
end
%WATER POURING ALGORITHM FOR CALCULATION OF CAPACITY WITH CSIT
p=1;
Pi=zeros(1,r);
while(Pi(r-p+1)<=0)
x=0;
for j=1:r-p+1
x=x+(1/ev(j));
end
Mu=(Nt/(r-p+1))*(1+(1/snr(i))*x);
for j=1:r-p+1
Pi(j)=Mu-(Nt/((snr(i))*ev(j)));

e. end p=p+1. %---------capacity of a uninformed transmitter i. %---------No. for i=1:length(snr) diff(i)=Cit_avg(i)-Cut_avg(i).'with CSIT'. %-----------snr values in dB. end end Cut_tot=Cut_tot+Cut. close all. %---------capacity of an informed transmitter i.length(snr))..end if Pi(r-p+1)<=0 Pi(r-p+1)=0.'-o') hold on plot(snrdB. end Cut_avg=Cut_tot/count. Cit_tot=Cit_tot+Cit. Cit_avg=Cit_tot/count. %---------No.diff. for which capacity will be computed snr=10. without CSIT Cit=zeros(1. clear all.Cut_avg. CAPACITY WITH AND WITHOUT CSIT FOR 10X5 MIMO SYSTEM clc.'->g') xlabel('SNR in dB') ylabel('Capacity') legend('without CSIT'.'difference in capacity') 2.Cit_avg. of transmitter antennas Nr=5..length(snr)).e. Cut=zeros(1. end %----------------PLOTS----------------------% figure plot(snrdB. of receiver antennas snrdB=0:1:10. Nt=10.'-*r') hold on plot(snrdB. end for j=1:r Cit(i)=Cit(i)+log2(1+((snr(i)/Nt)*Pi(j)*ev(j))). with CSIT .^(snrdB/10).

Nt). for k=1:count H=randn(Nr. end Mu=(Nt/(r-p+1))*(1+(1/snr(i))*x). Cit_avg=Cit_tot/count. . end if Pi(r-p+1)<=0 Pi(r-p+1)=0. end Cut_avg=Cut_tot/count. %--------------non-zero singular values of H ev=sv.r).Nt)+i*randn(Nr. %--------------eigen values of H r=rank(H). Cit_tot=zeros(1. end p=p+1.Cut_tot=zeros(1.S.V]=svd(H). Pi=zeros(1. end for j=1:r Cit(i)=Cit(i)+log2(1+((snr(i)/Nt)*Pi(j)*ev(j))). Cit_tot=Cit_tot+Cit. end end Cut_tot=Cut_tot+Cut.length(snr)). %----------singular value decomposition of H sv=diag(S). %---------channel matrix H [U. for j=1:r-p+1 Pi(j)=Mu-(Nt/((snr(i))*ev(j))). for j=1:r-p+1 x=x+(1/ev(j)). for i=1:length(snr) diff(i)=Cit_avg(i)-Cut_avg(i). count=100. while(Pi(r-p+1)<=0) x=0. %--------------computing rank of H for i=1:length(snr) %CAPACITY CALCULATION FOR EQUAL POWER ALLOCATION WITHOUR CSIT for j=1:r Cut(i)=Cut(i)+log2(1+((snr(i)/Nt)*ev(j))).length(snr)). end %WATER POURING ALGORITHM FOR CALCULATION OF CAPACITY WITH CSIT p=1.*sv.

'->g') xlabel('SNR in dB') ylabel('Capacity') legend('without CSIT'.'-*r') hold on plot(snrdB.'-o') hold on plot(snrdB.end %----------------PLOTS----------------------% figure plot(snrdB.'difference in capacity') .Cit_avg.'with CSIT'.Cut_avg.diff.

Nt<Nr 2.PLOTS: 1. Nt>Nr .

EC6325 MIMO COMMUNICATION SYSTEMS ASSIGNMENT SUBMITTED BY: NAMITHA R S2 TELECOMMUNICATION M110253EC .

1053 0.3068 3.0169 0.4490 3.0031 0.7543 4.0112 2.0539 4.OBSERVATION: 1.0251 0.9072 4.4270 4.6082 3.5999 3.0020 .Nt<Nr diff = 0.0755 0.0532 0.0368 0.Nt>Nr diff = 3.0048 0.0074 0.3157 4.5244 4.1909 0.