数字通信实验4数字信号调制实验(4学时)实验1.用Matlab产生独立等概的二进制信源。(1)画出OOK信号波形及其功率谱;(2)画出2PSK信号波形及其功率谱;(3)画出2FSK信号波形及其功率谱(设121nffT)。%2ASK,2PSK,文件名binarymod.mclearall;closeall;A=1;fc=2;%2Hz;N_sample=8;N=500;%码元数Ts=1;%1baud/sdt=Ts/fc/N_sample;%波形采样间隔t=0:dt:N*Ts-dt;T=dt*length(t);Lt=length(t);%产生二进制信源d=sign(randn(1,N));dd=sigexpand((d+1)/2,fc*N_sample);gt=ones(1,fc*N_sample);%NRZ波形figure(1)subplot(221);%输入NRZ信号波形(单极性)d_NRZ=conv(dd,gt);plot(t,d_NRZ(1:length(t)));axis([01001.2]);ylabel('输入信号');subplot(222);%输入NRZ频谱[f,d_NRZf]=T2F(t,d_NRZ(1:length(t)));plot(f,10*log10(abs(d_NRZf).^2/T));axis([-22-5010]);ylabel('输入信号功率谱密度(dB/Hz)');%2ASK信号ht=A*cos(2*pi*fc*t);s_2ask=d_NRZ(1:Lt).*ht;subplot(223)plot(t,s_2ask);axis([010-1.21.2]);ylabel('2ASK');[f,s_2askf]=T2F(t,s_2ask);subplot(224)plot(f,10*log10(abs(s_2askf).^2/T));axis([-fc-4fc+4-5010]);ylabel('2ASK功率谱密度(dB/Hz)');figure(2)%2PSK信号d_2psk=2*d_NRZ-1;s_2psk=d_2psk(1:Lt).*ht;subplot(221)plot(t,s_2psk);axis([010-1.21.2]);ylabel('2PSK');subplot(222)[f,s_2pskf]=T2F(t,s_2psk);plot(f,10*log10(abs(s_2pskf).^2/T));axis([-fc-4fc+4-5010]);ylabel('2PSK功率谱密度(dB/Hz)');%2FSK%s_2fsk=Acos(2*pi*fc*t+int(2*d_NRZ-1));sd_2fsk=2*d_NRZ-1;s_2fsk=A*cos(2*pi*fc*t+2*pi*sd_2fsk(1:length(t)).*t);subplot(223)plot(t,s_2fsk);axis([010-1.21.2]);xlabel('t');ylabel('2FSK')subplot(224)[f,s_2fskf]=T2F(t,s_2fsk);plot(f,10*log10(abs(s_2fskf).^2/T));axis([-fc-4fc+4-5010]);xlabel('f');ylabel('2FSK功率谱密度(dB/Hz)');%随机相位2FSKfai=2*pi*rand(1,N);fai_2fsk=sigexpand(fai,fc*N_sample);fai_2fsk=conv(fai_2fsk,gt);s_2fskd=A*cos(2*pi*fc*t+2*pi*sd_2fsk(1:length(t)).*t+fai_2fsk(1:length(t)));figure(3)subplot(211);plot(t,s_2fskd);xlabel('t');ylabel('随机相位2FSK');axis([010-1.21.2]);[f,s_2fskdf]=T2F(t,s_2fskd);subplot(212);plot(f,10*log10(abs(s_2fskdf).^2/T));xlabel('f');ylabel('随机相位2FSK功率谱密度(dB/Hz)');axis([-fc-4fc+4-5010]);051000.20.40.60.81输入信号-2-1012-50-40-30-20-10010输入信号功率谱密度(dB/Hz)0510-1-0.500.512ASK-505-50-40-30-20-100102ASK功率谱密度(dB/Hz)0510-1-0.500.512PSK-505-40-2002PSK功率谱密度(dB/Hz)0510-1-0.500.51t2FSK-505-40-200f2FSK功率谱密度(dB/Hz)012345678910-1-0.500.51t随机相位2FSK-6-4-20246-40-200f随机相位2FSK功率谱密度(dB/Hz)实验内容实验1.设载波频率为20HZ,码元速率为2Baud,用matlab语言画出:(1)ASK,PSK,FSK时间波形;(2)计算信号的功率谱(3)分析调制信号的带宽,相干解调时滤波器带宽%2ASK,2PSK,文件名binarymod.mclearall;closeall;A=1;fc=20;%2Hz;N_sample=8;N=500;%码元数Ts=0.5;%2baud/sdt=Ts/fc/N_sample;%波形采样间隔t=0:dt:N*Ts-dt;T=dt*length(t);Lt=length(t);%产生二进制信源d=sign(randn(1,N));dd=sigexpand((d+1)/2,fc*N_sample);gt=ones(1,fc*N_sample);%NRZ波形figure(1)subplot(421);%输入NRZ信号波形(单极性)d_NRZ=conv(dd,gt);plot(t,d_NRZ(1:length(t)));ylabel('输入信号');axis([0201.2]);subplot(422);%输入NRZ频谱[f,d_NRZf]=T2F(t,d_NRZ(1:length(t)));plot(f,10*log10(abs(d_NRZf).^2/T));ylabel('输入信号功率谱(dB/Hz)');axis([-2020-5020]);%2ASK信号ht=A*cos(2*pi*fc*t);s_2ask=d_NRZ(1:Lt).*ht;subplot(423)plot(t,s_2ask);ylabel('2ASK');axis([02-1.21.2]);[f,s_2askf]=T2F(t,s_2ask);subplot(424)plot(f,10*log10(abs(s_2askf).^2/T));ylabel('2ASK功率谱(dB/Hz)');axis([-fc-30fc+30-5010]);%figure(2)%2PSK信号d_2psk=2*d_NRZ-1;s_2psk=d_2psk(1:Lt).*ht;subplot(425)plot(t,s_2psk);ylabel('2PSK');axis([02-1.21.2]);subplot(426)[f,s_2pskf]=T2F(t,s_2psk);plot(f,10*log10(abs(s_2pskf).^2/T));xlabel('f');ylabel('2PSK功率谱(dB/Hz)');axis([-fc-30fc+30-5010]);%2FSK%s_2fsk=Acos(2*pi*fc*t+int(2*d_NRZ-1));sd_2fsk=2*d_NRZ-1;s_2fsk=A*cos(2*pi*fc/2*t+2*pi*sd_2fsk(1:length(t)).*t);subplot(427)plot(t,s_2fsk);xlabel('t');ylabel('2FSK');axis([02-1.21.2]);subplot(428)[f,s_2fskf]=T2F(t,s_2fsk);plot(f,10*log10(abs(s_2fskf).^2/T));xlabel('f');ylabel('2FSK功率谱(dB/Hz)');axis([-fc-30fc+30-5010]);00.20.40.60.811.21.41.61.8200.51输入信号-20-15-10-505101520-40-20020输入信号功率谱(dB/Hz)00.20.40.60.811.21.41.61.82-1012ASK-50-40-30-20-1001020304050-40-2002ASK功率谱(dB/Hz)00.20.40.60.811.21.41.61.82-1012PSK-50-40-30-20-1001020304050-40-200f2PSK功率谱(dB/Hz)00.20.40.60.811.21.41.61.82-101t2FSK-50-40-30-20-1001020304050-40-200f2FSK功率谱(dB/Hz)实验2.设发送的二进制信息为111010011,采用2PSK方式传输。已知码元传输速率为24Baud,载波频率为48Hz:(1)试画出2PSK信号的时间波形;(2)若采用相干解调方式进行解调,试画出各点时间波形;(3)若发送信息“0”和“1”的概率相等,试画出2PSK信号频谱结构示意图,并计算其带宽。.