




已阅读5页,还剩8页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
多幅度电平信号差错率仿真设计一、设计任务 完成多幅度电平信号差错率的仿真,运用MATLAB语言,仿真它们的误码性能,并与理论误码曲线相比较。先产生多组符号序列,再将符号序列映射到对应的幅度电平上,以四电平为例,先产生一个四组符号的序列,将该序列映射到对应的幅度电平上。随机变量信道中的加性噪声可以认为是统计独立,均值为0的高斯分量,分别作出二、四、八、十六电平仿真得到的误码率曲线与和理论上的误码率曲线。二、物理模型 多幅度电平信号仿真系统模型如下图所示:图1 3、 预期目标 通过以上的物理模型,作出二、四、八、十六电平信号仿真得到的误码率曲线与和理论上的误码率曲线。四、系统中所涉及的公式如下:1、平均比特SNR定义为: 即可得: 二电平时平均比特SNR为: 四电平时平均比特SNR为: 八电平时平均比特SNR为: 十六电平时平均比特SNR为: 2、M电平PAM系统最佳检测器的差错概率为: 其中:五、仿真结果图2六、源程序代码main_plot.m%主程序源代码,调用其他5个函数得出仿真结果图clear;clc;echo off;close all;% 二电平单极性SNR_in_dB1=0:1:17;SNR_in_dB2=0:0.1:16;for i=1:length(SNR_in_dB1) smld_err_prb21(i)=smldPe21(SNR_in_dB1(i); %实测差错概率 end;for i=1:length(SNR_in_dB2) SNR=exp(SNR_in_dB2(i)*log(10)/10); %信噪比换算成真值 theo_err_prb21(i)=1/2*erfc(sqrt(SNR/4); %理论差错概率计算 endsemilogy(SNR_in_dB1,smld_err_prb21,blueO); %实测差错概率结果图hold on;semilogy(SNR_in_dB2,theo_err_prb21,blue); %理论差错概率结果图hold on; % 二电平双极性SNR_in_dB3=0:1:11;SNR_in_dB4=0:0.1:10;for i=1:length(SNR_in_dB3) smld_err_prb22(i)=smldPe22(SNR_in_dB3(i); %实测差错概率 end;for i=1:length(SNR_in_dB4) SNR=exp(SNR_in_dB4(i)*log(10)/10); %信噪比换算成真值 theo_err_prb22(i)=1/2*erfc(sqrt(SNR); %理论差错概率计算 end;semilogy(SNR_in_dB3,smld_err_prb22,blackX); %实测差错概率结果图hold on;semilogy(SNR_in_dB4,theo_err_prb22,black); %理论差错概率结果图hold on; % 四电平双极性SNR_in_dB5=0:1:16;SNR_in_dB6=0:0.1:14;for i=1:length(SNR_in_dB5) smld_err_prb42(i)=smldPe42(SNR_in_dB5(i); %实测差错概率 end;for i=1:length(SNR_in_dB6) SNR_per_bit=exp(SNR_in_dB6(i)*log(10)/10); theo_err_prb42(i)=3/4*erfc(sqrt(2/5*SNR_per_bit); %理论差错概率计算 end;semilogy(SNR_in_dB5,smld_err_prb42,red.);hold on;semilogy(SNR_in_dB6,theo_err_prb42,red);hold on; % 八电平双极性SNR_in_dB7=0:1:19;SNR_in_dB8=0:0.1:19;for i=1:length(SNR_in_dB7) smld_err_prb82(i)=smldPe82(SNR_in_dB7(i); %实测差错概率 end;for i=1:length(SNR_in_dB8) SNR_per_bit=exp(SNR_in_dB8(i)*log(10)/10); theo_err_prb82(i)=7/8*erfc(sqrt(9/63*SNR_per_bit); %理论差错概率计算 end;semilogy(SNR_in_dB7,smld_err_prb82,green*);hold on;semilogy(SNR_in_dB8,theo_err_prb82,green);hold on;% 十六电平双极性SNR_in_dB9=0:1:19;SNR_in_dB10=0:0.1:19;for i=1:length(SNR_in_dB9) smld_err_prb162(i)=smldPe162(SNR_in_dB9(i); %理论差错概率计算 end;for i=1:length(SNR_in_dB10) SNR_per_bit=exp(SNR_in_dB10(i)*log(10)/10); theo_err_prb162(i)=15/16*erfc(sqrt(4/85*SNR_per_bit); %理论差错概率计算 end;semilogy(SNR_in_dB9,smld_err_prb162,yellowP);hold on;semilogy(SNR_in_dB10,theo_err_prb162,yellow);hold on;xlabel(SNR in dB); ylabel(Pe);title(多幅度电平信号仿真结果与理论值比较);legend(二电平单极性实测值,二电平单极性理论值,二电平双极性实测值,二电平双极性理论值,. 四电平实测值,四电平理论值,八电平实测值,八电平理论值,十六电平实测值,十六电平理论值);gngauss.m%产生高斯白噪声function gsrv1,gsrv2=gngauss(m,sgma) if nargin = 0, %如果没有输入实参,则均方为0,标准差为1 m=0; sgma=1;elseif nargin = 1, %如果输入实参为1个参数,则标准差为输入实参,均值为0 sgma=m; m=0;end;u=rand; z=sgma*(sqrt(2*log(1/(1-u); u=rand; gsrv1=m+z*cos(2*pi*u);gsrv2=m+z*sin(2*pi*u);smldPe21.m% 通过已知的信噪比求出二电平单极性映射下的实测差错概率function p=smldPe21(snr_in_dB)E=1;SNR=exp(snr_in_dB*log(10)/10); %信噪比单位换算sgma=E/sqrt(2*SNR); % sigma, 噪声的标准差N=10000;% 生成二进制数据for i=1:N, temp=rand; % 生成在0-1之间的独立随机数 if (temp0.5), dsource(i)=0; % 1/2的概率输出为0 else dsource(i)=1; % 1/2的概率输出为1 endend;% 判决及差错概率的计算numoferr=0;for i=1:N, % 映射到电平 if (dsource(i)=0), r=gngauss(sgma); % 输出为0 else r=E+gngauss(sgma); % 输出为1 end; % 判决 if (rE/2), decis=0; % 判决为0 else decis=1; % 判决为1 end; if (decis=dsource(i), % 如果误判计数器加1 numoferr=numoferr+1; end;end;p=numoferr/N; % 差错概率估计smldPe22.m% 通过已知的信噪比求出二电平双极性映射下的实测差错概率function p=smldPe22(snr_in_dB)E=1;SNR=exp(snr_in_dB*log(10)/10); sgma=E/sqrt(2*SNR); % sigma, 噪声的标准差N=10000;for i=1:N, temp=rand; if (temp0.5), dsource(i)=-1; % 1/2的概率输出为-1 else dsource(i)=1; % 1/2的概率输出为1 endend;% 判决及差错概率的计算numoferr=0;for i=1:N, if (dsource(i)=-1), r=-E+gngauss(sgma); else r=E+gngauss(sgma); end; if (r0), decis=-1; else decis=1; end; if (decis=dsource(i), numoferr=numoferr+1; end;end;p=numoferr/N; % 差错概率估计smldPe42.m% 通过已知的信噪比求出四电平双极性映射下的实测差错概率function p=smldPe42(snr_in_dB)d=1;SNR=exp(snr_in_dB*log(10)/10); sgma=sqrt(5*d2)/(4*SNR); N=10000;for i=1:N, temp=rand; if (temp0.25), dsource(i)=-3; %1/4的概率输出为00 elseif (temp0.5), dsource(i)=-1; %1/4的概率输出为01 elseif (temp0.75), dsource(i)=1; %1/4的概率输出为10 else dsource(i)=3; %1/4的概率输出为11 endend;numoferr=0;for i=1:N, if (dsource(i)=-3), r=-3+gngauss(sgma); %信源输出为00 elseif(dsource(i)=-1), r=-1+gngauss(sgma); %信源输出为01 elseif(dsource(i)=1), r=1+gngauss(sgma); %信源输出为10 elseif(dsource(i)=3), r=3+gngauss(sgma); %信源输出为11 end; % 判决 if (r-2*d), decis=-3; elseif (r-0), decis=-1; elseif (r2*d), decis=1; else decis=3; end; if (decis=dsource(i), % 误码检测 numoferr=numoferr+1; end;end;p=numoferr/N; % 差错概率估计计算smldPe82.m% 通过已知的信噪比求出八电平双极性映射下的实测差错概率function p=smldPe82(snr_in_dB)d=1;SNR=exp(snr_in_dB*log(10)/10); sgma=sqrt(21*d2)/(6*SNR); N=10000;for i=1:N, temp=rand; if (temp0.125), dsource(i)=-7; %1/8的概率输出为000 elseif (temp0.25), dsource(i)=-5; %1/8的概率输出为001 elseif (temp0.375), dsource(i)=-3; %1/8的概率输出为010 elseif (temp0.5), dsource(i)=-1; %1/8的概率输出为011 elseif (temp0.625), dsource(i)=1; %1/8的概率输出为100 elseif (temp0.75), dsource(i)=3; %1/8的概率输出为101 elseif (temp0.875), dsource(i)=5; %1/8的概率输出为110 else dsource(i)=7; %1/8的概率输出为111 endend;numoferr=0;for i=1:N, if (dsource(i)=-7), r=-7+gngauss(sgma); elseif(dsource(i)=-5), r=-5+gngauss(sgma); elseif(dsource(i)=-3), r=-3+gngauss(sgma); elseif(dsource(i)=-1), r=-1+gngauss(sgma); elseif(dsource(i)=1), r=1+gngauss(sgma); elseif(dsource(i)=3), r=3+gngauss(sgma); elseif(dsource(i)=5), r=5+gngauss(sgma); elseif(dsource(i)=7), r=7+gngauss(sgma); end; % 判决 if (r-6*d), decis=-7; elseif (r-4*d), decis=-5; elseif (r-2*d), decis=-3; elseif (r0), decis=-1; elseif (r2*d), decis=1; elseif (r4*d), decis=3; elseif (r6*d), decis=5; else decis=7; end; if (decis=dsource(i), % 误码检测 numoferr=numoferr+1; end;end;p=numoferr/N; % 差错概率估计计算smldPe162.m% 通过已知的信噪比求出十六电平双极性映射下的实测差错概率function p=smldPe162(snr_in_dB)d=1;SNR=exp(snr_in_dB*log(10)/10); sgma=sqrt(85*d2)/(8*SNR); N=10000;for i=1:N, temp=rand; if (temp0.0625), dsource(i)=-15; %1/16的概率输出为0000 elseif (temp0.125), dsource(i)=-13; %1/16的概率输出为0001 elseif (temp0.1875), dsource(i)=-11; %1/16的概率输出为0010 elseif (temp0.25), dsource(i)=-9; %1/16的概率输出为0011 elseif (temp0.3125), dsource(i)=-7; %1/16的概率输出为0100 elseif (temp0.375), dsource(i)=-5; %1/16的概率输出为0101 elseif (temp0.4375), dsource(i)=-3; %1/16的概率输出为0110 elseif (temp0.5), dsource(i)=-1; %1/16的概率输出为0111 elseif (temp0.5625), dsource(i)=1; %1/16的概率输出为1000 elseif (temp0.625), dsource(i)=3 %1/16的概率输出为1001 elseif (temp0.6875), dsource(i)=5 %1/16的概率输出为1010 elseif (temp0.75), dsource(i)=7; %1/16的概率输出为1011 elseif (temp0.8125), dsource(i)=9; %1/16的概率输出为1100 elseif (temp0.875), dsource(i)=11; %1/16的概率输出为1101 elseif (temp0.9375), dsource(i)=13; %1/16的概率输出为1110 else dsource(i)=15; %1/16的概率输出为1111 endend;numoferr=0;for i=1:N, if (dsource(i)=-15), r=-15+gngauss(sgma); elseif(dsource(i)=-13), r=-13+gngauss(sgma); elseif(dsource(i)=-11), r=-11+gngauss(sgma); elseif(dsource(i)=-9), r=-9+gngauss(sgma); elseif(dsource(i)=-7), r=-7+gngauss(sgma); elseif(dsource(i)=-5), r=-5+gngauss(sgma); elseif(dsource(i)=-3), r=-3+gngauss(sgma); elseif(dsource(i)=-1), r=-1+gngauss(sgma); elseif(dsource(i)=1), r=1+gngauss(sgma); els
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年康复医学物理治疗技术检测答案及解析
- 2025年营养学在健康管理中的重要性讨论题答案及解析
- 幼儿园健康饮食管理方案与家长指南
- 制造业智能化转型培训教材及课程
- 企业高管薪酬设计与激励机制分析
- 委托付款合同编写指南与法律条款
- 企业视频监控系统操作手册编制
- 物资装备仓库管理办法
- 特殊吸毒人群管理办法
- 网络营销推广方案与实施步骤
- 校园欺凌案件管理制度
- 2025至2030年中国消防工程行业发展动态及未来前景规划报告
- 2025至2030年中国民用采暖炉行业市场行情动态及发展前景研判报告
- 药品网络交易服务三方平台质量管理体系文件-B2B平台(完整版)
- 儿童心理发展课件
- 电气工程师考试题及答案2025年
- 《中华人民共和国民营经济促进法》培训解读课件
- 四川电网新建电源并网服务指南(2025年)
- 青鸟消防系统常见故障分析培训课件
- 2025中国大唐集团科学技术研究总院有限公司系统单位领军人才招聘笔试参考题库附带答案详解
- 教学能力比赛现场决赛30道答辩问题要点
评论
0/150
提交评论