www.gusucode.com > ZBLAST算法仿真源码程序 > ZBLAST算法仿真源码程序/131014135Pro/vblastpic8.m

    % vblastpic8:MIMO channel capacity simulation2
%tx=4,rx=4

tx=4;rx=4;L=20;
EbN0=[0:1:20];
B=30000;Ts=1/24300;
SNR=EbN0-10*log10(Ts*B);
%SNR=[0:20];
H=sqrt(1/2)*(randn(rx,tx,L)+i*randn(rx,tx,L));
I=eye(tx);
C4=[];
for m=SNR
    snr=10.^(m/10);
    for t=[1:L]
        Q=H(:,:,t)'*H(:,:,t);
        temp(t)=log2(det(I+snr*Q));
    end
    temp=mean(abs(temp));
    C4=[C4 temp];
end
figure
plot(EbN0,C4,'o- b')

% tx=3,rx=3

tx=3;rx=3;
H=sqrt(1/2)*(randn(rx,tx,L)+i*randn(rx,tx,L));
I=eye(tx);
C3=[];
for m=SNR
    snr=10.^(m/10);
    for t=[1:L]
        Q=H(:,:,t)'*H(:,:,t);
        temp(t)=log2(det(I+snr*Q));
    end
    temp=mean(abs(temp));
    C3=[C3 temp];
end
hold on
plot(EbN0,C3,'x- r')

% tx=2,rx=2

tx=2;rx=2;
H=sqrt(1/2)*(randn(rx,tx,L)+i*randn(rx,tx,L));
I=eye(tx);
C2=[];
for m=SNR
    snr=10.^(m/10);
    for t=[1:L]
        Q=H(:,:,t)'*H(:,:,t);
        temp(t)=log2(det(I+snr*Q));
    end
    temp=mean(abs(temp));
    C2=[C2 temp];
end
hold on
plot(EbN0,C2,'s- k')

%tx=1,rx=1
tx=1;rx=1;
H=sqrt(1/2)*(randn(rx,tx,L)+i*randn(rx,tx,L));
I=eye(tx);
C1=[];
for m=SNR
    snr=10.^(m/10);
    for t=[1:L]
        Q=H(:,:,t)'*H(:,:,t);
        temp(t)=log2(det(I+snr*Q));
    end
    temp=mean(abs(temp));
    C1=[C1 temp];
end
hold on
plot(EbN0,C1,'*- m')

% 标注

grid on
legend('tx=4,rx=4','tx=3,rx=3','tx=2,rx=2','tx=1,rx=1')
xlabel('EbN0(dB)')
ylabel('信道容量(bit/S/Hz)')
title('MIMO信道容量和收发天线数量的关系')