⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 capacity_plot.m

📁 通信系统仿真原理与无线应用 所有的代码
💻 M
字号:
function output=capacity_plot(SNR,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
%SNR is signal-to-noise ratio in dBs
%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
%*********************************************************************

SNR=10^(0.1*SNR);

%10000 Monte-Carlo runs
for K=1:10000
   T=randn(M,M)+j*randn(M,M);
   T=0.707*T;
  if corr
      T=[1 value;value 1];
      T=chol(T);
  elseif XPD
      T=[1 alpha;alpha 1];
      T=chol(T);
  end
   I=eye(M);
   a=(I+(SNR/M)*T*T');
   a=det(a);
   y(K)=log2(a);    
end
[n1 x1]=hist(y,40);
n1_N=n1/max(K);
a=cumsum(n1_N);
b=abs(x1);
if output == 'erg'
    output=interp1q(a,b',0.5);   %ergodic capacity
elseif output == 'out'
    output=interp1q(a,b',0.1);   %outage capacity 
end 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -