《仿真高斯白噪声信道下QPSK的EbN0与误比特率之间的关系(11页).doc》由会员分享,可在线阅读,更多相关《仿真高斯白噪声信道下QPSK的EbN0与误比特率之间的关系(11页).doc(11页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、-QPSK调制与解调在MATLAB平台上的实现QPSK即四进制移向键控(Quaternary Phase Shift Keying),它利用载波的四种不同相位来表示数字信息,由于每一种载波相位代表两个比特信息,因此每个四进制码元可以用两个二进制码元的组合来表示。两个二进制码元中的前一个码元用a表示,后一个码元用b表示。 QPSK信号可以看作两个载波正交2PSK信号的合成,下图表示QPSK正交调制器。由QPSK信号的调制可知,对它的解调可以采用与2PSK信号类似的解调方法进行解调。解调原理图如下所示,同相支路和正交支路分别采用相干解调方式解调,得到和,经过抽样判决和并/串交换器,将上下支路得到的
2、并行数据恢复成串行数据。% 调相法clear allclose allt=-1:0.01:7-0.01;tt=length(t);x1=ones(1,800);for i=1:tt if (t(i)=-1 & t(i)=5& t(i)=0 & t1(i)=4& t1(i)0 data_recover_a(i:i+19)=1; bit_recover=bit_recover 1; else data_recover_a(i:i+19)=-1; bit_recover=bit_recover -1; endenderror=0;dd = -2*bit_in+1;ddd=dd;ddd1=repmat
3、(ddd,20,1);for i=1:2e4 ddd2(i)=ddd1(i);endfor i=1:1e3 if bit_recover(i)=ddd(i) error=error+1; endendp=error/1000;figure(1)subplot(2,1,1);plot(t2,ddd2);axis(0 100 -2 2);title(原序列);subplot(2,1,2);plot(t2,data_recover_a);axis(0 100 -2 2);title(解调后序列);效果图:% 设定 T=1, 不加噪声clear allclose all% 调制bit_in = ran
4、dint(1e3, 1, 0 1);bit_I = bit_in(1:2:1e3);bit_Q = bit_in(2:2:1e3);data_I = -2*bit_I+1;data_Q = -2*bit_Q+1;data_I1=repmat(data_I,20,1);data_Q1=repmat(data_Q,20,1);for i=1:1e4 data_I2(i)=data_I1(i); data_Q2(i)=data_Q1(i);end;t=0:0.1:1e3-0.1;f=0:0.1:1;xrc=0.5+0.5*cos(pi*f);data_I2_rc=conv(data_I2,xrc)/
5、5.5;data_Q2_rc=conv(data_Q2,xrc)/5.5;f1=1;t1=0:0.1:1e3+0.9;I_rc=data_I2_rc.*cos(2*pi*f1*t1);Q_rc=data_Q2_rc.*sin(2*pi*f1*t1);QPSK_rc=(sqrt(1/2).*I_rc+sqrt(1/2).*Q_rc);% 解调I_demo=QPSK_rc.*cos(2*pi*f1*t1);Q_demo=QPSK_rc.*sin(2*pi*f1*t1);I_recover=conv(I_demo,xrc);Q_recover=conv(Q_demo,xrc);I=I_recover
6、(11:10010);Q=Q_recover(11:10010);t2=0:0.05:1e3-0.05;t3=0:0.1:1e3-0.1;data_recover=;for i=1:20:10000 data_recover=data_recover I(i:1:i+19) Q(i:1:i+19);end;ddd = -2*bit_in+1;ddd1=repmat(ddd,10,1);for i=1:1e4 ddd2(i)=ddd1(i);endfigure(1)subplot(4,1,1);plot(t3,I);axis(0 20 -6 6);subplot(4,1,2);plot(t3,Q
7、);axis(0 20 -6 6);subplot(4,1,3);plot(t2,data_recover);axis(0 20 -6 6);subplot(4,1,4);plot(t,ddd2);axis(0 20 -6 6);效果图:% QPSK误码率分析SNRindB1=0:2:10;SNRindB2=0:0.1:10;for i=1:length(SNRindB1) pb,ps=cm_sm32(SNRindB1(i); smld_bit_err_prb(i)=pb; smld_symbol_err_prb(i)=ps;end;for i=1:length(SNRindB2) SNR=e
8、xp(SNRindB2(i)*log(10)/10); theo_err_prb(i)=Qfunct(sqrt(2*SNR);end;title(QPSK误码率分析);semilogy(SNRindB1,smld_bit_err_prb,*);axis(0 10 10e-8 1);hold on;% semilogy(SNRindB1,smld_symbol_err_prb,o);semilogy(SNRindB2,theo_err_prb);legend(仿真比特误码率,理论比特误码率);hold off;functiony=Qfunct(x)y=(1/2)*erfc(x/sqrt(2);f
9、unctionpb,ps=cm_sm32(SNRindB)N=10000;E=1;SNR=10(SNRindB/10);sgma=sqrt(E/SNR)/2;s00=1 0;s01=0 1;s11=-1 0;s10=0 -1;for i=1:N temp=rand; if (temp0.25) dsource1(i)=0; dsource2(i)=0; elseif (temp0.5) dsource1(i)=0; dsource2(i)=1; elseif (temp0.75) dsource1(i)=1; dsource2(i)=0; else dsource1(i)=1; dsource
10、2(i)=1; end;end;numofsymbolerror=0;numofbiterror=0;for i=1:N n=sgma*randn(size(s00); if(dsource1(i)=0)&(dsource2(i)=0) r=s00+n; elseif(dsource1(i)=0)&(dsource2(i)=1) r=s01+n; elseif(dsource1(i)=1)&(dsource2(i)=0) r=s10+n; else r=s11+n; end; c00=dot(r,s00); c01=dot(r,s01); c10=dot(r,s10); c11=dot(r,s
11、11); c_max=max(c00 c01 c10 c11); if (c00=c_max) decis1=0;decis2=0; elseif(c01=c_max) decis1=0;decis2=1; elseif(c10=c_max) decis1=1;decis2=0; else decis1=1;decis2=1; end; symbolerror=0; if(decis1=dsource1(i) numofbiterror=numofbiterror+1; symbolerror=1; end; if(decis2=dsource2(i) numofbiterror=numofbiterror+1; symbolerror=1; end; if(symbolerror=1) numofsymbolerror=numofsymbolerror+1; end;end;ps=numofsymbolerror/N;pb=numofbiterror/(2*N);效果图:-第 11 页-