遍历容量和中断容量的matlab仿真对比

本文通过Matlab代码实现了不同天线数量配置下系统的遍历容量和中断容量的仿真,并进行了对比分析。展示了随着信噪比的变化,不同配置下的容量表现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


一、解决的问题

实现了遍历容量和中断容量的matlab仿真对比,其中遍历容量的代码来源于网络,中断容量的代码在前者的基础上修改给出。


二、代码

遍历容量代码:

clc;clear;close all
j = sqrt(-1);
Mr = [1 2 4 6];
Mt = [1 2 4 6];
LRT = length(Mr);
SNR = 0 : 20;
Lsnr = length(SNR);
testnum = 10000;
for ln = 1 : LRT;
mR = Mr(ln); % Receiver atenna number.
mT = Mt(ln); % Transmitter atenna number.  
for lm = 1 : Lsnr;
    snr = 10^(SNR(lm)/10);
    for ll = 1 : testnum,
        H_matrix = (randn(mT,mR) + j*randn(mT,mR))/sqrt(2);
        M_Channl = H_matrix*H_matrix';
        [Vect,D] = eig(M_Channl);
        F_matrix = eye(size(D))+snr*D./mT;
        G_mt(ll) = sum(log2(diag(F_matrix)));
    end
    C_mt(ln,lm) = sum(G_mt)/testnum;
end
end
figure(1); plot(SNR,C_mt(1,:),'k-*','LineWidth',2);
hold on;plot(SNR,C_mt(2,:),'k-p','LineWidth',2);
plot(SNR,C_mt(3,:),'k-h','LineWidth',2);
plot(SNR,C_mt(4,:),'k-v','LineWidth',2);
xlabel('信噪比 \rho (dB)','FontSize',14);
ylabel('遍历容量C(bit/s/Hz)','FontSize',14);
legend('N_T=N_R=1','N_T=N_R=2','N_T=N_R=4','N_T=N_R=6');  
hold off

中断容量代码如下:

clc;
clear all;
close all;

j = sqrt(-1);%虚部单位
Mr = [1 2 4 6];%天线数量
Mt = [1 2 4 6];
LRT = length(Mr);
SNR = 0 : 20;%信噪比变化范围
Lsnr = length(SNR);
testnum = 100;%testnum比较小时,遍历容量和中断容量相差不大
for ln = 1 : LRT;
mR = Mr(ln); % Receiver atenna number.
mT = Mt(ln); % Transmitter atenna number.  
for lm = 1 : Lsnr;
    snr = 10^(SNR(lm)/10);
    for ll = 1 : testnum,
        H_matrix = (randn(mT,mR) + j*randn(mT,mR))/sqrt(2);
        M_Channl = H_matrix*H_matrix';
        [Vect,D] = eig(M_Channl);
        F_matrix = eye(size(D))+snr*D./mT;
        G_mt(ll) = sum(log2(diag(F_matrix)));
    end
    %计算遍历容量
    C_mt(ln,lm) = sum(G_mt)/testnum;
    G_mt_sort=sort(G_mt);
    %计算中断容量
    get_1 =G_mt_sort(1,testnum*0.01:100);%舍弃1%的一部分,便是1%中断容量
    get_10=G_mt_sort(1,testnum*0.1:100);%舍弃10%的一部分,便是10%中断容量
    C_mt_1(ln,lm) = sum(get_1)/testnum; %1%中断容量
    C_mt_10(ln,lm) = sum(get_10)/testnum;%10%中断容量
end
end
figure(1); 
hold on;
%遍历容量
plot(SNR,C_mt(1,:),'k-*','LineWidth',2);
plot(SNR,C_mt(2,:),'k-p','LineWidth',2);
plot(SNR,C_mt(3,:),'k-h','LineWidth',2);
plot(SNR,C_mt(4,:),'k-v','LineWidth',2);
%10%中断容量
plot(SNR,C_mt_10(1,:),'g-*','LineWidth',2);
plot(SNR,C_mt_10(2,:),'g-p','LineWidth',2);
plot(SNR,C_mt_10(3,:),'g-h','LineWidth',2);
plot(SNR,C_mt_10(4,:),'g-v','LineWidth',2);
% %1%中断容量
% plot(SNR,C_mt_1(1,:),'g-*','LineWidth',2);
% plot(SNR,C_mt_1(2,:),'g-p','LineWidth',2);
% plot(SNR,C_mt_1(3,:),'g-h','LineWidth',2);
% plot(SNR,C_mt_1(4,:),'g-v','LineWidth',2);
xlabel('信噪比 \rho (dB)','FontSize',14);
ylabel('遍历容量与中断容量C(bit/s/Hz)','FontSize',14);
legend('遍历容量N_T=N_R=1','遍历容量N_T=N_R=2','遍历容量N_T=N_R=4','遍历容量N_T=N_R=6',...
       '中断容量N_T=N_R=1','中断容量N_T=N_R=2','中断容量N_T=N_R=4','中断容量N_T=N_R=6');  
hold off 

三、图片

对比图:
图片


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值