《QDPSK理论误码率与实际误码率matlab仿真程序(共2页).docx》由会员分享,可在线阅读,更多相关《QDPSK理论误码率与实际误码率matlab仿真程序(共2页).docx(2页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上%dpsk格雷码矩形%等效基带调制clc;clear all;close all;%关闭所有窗口,比如之前画的图nsymbol = 1e6;%每种信噪比下符号数的发送符号数,106个数errornumber = zeros(1,10);errorratio = zeros(1,10);dataa = randi(0,1,1,2*nsymbol);%产生1行,2*nsymbol列均匀分布的随机数datab = zeros(1,2*nsymbol);data_mod1 = zeros(1,nsymbol);%各参量初始化data_mod2 = zeros(1,nsymbo
2、l);data_demod1 = zeros(1,nsymbol);data_demod2 = zeros(1,nsymbol);s_receive1 = zeros(1,nsymbol);s_receive2 = zeros(1,nsymbol);datab_receive = zeros(1,2*nsymbol);dataa_receive = zeros(1,2*nsymbol);datab(1) = xor(0,dataa(1);%给定初始相位for l = 2:(2*nsymbol)%逻辑运算 datab(l) = xor(dataa(l),datab(l-1);endfor i =
3、 1:nsymbol %格雷码调制到星座图的映射 if datab(2*i-1)=0 & datab(2*i)=0 data_mod1(i) = 1; data_mod2(i) = 1; elseif datab(2*i-1)=0 & datab(2*i)=1 data_mod1(i) = -1; data_mod2(i) = 1; elseif datab(2*i-1)=1 & datab(2*i)=1 data_mod1(i) = -1; data_mod2(i) = -1; elseif datab(2*i-1)=1 & datab(2*i)=0 data_mod1(i) = 1; da
4、ta_mod2(i) = -1; endend SNR_dB = 1:10;%信噪比dB形式SNR = 10.(SNR_dB/10);%信噪比转化为线性值for loop= 1:10 sigma = sqrt(1/SNR(loop);%根据符号功率求噪声功率 s_receive1 = data_mod1+sigma * randn(1,length(data_mod1); s_receive2 = data_mod2+sigma * randn(1,length(data_mod2);%添加复高斯白噪声 for k = 1:nsymbol%反映射 if s_receive1(k)0 & s_r
5、eceive2(k)0 data_demod1(k) = 0; data_demod2(k) = 0; elseif s_receive1(k)0 data_demod1(k) = 0; data_demod2(k) = 1; elseif s_receive1(k)0 & s_receive2(k)0 & s_receive2(k)0 data_demod1(k) = 1; data_demod2(k) = 0; end datab_receive(2*k-1) = data_demod1(k); datab_receive(2*k) = data_demod2(k); end dataa_
6、receive(1) = xor(0,datab_receive(1); for n = 2:(2*nsymbol) dataa_receive(n) = xor(datab_receive(n),datab_receive(n-1); end for m = 1:nsymbol if (dataa_receive(2*m-1) = dataa(2*m-1)|(dataa_receive(2*m) = dataa_receive(2*m)%统计误码个数 errornumber(loop) = errornumber(loop)+1; end end errorratio(loop) = errornumber(loop)/nsymbol; %计算误码率end ser_theory = 1-(1-qfunc(sqrt(SNR).2;%理论误码率,注意Q函数和误差函数的对应关系semilogy(SNR_dB,errorratio,-k*,SNR_dB,ser_theory,-ro);title(DPSK信号在AWGN信道下的性能(格雷码));xlabel(信噪比/dB);ylabel(误码率);legend(误码率,理论误码率);grid on;%坐标线专心-专注-专业