DQPSk调制过程 解调过程 系统误码率 matlab程序
提 供 者: 海涛
- N_Trials=1000;
- N_number=100;
- N_snr=10;
- Q=16;
- BER_MATRIX=[];
- SER_MATRIX=[];
- for trials=1:N_Trials
- trials
- noise=randn(1,N_number/2)+j.*randn(1,N_number/2);
- s10=round(rand(1,N_number));
- s=(s10*2-1)/sqrt(2);
- sreal=s(1:2:N_number);
- simage=s(2:2:N_number);
- sc=sreal+j.*simage;
- sgma=1;
- Error_ber=[];
- Error_ser=[];
- for snr_db=0:1:N_snr
- snr=10.^(snr_db./10);
- N0=2*sgma.^2;
- Eb=snr*N0;
- Es=2*Eb;
- yy=sqrt(Es).*sc+noise;
- y_real=sign(real(yy))./sqrt(2);
- y_image=sign(imag(yy))./sqrt(2);
-
- d_bit=[];
- for k=1:length(y_real)
- d_bit=[d_bit,[y_real(k),y_image(k)]];
- end
- d_symbol=y_real+j.*y_image;
-
- dif_bit=s-d_bit;
- dif_symbol=sc-d_symbol;
-
- ber_snr=0;
- for k=1:N_number
- if dif_bit(k)~=0
- ber_snr=ber_snr+1;
- end
- end
- Error_ber=[Error_ber,ber_snr];
-
- ser_snr=0;
- for k=1:N_number/2
- if dif_symbol(k)~=0
- ser_snr=ser_snr+1;
- end
- end
- Error_ser=[Error_ser,ser_snr];
-
- %s_e=sign(y_real);
- %s_e10=(s_e+1)./2;
- %Error_snr=sum(abs(s10-s_e10));
- %Error_v=[Error_v,Error_snr];
- end
- BER_MATRIX=[BER_MATRIX;Error_ber] ;
- SER_MATRIX=[SER_MATRIX;Error_ser];
- end
- BER_sum=mean(BER_MATRIX);
- BER=BER_sum./N_number;
- SER_sum=mean(SER_MATRIX);
- SER=SER_sum./(N_number./2);
-
- BER_T=[];
- SER_T=[];
- for snr_db=0:1:N_snr
- snr=10.^(snr_db./10);
- BER_THEROY=Qfunct(sqrt(2.*snr));
- SER_THEROY=1-(1-0.5.*erfc(sqrt(snr))).^2;
- BER_T=[BER_T,BER_THEROY];
- SER_T=[SER_T,SER_THEROY];
- end
- i=0:1:10;
- semilogy(i,BER,'-r',i,BER_T ,'*g',i,SER,'.c',i,SER_T,':k');
复制代码
- function[y]=Qfunct(x);
- y=(1/2)*erfc(x/sqrt(2));
复制代码 |