相关对MIMO系统容量影响仿真

clear all;
close all;
clc
M=5000;
R=[0.2 0.95];%相关矩阵
SNR=[0:2:20];
figure;
xlabel('SNR[dB]','fontsize',18);
ylabel('容量(bps/Hz)','fontsize',18);
title('相关信道的容量比较','fontsize',18);
grid on;
hold on;
for l=1:length(R)
    R_t=eye(2);
    R_r=[1 R(l);R(l) 1];
    for snr_idx=1:length(SNR)
        snr=10^(SNR(snr_idx)/10);
        for m=1:M
            Hw=(randn(2,2)+1i*randn(2,2))/sqrt(2);
            H=R_r^(.5)*Hw*R_t^(.5);
            C(m,snr_idx)=log2((det(eye(2)+snr*H*H'/2)));
        end
        Capacity(snr_idx,l)=mean(C(:,snr_idx));
    end
end
plot(SNR,Capacity(:,1),'k-',SNR,Capacity(:,2),'kx-');
for l=1:length(R)
    R_t=eye(2);
    R_r=[1 R(l);R(l) 1];
    for snr_idx=1:length(SNR)
        snr=10^(SNR(snr_idx)/10);
        for m=1:M
            Hw=(randn(2,2)+1i*randn(2,2))/sqrt(2);
            H=R_r^(.5)*Hw*R_t^(.5);
            [gamma,eigs]=pwr_modes(H,snr);
            C(m,snr_idx)=sum(log2(real(1+eigs.*gamma*snr/2)));
        end
        Capacity(snr_idx,l)=mean(C(:,snr_idx));
    end
end
plot(SNR,Capacity(:,1),'k-.',SNR,Capacity(:,2),'kd-');
legend('R=0 CSI未知','R=0.95 CSI未知','R=0 CSI已知','R=0.95 CSI已知');
%计算gamma和奇异值子程序,子程序名称:pwr_modes.m
function [g,l]=pwr_modes(H,rho)
%输入参数:H为信道矩阵,rho为信噪比
%输出参数:g为gamma值,l为奇异值eigs
%这部分程序参看注水算法
N_tilde=size(H,1);
l_tilde=real(eig(H*H'));
l=l_tilde(find(l_tilde~=0));%返回矩阵或向量中非零元素的索引值
N=length(l);
mu=(N_tilde+sum(N_tilde./(rho*l)))/N;
g=mu-N_tilde./(rho*l);
while(length(find(g<=0))~=0)
    l=l(find(g>0));
    N=length(l);
    mu=(N_tilde+sum(N_tilde./(rho*l)))/N;
    g=mu-N_tilde./(rho*l);
end

在这里插入图片描述
参考《MIMO-OFDM系统原理、应用及仿真》一书