⛄一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【容量仿真】基于matlab MIMO+SIMO+MISO+SISO容量仿真【含Matlab源码 4720期】
点击上面蓝色字体,直接付费下载,即可。
获取代码方式2:
付费专栏Matlab信号处理(初级版)
备注:
点击上面蓝色字体付费专栏Matlab信号处理(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab信号处理(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效);
点击CSDN资源下载链接:1份本博客上传CSDN资源代码
⛄二、 部分源代码
% compare.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(Nr,Nt)+sqrt(-1)*randn(Nr,Nt))/sqrt(2); % 18.瑞利衰落信道矩阵
Cn(nSNR,nSample) = log2(real(det(min(Nt,Nr)+rho*H*H'/Nt)));
end
Capacity(nSNR) = mean( Cn(nSNR,:) ); % 22.求遍历信道容量
tempC1 = sort(Cn(nSNR,:));
end
Nt = 1; % 26-42.发射天线数为1,接收天线数为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(Nr,Nt)+sqrt(-1)*randn(Nr,Nt))/sqrt(2);
Cn(nSNR,nSample) = log2(real(det(min(Nt,Nr)+rho*H'*H/Nt)));
end
Capacity(nSNR) = mean( Cn(nSNR,:) );
tempC2 = sort(Cn(nSNR,:));
end
Nt = 5; % 44-60.发射天线数为5,接收天线数为1
Nr = 1;
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(Nr,Nt)+sqrt(-1)*randn(Nr,Nt))/sqrt(2);
Cn(nSNR,nSample) = log2(real(det(min(Nt,Nr)+rho*H*H'/Nt)));
end
Capacity(nSNR) = mean( Cn(nSNR,:) );
tempC3 = sort(Cn(nSNR,:));
end
Nt = 3; % 62-78.收发两端天线的数目为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(Nr,Nt)+sqrt(-1)*randn(Nr,Nt))/sqrt(2);
Cn(nSNR,nSample) = log2(real(det(min(Nt,Nr)+rho*H*H'/Nt)));
end
Capacity(nSNR) = mean( Cn(nSNR,:) );
tempC4 = sort(Cn(nSNR,:));
end
Nt = 5; % 80-96.收发两端天线的数目为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(Nr,Nt)+sqrt(-1)*randn(Nr,Nt))/sqrt(2);
Cn(nSNR,nSample) = log2(real(det(min(Nt,Nr)+rho*H*H'/Nt)));
end
Capacity(nSNR) = mean( Cn(nSNR,:) );
tempC5 = sort(Cn(nSNR,:));
end
figure % 98.开始仿真作图
nSNR = length(SNR_dB);
plot(tempC1, (1:SampleNum)/SampleNum, ‘r-’);
hold on;
plot(tempC2, (1:SampleNum)/SampleNum, ‘g-’);
hold on;
plot(tempC3, (1:SampleNum)/SampleNum, ‘b-’);
hold on;
plot(tempC4, (1:SampleNum)/SampleNum, ‘y-’);
hold on;
plot(tempC5, (1:SampleNum)/SampleNum, ‘c-’);
hold on;
xlabel(‘信道容量 (bit/s/Hz)’);
ylabel(‘概率分布’);
legend(‘1X1’,‘1X5’,‘5X1’,‘3X3’,‘5X5’)
grid on;
⛄三、运行结果
⛄四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1] 沈再阳.精通MATLAB信号处理[M].清华大学出版社,2015.
[2]高宝建,彭进业,王琳,潘建寿.信号与系统——使用MATLAB分析与实现[M].清华大学出版社,2020.
[3]王文光,魏少明,任欣.信号处理与系统分析的MATLAB实现[M].电子工业出版社,2018.
3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除