100% found this document useful (1 vote)
436 views7 pages

Mimo Matlab Code

This MATLAB code calculates the channel capacity with and without channel state information at the transmitter (CSIT) for different MIMO system configurations. It performs this calculation for various signal-to-noise ratio (SNR) values using both equal power allocation and waterfilling techniques. The code then plots the average capacity values with and without CSIT, as well as their difference, for two scenarios: 1) where the number of transmit antennas is less than the number of receive antennas and 2) where the number of transmit antennas is greater than the number of receive antennas.

Uploaded by

Luna Moonfang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
436 views7 pages

Mimo Matlab Code

This MATLAB code calculates the channel capacity with and without channel state information at the transmitter (CSIT) for different MIMO system configurations. It performs this calculation for various signal-to-noise ratio (SNR) values using both equal power allocation and waterfilling techniques. The code then plots the average capacity values with and without CSIT, as well as their difference, for two scenarios: 1) where the number of transmit antennas is less than the number of receive antennas and 2) where the number of transmit antennas is greater than the number of receive antennas.

Uploaded by

Luna Moonfang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

MATLAB CODE:

1. CAPACITY WITH AND WITHOUT CSIT FOR 5x10 MIMO SYSTEM



clc;
clear all;
close all;

Nt=5; %---------No. of transmitter antennas
Nr=10; %---------No. of receiver 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)));
end

if Pi(r-p+1)<=0
Pi(r-p+1)=0;
end
p=p+1;
end

for j=1:r
Cit(i)=Cit(i)+log2(1+((snr(i)/Nt)*Pi(j)*ev(j)));
end
end
Cut_tot=Cut_tot+Cut;
Cit_tot=Cit_tot+Cit;
end
Cut_avg=Cut_tot/count;
Cit_avg=Cit_tot/count;

for i=1:length(snr)
diff(i)=Cit_avg(i)-Cut_avg(i);
end

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


2. CAPACITY WITH AND WITHOUT CSIT FOR 10X5 MIMO SYSTEM

clc;
clear all;
close all;

Nt=10; %---------No. of transmitter antennas
Nr=5; %---------No. of receiver 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)));
end

if Pi(r-p+1)<=0
Pi(r-p+1)=0;
end
p=p+1;
end

for j=1:r
Cit(i)=Cit(i)+log2(1+((snr(i)/Nt)*Pi(j)*ev(j)));
end
end
Cut_tot=Cut_tot+Cut;
Cit_tot=Cit_tot+Cit;
end
Cut_avg=Cut_tot/count;
Cit_avg=Cit_tot/count;

for i=1:length(snr)
diff(i)=Cit_avg(i)-Cut_avg(i);
end

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



















PLOTS:
1. N
t
<N
r


2. N
t
>N
r





EC6325
MIMO COMMUNICATION
SYSTEMS
ASSIGNMENT






SUBMITTED BY:
NAMITHA R
S2 TELECOMMUNICATION
M110253EC
OBSERVATION:
1.Nt>Nr
diff =

3.3068 3.4490 3.5999 3.7543 3.9072 4.0539 4.1909
4.3157 4.4270 4.5244 4.6082

2.Nt<Nr
diff =

0.1053 0.0755 0.0532 0.0368 0.0251 0.0169 0.0112
0.0074 0.0048 0.0031 0.0020

You might also like