QPSK系统的MonteCarlo仿真.doc

QPSK系统的MonteCarlo仿真.doc

QPSK系统的Monte Carlo仿真 实验目的 1. 提高独立学习的能力; 2. 学习Matlab使用; 3. 掌握4PSK通信系统的组成原理; 4.掌握4PSK通信系统的Monte Carlo仿真方法; 二、实验内容 完成对4PSK通信系统的差错概率的Monte Carlo仿真 三、实验框图及流程图 流程图见下页: 四、实验原理 四进制相位调制的一般表达式可以表示为: 为了后面便于计算取等于,按照书上的过程可以令 加入噪声后可以表示为 为了归一化,取,=。则可得的四个点分别为 即每个比特的能量为1。这和二进制的双极性的误码率是一样的,即,其中=1,. 五、实验程序 1. function[pb,ps]=cm_sm32(snr_in_dB,N) E=1; snr=10^(snr_in_dB/10); sgma=sqrt(E/snr)/2; s00=[1 0]; s01=[0 1]; s11=[-1 0]; s10=[0 -1]; %generation of the data source 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; dsource2(i)=1; end; end; %detection and the probability of error calculation numofsymbolerror=0; numofbiterror=0; for i=1:N; %the received signal at the detector,for the ith symbol,is: n(1)=gngauss(sgma); n(2)=gngauss(sgma); 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; %the correlation metrics are computed below% c00=dot(r,s00); c01=dot(r,s01); c10=dot(r,s10); c11=dot(r,s11); %the decision on the ith symbol is made next 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; %increment the error counter,if the decision is not correct 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); 2.高斯噪声 function [gsrv1,gsrv2]=gngauss(m,sgma) if nargin==0, m=0;sgma=1; elseif nargin==1, sgma=m;m=0; end u=rand; z=sgma*(sqrt(2*log(1/(1-u)))); u=rand; gsrv1=m+z*cos(2*pi*u); gs

文档评论(0)

1亿VIP精品文档

相关文档