• 知乎
    了解作者
  • matlab
    开发工具
  • 1KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 5
    下载次数
  • 2018-11-09 11:25
    上传日期
此程序验证了MIMO 4x4 MLD的BER特性。
MIMO44_MLD.zip
  • MIMO44_MLD.m
    3.5KB
内容介绍
%****************22MIMO Nulling****************************** %*****************2008-9-2***************************** clear,clc Tx=2; Rx=2; maxbit=2048; N=1; M=8; path=M-N+1;%Numder of path length=maxbit/2; mini_err=100000; mini_packet=1000; criterion=0; error=0; skip=5; trate=2; bitr=1*N/M; % sn=0; %//////////////////////SN LOOP////////////////////////// for sn=0:skip:30; %/////////////////////////////////////////////////////// snr=10^(sn/10); sd=sqrt(Tx*0.5/(snr*trate)); error=0; cnt=0; while(error<=mini_err&&cnt<=mini_packet) % Error Control cnt=cnt+1; %****************H Matrix************************ r1=1/sqrt(2.0); dur=0;%Ratio of DU % ch h11 h12 h21 h22 for ch=1:Tx*Rx gsum(ch)=0; for k=1:path pr(ch,k) = (1.0)*sqrt(-log(rand));%rand swing prc(ch,k)=pr(ch,k)*exp((2*pi*rand*j)); ga(ch,k)=10^(-dur*(k-1)/20.0);%%dB transformation gsum(ch) = gsum(ch) + abs(ga(ch,k))^2; end for k=1:path ga(ch,k) = ga(ch,k)/sqrt(gsum(ch))*prc(ch,k); end end for k=1:path h(:,:,k)=reshape(ga(:,k),Rx,Tx); end h_Lpath=h(:,:,path); for k=path-1:-1:1 h_Lpath=[h_Lpath;h(:,:,k)]; end h_Lpath; h_baseclum=[h_Lpath;zeros((N-1)*Rx,Tx)]; for i=2:N h_colum(:,:,i)=[zeros((i-1)*Rx,Tx);h_Lpath;zeros((N-i)*Rx,Tx)]; h_baseclum=[h_baseclum,h_colum(:,:,i)]; end H_path=h_baseclum; h1=H_path(1:2,:); h2=H_path(3:4,:); h3=H_path(5:6,:); h4=H_path(7:8,:); h5=H_path(9:10,:); h6=H_path(11:12,:); h=h1+h2+h3+h4+h5+h6; %*****************TRANSMIT SIGNAL VECTORS***************** ip = (2*(rand(Tx,length)>0.5)-1) + j*(2*(rand(Tx,length)>0.5)-1); % QPSK signal generation s = (1/sqrt(2))*ip; % normalization of energy to 1 ss=reshape(s,1,Tx*length); %*******************Receiver *********************** y1(1,:)=h1(1,1:Rx)*s(1:Tx,:); y1(2,:)=h1(2,1:Rx)*s(1:Tx,:); y2(1,:)=h2(1,1:Rx)*s(1:Tx,:); y2(2,:)=h2(2,1:Rx)*s(1:Tx,:); y3(1,:)=h3(1,1:Rx)*s(1:Tx,:); y3(2,:)=h3(2,1:Rx)*s(1:Tx,:); y4(1,:)=h4(1,1:Rx)*s(1:Tx,:); y4(2,:)=h4(2,1:Rx)*s(1:Tx,:); y5(1,:)=h5(1,1:Rx)*s(1:Tx,:); y5(2,:)=h5(2,1:Rx)*s(1:Tx,:); y6(1,:)=h6(1,1:Rx)*s(1:Tx,:); y6(2,:)=h6(2,1:Rx)*s(1:Tx,:); y(1,:)=y1(1,:)+y2(1,:)+y3(1,:)+y4(1,:)+y5(1,:)+y6(1,:)+sd*(randn+j*randn); y(2,:)=y1(2,:)+y2(2,:)+y3(2,:)+y4(2,:)+y5(2,:)+y6(2,:)+sd*(randn+j*randn); %*************MLD********************************* rep_matr=zeros(Tx,4^Rx); for k=1:Rx for l=1:4 switch l case 1 sb=r1*(1+j); case 2 sb=r1*(1-j); case 3 sb=r1*(-1+j); case 4 sb=r1*(-1-j); end raw1=ones(1,4^(k-1))*sb; if(l==1) raw=raw1; else raw=[raw,raw1]; end end rep_matr(k,1:4^Rx)=repmat(raw,1,4^(Rx-k)); end repmat_y=h*rep_matr;%レプリカ生成 %********Min(||y-Hs||^2)********************* for i=1:length for k=1:4^Rx %ユークリット距離最小のものを推定結果とする。 mse(k)=sum(abs(y(:,i)-repmat_y(:,k)).^2); end [minvalue,index]=min(mse); if (i==1) detec_x=rep_matr(:,index); else detec_x=[detec_x,rep_matr(:,index)]; end end xx=reshape(detec_x,1,Tx*length); % counting the errors error= error+size(find([real(ss)-real(xx)]),2)+size(find([imag(ss)-imag(xx)]),2); end % end of while %===================================================================== % BER %===================================================================== BER(sn/skip+1,1)=error/(Tx*maxbit*cnt); sn,BER if(BER(sn/skip+1,1)<=1.e-5) break; end end % END OF SN
评论
    相关推荐