matlab大作业1

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

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

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

资源描述

基于基于MATLABMATLAB的通信系统仿真的通信系统仿真专业:电子与通信工程学号:姓名:成绩:日期:目录基于Matlab的通信系统仿真··················································································3系统综述·······························································································3结构框图·····································································错误!未定义书签。系统实现···········································································错误!未定义书签。随机信号的生成······················································································3星座图映射····························································································4插值·····································································································6波形成形(平方根升余弦滤波器)······························································610倍载波调制························································································8加入高斯白噪声······················································································9匹配滤波器···························································································10采样····································································································13判决解调······························································································14误码率曲线···························································································15整体程序构架························································································17讨论··········································································································18信噪比修正···························································································18仿真曲线······························································································18仿真终止条件························································································19升余弦滤波器························································································19主要代码------------------------------------------------------------------------------------------------23基于基于matlabmatlab的通信系统仿真的通信系统仿真系统综述利用Matlab仿真软件,完成如图1所示的一个基本的数字通信系统。信号源产生0、1等概分布的随机信号,映射到16QAM的星座图上,同时一路信号已经被分成了实部和虚部,后边的处理建立在这两路信号的基础上。实部、虚部信号分别经过平方根升余弦滤波器,再加入高斯白噪声,然后通过匹配滤波器(平方根升余弦滤波器)。最后经过采样,判决,得到0、1信号,同原信号进行比较,给出16QAM数字系统的误码。结构框图图1待构建系统的框图系统实现随机信号的生成利用Matlab中自带的函数randsrc来产生0、1等概分布的随机信号。源代码如下所示:%====定义待仿真序列的维数NglobalNN=320;%====定义产生‘1’的概率为pglobalpp=0.5;%==============================%首先产生随机二进制序列source=randsrc(1,N,[1,0;p,1-p]);0、1等概分布的随机信号如图2所示。05101520253035404550-0.500.511.501等概分布的信号信号幅度图20、1等概分布的随机信号波形图星座图映射将等概分布的0、1信号映射到16QAM星座图上。每四个bit构成一个码子,具体实现的方法是,将输入的信号进行串并转换分成两路,分别叫做I路和Q路。再把每一路的信号分别按照两位格雷码的规则进行映射,这样实际上最终得到了四位格雷码。为了清楚说明,参看表1:表1两位格雷码的映射规律两位0、1码映射后(按格雷码)00-301-1111103源代码如下所示:function[y1,y2]=Qam_modulation(x)%QAM_modulation%==============================%对产生的二进制序列进行QAM调制%=====首先进行串并转换,将原二进制序列转换成两路信号N=length(x);a=1:2:N;y1=x(a);y2=x(a+1);%=====分别对两路信号进行QPSK调制%======对两路信号分别进行2-4电平变换a=1:2:N/2;temp1=y1(a);temp2=y1(a+1);y11=temp1*2+temp2;temp1=y2(a);temp2=y2(a+1);y22=temp1*2+temp2;%=======对两路信号分别进行相位调制a=1:N/4;y1=(y11*2-1-4)*1.*cos(2*pi*a);y2=(y22*2-1-4)*1.*cos(2*pi*a);%========按照格雷码的规则进行映射y1(find(y11==0))=-3;y1(find(y11==1))=-1;y1(find(y11==3))=1;y1(find(y11==2))=3;y2(find(y22==0))=-3;y2(find(y22==1))=-1;y2(find(y22==3))=1;y2(find(y22==2))=3;得到的星座图如图3所示,图上注明了每一个点对应的01序列。-5-4-3-2-1012345-5-4-3-2-101234516QAM星座图(0000)(0010)(1010)(1000)(1001)(1011)(0011)(0001)(0101)(0100)(0110)(1110)(1111)(0111)(1110)(1101)图316QAM星座图从上边的星座图上可以清楚的看到,任意相邻的两个点之间它们对应的4个bit中只有一个有差别,也就是格雷码的特点。而采用格雷码主要目的是当信噪比较大时,也就是系统的误码率比较低的情况下,当出现一个符号错误的情况下,往往只是这个符号中的一个bit位出现了误码,因此这个情况下误码率和误bit率是4:1,这一特性在后边的误码率计算的过程中会有应用。插值为了能够模拟高斯白噪声的宽频谱特性,以及为了能够显示波形生成器(平方根升余弦滤波器)的效果,所以在原始信号中间添加一些0点。具体实现是分别在信号的I路和Q路中,任意相邻的两个码字之间添加7个0。源代码如下所示:functiony=insert_value(x,ratio)%===============================%x是待插值的序列,ratio是插值的比例。%两路信号进行插值%首先产生一个长度等于ratio倍原信号长度的零向量y=zeros(1,ratio*length(x));%再把原信号放在对应的位置a=1:ratio:length(y);y(a)=x;对I路和Q路信号进行插值后的波形图如图4所示。01020304050607080-4-2024虚部信号01020304050607080-4-2024实部信号两路信号的波形图图4经过插值后的两路信号波形图波形成形(平方根升余弦滤波器)为了避免相邻传输信号之间的串扰,多元符号需要有合适的信号波形。图1中的方波是在本地数字信号处理时常见的波形,但在实际传输时这种方波并不合适。根据奈奎斯特第一准则,在实际通信系统中一般均使接收波形为升余弦滚降信号。这一过程由发送端的基带成形滤波器和接收端的匹配滤波器两个环节共同实现,因此每个环节均为平方根升余弦滚降滤波,两个环节合成就实现了一个升余弦滚降滤波。实现平方根升余弦滚降信号的过程称为“波形成形”,通过采用合适的滤波器对多元码流进行滤波实现,由于生成的是基带信号,因此这一过程又称“基带成形滤波”。平方根升余弦滤波器的冲激响应基带平方根升余弦滤波器具有以下定义的理论函数0)()||(2sin2121)(1)(21fHffffHfHNN)1(||)1(||)1()1(||fffffff当当当其中:221ssNRTf是奈奎斯特平率,是滚降系数。下面给出平方根升余弦滤波器的冲激响应曲线,如图5所示。051015202530354045-0.100.10.20.30.40.50.6n(samples)Amplitude平方根升余弦滤波器的冲激响应图5平方根升余弦滤波器的冲激响应曲线从上图上不难看出来,平方根升余弦滤波器的冲激响应很显然的引入了符号间干扰(ISI)即它的冲激响应在相邻的抽样点上的值并不象升余弦滤波器那样恒为0。然而造成这一后果的原因在于,当我们引入平方根升余弦滤波器的时候,就是认为整个信道,也就是说,包括信号发送端的滤波器和信号接收端的滤波器,总体的效果是避免了符号间干扰(ISI),所以,单独看这每一个滤波器,勿庸置疑,它们都是存在着符号间干扰(ISI)的。经过平方根升余弦滤波器后的信号I路和Q路信号经过平方根升余弦滤波器后,成形后的波形如图6所示。源代码如下%x1、x2是两路输入信号,fd是信号信息位的频率,fs是信号的采样频率function[y1,y2]=rise_cos(x1,x2,fd,fs)%生成平方根升余弦滤波器[yf,tf]=rcosine(fd,fs,'fir/sqr

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

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

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

×
保存成功