www.pudn.com > space-timecodingBrankaVuceticJinhongYuan.rar > capacity_plot_main.m, change:2006-12-01,size:1956b


%function z=capacity_plot_main(M,corr,value,XPD,alpha,output) 
 
%************************************************************************** 
%This program works with "capacity_plot_main.m" file.Figs 
%2.6,2.7,2.9,2.12 are determined using this program. It operates on 
%file "capacity_plot.m" 
%z=capacity_plot_main(M,corr,value,ric,k,XPD,alpha,output) 
%M -> number of antennas (M x M) system 
%corr -> 1 if with correlation, 0 if uncorrelated (for a 2x2 system only) 
%value -> correlation coefficient value from 0 ->1 
%XPD -> 1 if antenna XPD is to be investigated, 0 if not (for a 2x2 system 
%only) 
%alpha -> XPD value 
%output -> defined by 'erg' and 'out' for ergodic capacity or outage 
%capacity respectively 
%EXAMPLE: capacity_plot_main(2,1,0.5,1,0.5,'out')-> determines the outage 
%capacity for a 2x2 system with a correlation of 0.5 and an XPD of 0.5 
%************************************************************************** 
 
%vary SNR through 20 dB 
SNR=0:1:20;%SNR is signal-to-noise ratio in dBs 
temp2=[]; 
temp21=[]; 
temp22=[]; 
for i=1:length(SNR) 
    temp1(i)=capacity_plot(SNR(i),2,1,0.99,0,0,'erg');% change this file to suit requirements e.g. capacity_rician, 
    temp11(i)= capacity_plot(SNR(i),2,1,0,0,0,'erg');                                                           %    capacity_water(for water-filling) etc. 
    temp12(i)= capacity_plot(SNR(i),2,1,0.8,0,0,'erg');   
     
    temp2=[temp2 temp1(i)]; 
    temp21=[temp21 temp11(i)]; 
    temp22=[temp22 temp12(i)]; 
     
    temp1(i)=0; 
    temp11(i)=0; 
    temp12(i)=0; 
     
end 
 
plot(SNR,temp2,'-+',SNR,temp21,'->',SNR,temp22,'-o'); 
grid; 
 
%plot routines follow. These will change depending upon the type of plot. 
%The following routines are based on the given example above 
xlabel('SNR'); 
ylabel('Capacity (Bits/sec)'); 
legend('完全相关','完全不相关','部分相关',0); 
%title('Outage Capacity Variation with SNR for Corr = 0.5 and XPD = 0.5');