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.
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%(1)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.
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
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
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')