资源描述:
《瑞利衰落信道下采用MRC分集误码性能Matlab程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、%MRC_scheme.m%Receiverdiversity-MRC%MIMO-OFDMWirelessCommunicationswithMATLAB㈢YongSooCho,JaekwonKim,WonYoungYangandChungG.Kang%?2010JohnWiley&Sons(Asia)PteLtdclear,clfL_frame=130;N_packet=4000;b=3;%Setto1/2/3/4forBPSK/QPSK/16QAM/64QAMSNRdBs=[0:2:20];s
2、q2=sqrt(2);%SNRdBs=[0:10:20];sq2=sqrt(2);foriter=1:3ifiter==1,NT=1;NR=1;gs='-kx';%SISOelseifiter==2,NT=1;NR=2;gs='-^';%NumbersofTx/RxantennaselseNT=1;NR=4;gs='-ro';%endsq_NT=sqrt(NT);fori_SNR=1:length(SNRdBs)SNRdB=SNRdBs(i_SNR);sigma=sqrt(0.5/(10^(SNR
3、dB/10)));fori_packet=1:N_packetsymbol_data=randint(L_frame*b,NT);[temp,sym_tab,P]=modulator(symbol_data.',b);X=temp.';%frlg=length(X);Hr=(randn(L_frame,NR)+j*randn(L_frame,NR))/sq2;H=reshape(Hr,L_frame,NR);Habs=sum(abs(H).^2,2);Z=0;fori=1:NRR(:,i)=sum
4、(H(:,i).*X,2)/sq_NT+sigma*(randn(L_frame,1)+j*randn(L_frame,1));Z=Z+R(:,i).*conj(H(:,i));endform=1:Pd1(:,m)=abs(sum(Z,2)-sym_tab(m)).^2+(-1+sum(Habs,2))*abs(sym_tab(m))^2;end[y1,i1]=min(d1,[],2);Xd=sym_tab(i1).';temp1=X>0;temp2=Xd>0;noeb_p(i_packet)=s
5、um(sum(temp1~=temp2));endBER(iter,i_SNR)=sum(noeb_p)/(N_packet*L_frame*b);end%endofFORloopforSNRsemilogy(SNRdBs,BER(iter,:),gs),holdon,axis([SNRdBs([1end])1e-61e0])endtitle('BERperfoemancdeofMRCScheme'),xlabel('SNR[dB]'),ylabel('BER')gridon,set(gca,'f
6、ontsize',9)legend('SISO','MRC(Tx:1,Rx:2)','MRC(Tx:1,Rx:4)')function[mod_symbols,sym_table,M]=modulator(bitseq,b)%MIMO-OFDMWirelessCommunicationswithMATLAB㈢YongSooCho,JaekwonKim,WonYoungYangandChungG.Kang%?2010JohnWiley&Sons(Asia)PteLtdN_bits=length(bi
7、tseq);ifb==1%BPSKmodulationsym_table=exp(j*[0-pi]);sym_table=sym_table([10]+1);inp=bitseq;mod_symbols=sym_table(inp+1);M=2;elseifb==2%QPSKmodulationsym_table=exp(j*pi/4*[-331-1]);sym_table=sym_table([0132]+1);inp=reshape(bitseq,b,N_bits/b);mod_symbols
8、=sym_table([21]*inp+1);M=4;elseifb==3%generates8PSKsymbolssym_table=exp(j*pi/4*[0:7]);sym_table=sym_table([01326754]+1);inp=reshape(bitseq,b,N_bits/b);mod_symbols=sym_table([421]*inp+1);M=8;elseifb==4%16-QAMmodulationm=0;sq10=sqrt(10);fork=-3: