您好,欢迎来到华佗养生网。
搜索
您的当前位置:首页用matlab编写2ASK,2PSK程序

用matlab编写2ASK,2PSK程序

来源:华佗养生网
通信原理实验报告三

实验内容:

用matlab编写2ASK,2PSK程序

实验一:2ASK程序

A=1; fc=2;

N_sample=8; N=500; Ts=1;

dt=Ts/fc/N_sample; t=0:dt:N.*Ts-dt; 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(2,1,1);

d_NRZ=conv(dd,gt);

plot(t,d_NRZ(1:length(t))); axis([0 10 0 1.2]); ylabel('输入信号') %2ASK信号

ht=A.*cos(2.*pi.*fc.*t); s_ask=d_NRZ(1:Lt).*ht; subplot(2,1,2); %画图

plot(t,s_ask);

axis([0 10 -1.2 1.2]); ylabel('2ASK');

%常用到的子函数 sigexpand.m function [out]=sigexpand(d,M);

%将输入序列扩展成间隔为N-1个0的序列 N=length(d); out=zeros(M,N); out(1,:)=d;

out=reshape(out,1,M.*N);

实验二:2PSK程序

A=1; fc=2;

N_sample=8; N=500; Ts=1;

dt=Ts/fc/N_sample; t=0:dt:N.*Ts-dt; 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(2,1,1);

d_NRZ=conv(dd,gt); dd_NRZ=2*d_NRZ-1; plot(t,d_NRZ(1:Lt)*2-1); axis([0 10 0 1.2]); ylabel('输入信号')

%2PSK信号

ht=A.*sin(2.*pi.*fc.*t); s_psk=dd_NRZ(1:Lt).*ht; subplot(2,1,2); %画图

plot(t,s_psk);

axis([0 10 -1.2 1.2]); ylabel('2PSK');

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo7.cn 版权所有 湘ICP备2022005869号-9

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务