📄 cuaveragehome2.m
字号:
%% This file will plot the average Capacity of MIMO Channels.
%% The plots will be Capacity vs SNR, Capacity VS MRx Capacity vs. NTx,
%% Capacity comparisons with othe channels
close all;
clear all;
type=['o' '+' 's' '*' 'k' 'r' 'b' ':'];
colour=['k' 'r' 'b' ':'];
disp('1- Capacity vs SNR input parameters');
SNRArraydB=input('Input the SNR Range in dBs >> ');
SNRArray=10.^(SNRArraydB/10);
it=input('Input the number of antenna arrangments up to four >> ');
%it=3;
NumberOfRelizations=input('Input the number of Relizations >> ');
%AR1=zeros(1,length(SNRArray));
%AR2=zeros(1,length(SNRArray));
%AR3=zeros(1,length(SNRArray));
figure;
subplot(2,2,1);hold on;
for ii=1:it
AR(ii,:)=zeros(1,length(SNRArray));
MRx(ii)=input('Input the number of receive antennas for the &ii Arrangment >> ');
NTx(ii)=input('Input the number of transmit antennas 1st Arrangment >> ');
M=MRx(ii);N=NTx(ii);
clear H;
for jj=1:NumberOfRelizations
H=sqrt(0.5)*randn(M,N)+i*sqrt(0.5)*randn(M,N);
for snr=1:length(SNRArray)
Cmimo1st(snr)=log2(det(eye(M)+SNRArray(snr)/N*H*H'));
end
AR(ii,:)=AR(ii,:)+Cmimo1st;
end
AR(ii,:)=AR(ii,:)/NumberOfRelizations;
%plot(SNRArraydB,AR(ii,:),colour(ii),SNRArraydB,AR(ii,:),type(ii));
plot(SNRArraydB,AR(ii,:),type(ii));
title('Capacity vs. SNR for different {\it N^{Tx}X M^{Rx}}');
xlabel('SNR dB');
ylabel('Capacity bps/Hz');
end
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)]),...
sprintf('%1.0fx%1.0f',[NTx(5) MRx(5)]),sprintf('%1.0fx%1.0f',[NTx(6) MRx(6)]));
hold off;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -