【matlab代做编程】MIMO

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

hslogic.comclear;clc;nt_V=[24];nr_V=[24];N0=1e-4;B=1;Iteration=1e4;SNR_V_db=[-10:3:20];SNR_V=10.^(SNR_V_db/10);color=['b';'r'];notation=['-o';'-'];for(k=1:2)nt=nt_V(k);nr=nr_V(k);for(i=1:length(SNR_V))Pt=N0*SNR_V(i);for(j=1:Iteration)H=random('rayleigh',1,nr,nt);[SVD]=svd(H);landas(:,j)=diag(V);[Capacity(i,j)PowerAllo]=WaterFilling_alg(Pt,landas(:,j),B,N0);endendf1=figure(1);holdonplot(SNR_V_db,mean(Capacity'),notation(k,:),'color',color(k,:))holdon[y,x]=hist(reshape(landas,[1,min(nt,nr)*Iteration]),100);plot(x,y/Iteration,'color',color(k,:));clearlandasendf1=figure(1)legend_str=[];for(i=1:length(nt_V))legend_str=[legend_str;...{['nt=',num2str(nt_V(i)),',nr=',num2str(nr_V(i))]}];endlegend(legend_str)hslogic.comgridonset(f1,'color',[111])xlabel('SNRindB')ylabel('信道容量/s/Hz')function[CapacityPowerAllo]=WaterFilling_alg(PtotA,ChA,B,N0);ChA=ChA+eps;NA=length(ChA);H=ChA.^2/(B*N0);PowerAllo=(PtotA+sum(1./H))/NA-1./H;while(length(find(PowerAllo0))0)IndexN=find(PowerAllo=0);IndexP=find(PowerAllo0);MP=length(IndexP);PowerAllo(IndexN)=0;ChAT=ChA(IndexP);HT=ChAT.^2/(B*N0);PowerAlloT=(PtotA+sum(1./HT))/MP-1./HT;PowerAllo(IndexP)=PowerAlloT;endPowerAllo=PowerAllo.';Capacity=sum(log2(1+PowerAllo.'.*H));

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功