資源簡介
此代碼是基于mATLAB的MISO信道容量仿真代碼,通過改變發射天線的數量得出模擬信道容量
代碼片段和文件信息
%?SIMO_Capacity.m
clear?all;clc;
Nt?=?1; ??????????%?8.發射天線的數目為1
Nr?=?1; ??????????%?9.接收天線的數目為1??????????????????????????????????????
SampleNum?=?10000;????????????????????????????????????????%?10.蒙特卡洛仿真時的抽樣數量
SNR_dB?=2:2:20;??????????????????????????????????????????%?11.信噪比(單位dB)
for?nSNR?=?1:length(SNR_dB)
????SNR_dB(nSNR)
rho?=?10^(SNR_dB(nSNR)/10);???????????????????????????%?13-15.完成信噪比的單位轉換
????for?nSample?=?1:SampleNum
????????H?=?(randn(NrNt)+sqrt(-1)*randn(NrNt))/sqrt(2);?%?18.瑞利衰落信道矩陣
????????Cn(nSNRnSample)?=?log2(real(det(min(NtNr)+rho*H‘*H/Nr)));
????end
????
????Capacity1(nSNR)?=?mean(?Cn(nSNR:)?);??????????????????%?22.求遍歷信道容量
????tempC1?=?sort(Cn(nSNR:));
end
Nt?=?1; ??????????%?26-42.接收天線的數目為3
Nr?=?3; ?????????????????????????????????????????????????
SampleNum?=?10000;????????????????????????????????????????
SNR_dB?=2:2:20;??????????????????????????????????????????
for?nSNR?=?1:length(SNR_dB)
????SNR_dB(nSNR)
rho?=?10^(SNR_dB(nSNR)/10);???????????????????????????
????for?nSample?=?1:SampleNum
????????H?=?(randn(NrNt)+sqrt(-1)*randn(NrNt))/sqrt(2);?
?????????Cn(nSNRnSample)?=?log2(real(det(min(NtNr)+rho*H‘*H/Nr)));
????end
????
????Capacity2(nSNR)?=?mean(?Cn(nSNR:)?);??????????????????
????tempC2?=?sort(Cn(nSNR:));
end
Nt?=?1; ??????????%?44-60.接收天線的數目為5
Nr?=?5; ????????????????????????????????????????????????
SampleNum?=?10000;????????????????????????????????????????
SNR_dB?=2:2:20;????????????????????????????????????????
for?nSNR?=?1:length(SNR_dB)
????SNR_dB(nSNR)
rho?=?10^(SNR_dB(nSNR)/10);???????????????????????????
????for?nSample?=?1:SampleNum
????????H?=?(randn(NrNt)+sqrt(-1)*randn(NrNt))/sqrt(2);?
????????Cn(nSNRnSample)?=?log2(real(det(min(NtNr)+rho*H‘*H/Nr)));
????end
????
????Capacity3(nSNR)?=?mean(?Cn(nSNR:)?);??????????????????
????tempC3?=?sort(Cn(nSNR:));
end
Nt?=?1; ??????????%?62-78.接收天線的數
評論
共有 條評論