clear all
close all
i=10;
j=5000;
fc=4;%载波频率
fm=i/5;%码元速率
B=2*fm;
t=linspace(0,5,j);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%产生基带信号
a=round(rand(1,i));
%figure(4);
%stem(a);
st1=t;
for n=1:10
if a(n)<1;
for m=j/i*(n-1)+1:j/i*n
st1(m)=0;
end
else
for m=j/i*(n-1)+1:j/i*n
st1(m)=1;
end
end
end
figure(1);
subplot(511);
plot(t,st1);
title('绝对码');
axis([0,5,-1,2]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%差分变换
b=zeros(1,i);%%%%%%%%全零矩阵
b(1)=a(1);
for n=2:10
if a(n)>=1;
if b(n-1)>=1
b(n)=0;
else
b(n)=1;
end
else
b(n)=b(n-1);
end
end
st1=t;
for n=1:10
if b(n)<1;
for m=j/i*(n-1)+1:j/i*n
st1(m)=0;
end
else
for m=j/i*(n-1)+1:j/i*n
st1(m)=1;
end
end
end
subplot(512);
plot(t,st1);
title('相对码st1');
axis([0,5,-1,2]);
st2=t;
for k=1:j;
if st1(k)>=1;
st2(k)=0;
else
st2(k)=1;
end
end;
subplot(513);
plot(t,st2);
title('相对码反码st2');
axis([0,5,-1,2]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%载波信号
s1=sin(2*pi*fc*t);
subplot(514);
plot(s1);
title('载波信号s1');
s2=sin(2*pi*fc*t+pi);
subplot(515);
plot(s2);
title('载波信号s2');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%信号调制
d1=st1.*s1;
d2=st2.*s2;
figure(2);
subplot(411);
plot(t,d1);
title('st1*s1');
subplot(412);
plot(t,d2);
title('st2*s2');
e_dpsk=d1+d2;
subplot(413);
plot(t,e_dpsk);
title('调制后波形');
noise=rand(1,j);
dpsk=e_dpsk+noise;%%%%%%%%%%加入噪声
subplot(414);
plot(t,dpsk);
title('加噪声后信号');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%相干解调
dpsk=dpsk.*s1;%%%%与载波s1相乘
figure(3);
subplot(411);
plot(t,dpsk);
title('与载波相乘后波形');
[f,af]=T2F(t,dpsk);%%%%通过低通滤波器
[t,dpsk]=lpf(f,af,B);
subplot(412);
plot(t,dpsk);
title('低通滤波后波形');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%抽样判决
st=zeros(1,i);%%全零矩阵
for m=0:i-1;
if dpsk(1,m*500+250)<0;
st(m+1)=0;
for j=m*500+1:(m+1)*500;
dpsk(1,j)=0;
end
else
for j=m*500+1:(m+1)*500;
st(m+1)=1;
dpsk(1,j)=1;
end
end
end
subplot(413);
plot(t,dpsk);
axis([0,5,-1,2]);
title('抽样判决后波形')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%码反变换
dt=zeros(1,i);%%全零矩阵
dt(1)=st(1);
for n=2:10;
if (st(n)-st(n-1))<=0&&(st(n)-st(n-1))>-1;
dt(n)=0;
else
dt(n)=1;
end
end
st=t;
for n=1:10
if dt(n)<1;
for m=j/i*(n-1)+1:j/i*n
st(m)=0;
end
else
for m=j/i*(n-1)+1:j/i*n
st(m)=1;
end
end
end
subplot(414);
plot(t,st);
axis([0,5,-1,2]);
title('码反变换后波形');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%频谱观察
sf=fftshift(abs(fft(e_dpsk)));
figure(4);
plot(t,sf)
title('已调信号频谱');
数字通信系统的调制与解调
1星 需积分: 40 50 浏览量
2018-05-15
17:09:02
上传
评论 1
收藏 3KB RAR 举报
AotYan
- 粉丝: 1
- 资源: 8
最新资源
- 校园帮项目,毕业设计/课程设计/javaWeb/SSM
- C++ plotting library,matplotlib-cpp-master.zip
- 案例源码matplotlib-examples-master.zip
- 基于JavaScript 实现的KMP 算法
- 基于C++实现二叉树的创建,遍历,添加,查找与删除
- 基于C语言实现二叉树的基本操作
- 毕业设计基于STM32的测量温度与压力的数据处理设计C语言完整源码+论文.zip
- 基于MATLAB的PCA算法人脸识别项目源码+GUI界面+说明文档.zip
- 基于STM32的测量温度与压力的数据处理设计源码+论文(毕业设计).zip
- Vision Transformer 网络对不同氨气氧气浓度轨迹RAS 图像数据集的分类,包含训练权重和数据集、迁移学习
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈