您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 实训三 数字信号基带传输的仿真设计
实训三数字信号基带传输的仿真设计一、实验内容1、基带信号采用不归零矩形脉冲或升余弦滚降波形,基带信号的功率谱密度分析。2、误码率的计算:A/σ和误码率之间的性能曲线3、眼图的生成4、匹配滤波器二、程序与仿真图1.%二进制不归零矩形脉冲clc;closeall;clearall;N_sample=100;N_num=1000;t=0/N_sample:1/N_sample:N_num-1/N_sample;st=0;fori=1:20d=(randint(1,N_num)*2-1);st_bb=rectpulse(d,N_sample);%将矩阵连接window=boxcar(length(st_bb));%矩形加窗函数[pxx,f]=periodogram(st_bb,window,2^16,N_sample);%计算功率谱密度函数,st_bb为待求函数,window是所使用的窗口,长度必须和待求函数一致%2*16是采样点数N_sample,采样频率st=st+pxx;endst=st/20;figure(1);subplot(2,1,1);plot(t,st_bb);title('基带信号波形');axis([015-1.51.5]);gridon;subplot(2,1,2);plot([-1*flipud(f);f],0.5*[flipud(st);st]);title('基带信号功率谱');%dlipud实现矩阵上下翻转axis([-8802]);gridon;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%二进制滚降系数为1st_rc=rcosflt(d,1,80,'fir',1,1);figure(2);subplot(2,1,1);plot(0:1/50:35-1/50,st_rc(1:35*50));axis([015-22]);gridon;title('基带信号波形(滚降系数为1)');st1=0;fori=1:5d=(randint(1,N_num)*2-1);st_re=rcosflt(d,1,40,'fir',1,1);window=boxcar(length(st_rc));[px1,f]=periodogram(st_rc,window,2^16,N_sample);st1=st1+px1;endst1=st1/5;subplot(212);plot([-1*flipud(f);f],0.5*[flipud(st);st]);title('基带信号功率谱(滚降系数为1)');axis([-5501.5]);gridon;%%%%%%%%%%%%%%%%%%%%%%%n=10^6;snr_db=0:12;ber=zeros(1,length(snr_db));%生成0矩阵fori=1:length(snr_db)d=(randint(1,n)*2-1);dwn=awgn(d,snr_db(i));%加性高斯白噪声d_r=sign(dwn);%置位-1或1ber(i)=length(find(d~=d_r))/n;%%%%endpe=0.5*erfc(sqrt(10.^(snr_db/10)/2));figure(3);semilogy(snr_db,ber,'k*');holdon;gridon;semilogy(snr_db,pe,'r-');xlabel('A/&');ylabel('ber');legend('ber','ber_Theory');2.clcclearall;closeall;figure;ht=rcosflt(1,1,200,'fir/sqrt',1,3);subplot(2,2,1)plot(ht);axis([01200-0.030.10]);gridon;ht=rcosflt(1,1,200,'fir/sqrt',0.75,3);subplot(2,2,2)plot(ht);axis([01200-0.030.10]);gridon;ht=rcosflt(1,1,200,'fir/sqrt',0.5,3);subplot(2,2,3)plot(ht);axis([01200-0.030.10]);gridon;ht=rcosflt(1,1,200,'fir/sqrt',0.25,3);subplot(2,2,4)plot(ht);axis([01200-0.030.10]);gridon;3.clearall;N=1000;x=sign(randn(1,N));Ts=1;alpha=1;y=rcosflt(x,1/Ts,100,'fir',alpha,5);figure(3);plot(y);title('多个滚降信号时域波形');axis([0,3000,-1.5,1.5]);gridon;4.clearall;N=1000;x=sign(randn(1,N));Ts=1;alpha=1;y=rcosflt(x,1/Ts,100,'fir',alpha,2);eyediagram(y,300,4);title('无噪声时眼图');gridon;%%%%%%%%%%%%clearall;N=1000;x=sign(randn(1,N));Ts=1;snr=30;alpha=1;y=rcosflt(x,1/Ts,100,'fir',alpha,2);y1=awgn(y,snr);eyediagram(y1,300);title('SNR=30dB时的眼图');gridon;%%%%%%%%%clearall;N=1000;x=sign(randn(1,N));Ts=1;snr=20;alpha=1;y=rcosflt(x,1/Ts,100,'fir',alpha,2);y1=awgn(y,snr);eyediagram(y1,300);title('SNR=20dB时的眼图');gridon;%%%%%%%%%clearall;N=1000;x=sign(randn(1,N));Ts=1;snr=10;alpha=1;y=rcosflt(x,1/Ts,100,'fir',alpha,2);y1=awgn(y,snr);eyediagram(y1,300,4);title('SNR=10dB时的眼图');gridon;%%%%%%%%%%%clearall;N=1000;x=sign(randn(1,N));Ts=1;snr=0;alpha=1;y=rcosflt(x,1/Ts,100,'fir',alpha,2);y1=awgn(y,snr);eyediagram(y1,300,4);title('SNR=0dB时的眼图');gridon;5.clcclearall;N=64;h=ones(1,N);d=sign(randn(1,20));y=rectpulse(d,N);ht=conv(h,y);ht=ht./max(ht);figure;plot(ht,'r');ylim([-1.51.5]);holdon;plot(y,'b');gridon;
本文标题:实训三 数字信号基带传输的仿真设计
链接地址:https://www.777doc.com/doc-3803549 .html