QPSK理论误码率与实际误码率MATLAB仿真程序

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

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

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

资源描述

%%QPSKclc;clearall;closeall;nsymbol=50000;%%每种信噪比下符号数的发送符号数data=randi([0,1],1,nsymbol*2);%%产生1行,nsymbol列均匀分布的随机数0,1qpsk_mod1=zeros(1,nsymbol);qpsk_mod2=zeros(1,nsymbol);data_receive1=zeros(1,nsymbol);data_receive2=zeros(1,nsymbol);data_receive=zeros(1,nsymbol*2);Wrongnumber=0;SymbolWrongnumber=0;fori=1:nsymbol%%调制symbol1=data(2*i-1);symbol2=data(2*i);ifsymbol1==0&symbol2==0qpsk_mod1(i)=1;qpsk_mod2(i)=0;elseifsymbol1==0&symbol2==1qpsk_mod1(i)=0;qpsk_mod2(i)=1;elseifsymbol1==1&symbol2==1qpsk_mod1(i)=-1;qpsk_mod2(i)=0;elseifsymbol1==1&symbol2==0qpsk_mod1(i)=0;qpsk_mod2(i)=-1;endendSNR_dB=1:10;%%%信噪比dB形式SNR=10.^(SNR_dB/10);%%信噪比转化为线性值forloop=1:10sigma=sqrt(1/(2*SNR(loop)));%%%根据符号功率求噪声功率qpsk_receive1=qpsk_mod1+sigma*randn(1,nsymbol);qpsk_receive2=qpsk_mod2+sigma*randn(1,nsymbol);%%添加复高斯白噪声fork=1:nsymbolifqpsk_receive2(k)qpsk_receive1(k)data_receive2(k)=1;endifqpsk_receive2(k)qpsk_receive1(k)data_receive2(k)=0;endifqpsk_receive2(k)-qpsk_receive1(k)data_receive1(k)=0;endifqpsk_receive2(k)-qpsk_receive1(k)data_receive1(k)=1;enddata_receive(2*k-1)=data_receive1(k);data_receive(2*k)=data_receive2(k);endforp=1:(nsymbol*2)ifdata_receive(p)~=data(p)Wrongnumber=Wrongnumber+1;endendforl=1:nsymbolifdata_receive1(l)~=data(2*l-1);SymbolWrongnumber=SymbolWrongnumber+1;elseifdata_receive2(l)~=data(2*l);SymbolWrongnumber=SymbolWrongnumber+1;endendPe(loop)=SymbolWrongnumber/nsymbol;Pb(loop)=Wrongnumber/(nsymbol*2);Wrongnumber=0;SymbolWrongnumber=0;endPe_theory=1-(1-qfunc(sqrt(SNR))).^2;Pb_theory=0.5*erfc(sqrt(SNR/2));semilogy(SNR_dB,Pb,'-k*',SNR_dB,Pb_theory,'-bo',SNR_dB,Pe,'-r',SNR_dB,Pe_theory,'g')title('QPSK信号在AWGN信道下的性能');xlabel('信噪比/dB');ylabel('误码率');legend('误比特率','理论误比特率','误码率','理论误码率');gridon;

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

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

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

×
保存成功