www.gusucode.com > ZBLAST算法仿真源码程序 > ZBLAST算法仿真源码程序/131014135Pro/vblastpic4.m
% MIMO channel capacity simulation tx=4;rx=4;L=500; %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/tx*Q)); end temp=mean(abs(temp)); C4=[C4 temp]; end figure plot(SNR,C4,'o- b') % tx=3 tx=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/tx*Q)); end temp=mean(abs(temp)); C3=[C3 temp]; end hold on plot(SNR,C3,'x- r') % tx=2 tx=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/tx*Q)); end temp=mean(abs(temp)); C2=[C2 temp]; end hold on plot(SNR,C2,'s- k') %tx=1 tx=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(SNR,C1,'p- g') %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(SNR,C1,'*- m') % 标注 grid on legend('tx=4,rx=4','tx=3,rx=4','tx=2,rx=4','tx=1,rx=4','tx=1rx=1') xlabel('SNR(dB)') ylabel('信道容量(bit/S/Hz)') title('MIMO信道容量和收发天线数量的关系')