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

📄 outagecapacityvssnr.m

📁 MIMO OutageCapacity vs SNR
💻 M
字号:
clear all;
type1=['k' 'b' 'r' 'g'];
type2=['-' ':' '--' '-.'];
it=input('Input the number of arrangement up to four >> ');
Coutage=input('Input your Outage Capacity  >>');
SNRdB=input('Input SNR Range in dB >> ');
bins=input('Input bins resolution in percentage >> ');
SNRRange=10.^(SNRdB/10);
relizations=input('Input the number of relizations >> ');
Cmimo=zeros(1,relizations);
NTx=zeros(1,it);
MRx=zeros(1,it);
OutageProb=zeros(1,length(SNRRange));
maxx=0;
for nn=1:it %% Loop One
NTx(nn)=input(sprintf('Input the number of Transmit antennas for Arrangment %2.0f  >> ',nn));
MRx(nn)=input(sprintf('Input the number of Receive antennas for Arrangment %2.0f  >> ',nn));
for ss=1:length(SNRRange) %% Loop Two
for ii=1:relizations  %% Loop Three
    H=sqrt(0.5)*randn(MRx(nn),NTx(nn))+i*sqrt(0.5)*randn(MRx(nn),NTx(nn));
    Cmimo(ii)=real(log2(det(eye(MRx(nn))+SNRRange(ss)/NTx(nn)*H*H')));
end %% End Loop Three
NumberOfBins=fix(relizations/bins); %% Round to the nearest integer toward zero
[Pc,Cpbs]=hist(real(Cmimo),NumberOfBins); %% Histogram
Pc=Pc/sum(Pc); %% Make the sum(Pc)=1 
Cindex=find(floor(real(Cpbs))==Coutage); %% find the index of the Cpbs array that is close to the Outage Capacity
OutageProb(ss)=sum(Pc(1:Cindex)); %% find the outage probability at the given SNR
end % end Loop Two

plot(SNRdB,OutageProb,[type1(nn)type2(nn)]);hold on;

end % End Loop One
%legend(sprintf('%1.0fx%1.0f',[NTx(1) MRx(1)]),sprintf('%1.0fx%1.0f',[NTx(2) MRx(2)]),sprintf('%1.0fx%1.0f',[NTx(3) MRx(3)]),sprintf('%1.0fx%1.0f',[NTx(4) MRx(4)]));
hold off;
title(sprintf('Outage Probability vs SNR for %2.0f bps/Hz',Coutage));
xlabel('SNR in dB');
ylabel('Outage Probability');
switch it
case it==4
legend(sprintf('%1.0fx%1.0f',[NTx(1) MRx(1)]),sprintf('%1.0fx%1.0f',[NTx(2) MRx(2)]),sprintf('%1.0fx%1.0f',[NTx(3) MRx(3)]),sprintf('%1.0fx%1.0f',[NTx(4) MRx(4)]));
break;
case it==3
legend(sprintf('%1.0fx%1.0f',[NTx(1) MRx(1)]),sprintf('%1.0fx%1.0f',[NTx(2) MRx(2)]),sprintf('%1.0fx%1.0f',[NTx(3) MRx(3)]));
break;
case it==2
    legend(sprintf('%1.0fx%1.0f',[NTx(1) MRx(1)]),sprintf('%1.0fx%1.0f',[NTx(2) MRx(2)]));
  break;
case it==1
    legend(sprintf('%1.0fx%1.0f',[NTx(1) MRx(1)]));
    break;
otherwise
    break;
end


    

⌨️ 快捷键说明

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