欢迎来到天天文库
浏览记录
ID:50510373
大小:91.07 KB
页数:5页
时间:2020-03-06
《QAM理论误码率与实际误码率MATLAB仿真程序.pdf》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、%%16QAM%%等效基带调制clc;clearall;closeall;%%关闭所有窗口,比如之前画的图nsymbol=10000;%%每种信噪比下符号数的发送符号数,10^6个数errornumber=zeros(1,10);errorratio=zeros(1,10);data=randi([0,1],1,4*nsymbol);%%产生1行,4*nsymbol列均匀分布的随机数data_mod1=zeros(1,nsymbol);%%各参量初始化data_mod2=zeros(1,nsymbol);data_demod1=zeros(1,nsymbol);data_demod2=zer
2、os(1,nsymbol);data_demod3=zeros(1,nsymbol);data_demod4=zeros(1,nsymbol);s_receive1=zeros(1,nsymbol);s_receive2=zeros(1,nsymbol);fori=1:nsymbol%%格雷码调制到星座图的映射ifdata(4*i-3)==0&&data(4*i-2)==0data_mod1(i)=3;ifdata(4*i-1)==0&&data(4*i)==0data_mod2(i)=3;elseifdata(4*i-1)==0&&data(4*i)==1data_mod2(i)=1;el
3、seifdata(4*i-1)==1&&data(4*i)==1data_mod2(i)=-1;elseifdata(4*i-1)==1&&data(4*i)==0data_mod2(i)=-3;endelseifdata(4*i-3)==0&&data(4*i-2)==1data_mod1(i)=1;ifdata(4*i-1)==0&&data(4*i)==0data_mod2(i)=3;elseifdata(4*i-1)==0&&data(4*i)==1data_mod2(i)=1;elseifdata(4*i-1)==1&&data(4*i)==1data_mod2(i)=-1;els
4、eifdata(4*i-1)==1&&data(4*i)==0data_mod2(i)=-3;endelseifdata(4*i-3)==1&&data(4*i-2)==1data_mod1(i)=-1;ifdata(4*i-1)==0&&data(4*i)==0data_mod2(i)=3;elseifdata(4*i-1)==0&&data(4*i)==1data_mod2(i)=1;elseifdata(4*i-1)==1&&data(4*i)==1data_mod2(i)=-1;elseifdata(4*i-1)==1&&data(4*i)==0data_mod2(i)=-3;end
5、elseifdata(4*i-3)==1&&data(4*i-2)==0data_mod1(i)=-3;ifdata(4*i-1)==0&&data(4*i)==0data_mod2(i)=3;elseifdata(4*i-1)==0&&data(4*i)==1data_mod2(i)=1;elseifdata(4*i-1)==1&&data(4*i)==1data_mod2(i)=-1;elseifdata(4*i-1)==1&&data(4*i)==0data_mod2(i)=-3;endendendSNR_dB=1:10;%%%信噪比dB形式SNR=10.^(SNR_dB/10);%%
6、信噪比转化为线性值forloop=1:10sigma=sqrt(5/SNR(loop));s_receive1=data_mod1+sigma*randn(1,length(data_mod1));s_receive2=data_mod2+sigma*randn(1,length(data_mod2));%%??fork=1:nsymbolifs_receive1(k)>2data_demod1(k)=0;data_demod2(k)=0;ifs_receive2(k)>2data_demod3(k)=0;data_demod4(k)=0;elseifs_receive2(k)>0&&s_r
7、eceive2(k)<2data_demod3(k)=0;data_demod4(k)=1;elseifs_receive2(k)>-2&&s_receive2(k)<0data_demod3(k)=1;data_demod4(k)=1;elseifs_receive2(k)<-2data_demod3(k)=1;data_demod4(k)=0;endelseifs_receive1(k)>0&&s_rec
此文档下载收益归作者所有