% in this programe a highly scattered enviroment is considered. The
% Capacity of a MIMO channel with nt transmit antenna and nr recieve
% antenna is analyzed. The power in parallel channel (after
% decomposition) is distributed as water-filling algorithm
% the pdf of the matrix lanada elements is depicted too.
clear all
close all
clc
%
% nt_V = [2 4 6 8 10]; %发射天线数
% nr_V = [2 4 6 8 10]; %接收天线数
nt_V = [2 1 2 1 2 3 1 4]; %发射天线数
nr_V = [1 2 2 3 3 3 4 1]; %接收天线数
N0 = 1e-4;
B = 1;
Iteration = 1e4; % must be grater than 1e2
SNR_V_db = [0:2:20];
SNR_V = 10.^(SNR_V_db/10);
% color = ['b';'r';'g';'k';'c'];
% notation = ['-o';'->';'<-';'-^';'-s'];
str1=[];
str2=[];
for k = 1 : 8
nt = nt_V(k);
nr = nr_V(k);
for(i = 1 : length(SNR_V))
Pt = N0 * SNR_V(i);
for(j = 1 : Iteration)
H = random('rayleigh',1,nr,nt);
[S V D] = svd(H);
landas(:,j) = diag(V(1));
[Capacity(i,j) PowerAllo] = WaterFilling_alg(Pt,landas(:,j),B,N0);%已知
[Capacity1(i,j) PowerAllo1] = averg_allo(Pt,landas(:,j),B,N0,nt);%未知
end
end
str=char(['t=',num2str(nt_V(k)) ', ' 'r=',num2str(nr_V(k))]);
str1=char(['t=',num2str(nt_V(k)) ', ' 'r=',num2str(nr_V(k))]);
str2=[str2;str;str1];
% f=plot(SNR_V_db,mean(Capacity'),'-x',SNR_V_db,mean(Capacity1'),'-s');
f=plot(SNR_V_db,mean(Capacity'),'-^');
% legend(str);
hold on
f=plot(SNR_V_db,mean(Capacity1'),'-s');
% legend(str1);
hold on
legend(str2);
% f2 = figure(2);
% hold on
% plot(SNR_V_db,mean(Capacity1'),'-o')
% hold on
%
% f3 = figure(3);
% hold on
% plot(SNR_V_db,mean(Capacity'),'-s',SNR_V_db,mean(Capacity1'),'-o')
% hold on
% f4 =figure(4)
% [y,x] = hist(reshape(landas,[1,min(nt,nr)*Iteration]),100);
% plot(x,y/Iteration,'color',color(k,:));
clear landas
end
grid on
title('MIMO系统已知和未知信道状态下的信道容量')
xlabel('SNR in dB')
ylabel('Capacity bits/s/Hz')
% legend('已知信道的状态信息','未知信道的状态信息',0)
% legend('已知信道的状态信息')
% grid on
% set(f1,'color',[1 1 1])
% title('MIMO系统已知信道状态下的信道容量')
% text(12,9,'2*2')
% text(14,17,'4*4')
% text(12,20,'6*6')
% text(12,26,'8*8')
% text(9,28,'10*10')
% xlabel('SNR in dB')
% ylabel('Capacity bits/s/Hz')
%
% f2 = figure(2)
% grid on
% set(f2,'color',[1 1 1])
% title('MIMO系统未知信道状态下的信道容量')
% text(12,9,'2*2')
% text(14,17,'4*4')
% text(12,20,'6*6')
% text(12,26,'8*8')
% text(9,28,'10*10')
% xlabel('SNR in dB')
% ylabel('Capacity bits/s/Hz')
% f3 = figure(3)
% grid on
% set(f3,'color',[1 1 1])
% title('MIMO系统已知和未知信道状态下的信道容量')
% % text(12,9,'2*2')
% % text(14,17,'4*4')
% % text(12,20,'6*6')
% % text(12,26,'8*8')
% % text(9,28,'10*10')
% xlabel('SNR in dB')
% ylabel('Capacity bits/s/Hz')
%
% f4 = figure(4)
% % legend(legend_str)
% grid on
% set(f4,'color',[1 1 1])
% ylabel('pdf of elements in matrix landa in svd decomposition of marix H')
评论2