matlab--实验十 2ASK调制与解调实验.doc
文本预览下载声明
实验十 2ASK调制与解调实验
一. 实验目的
1. 掌握2ASK的调制与解调原理;
2. 掌握利用MATLAB实现2ASK调制与解调的仿真方法。
二. 实验内容及要求
利用MATLAB仿真平台,完成下列任务:
(1)产生二进制随机信号源,绘制信号源波形图;
(2)实现2ASK调制,绘制相应的信号波形图;
(3)利用awgn函数实现2ASK信号通过加性高斯白噪声信道,其中SNR = 10dB;
(4)采用相干解调实现2ASK信号解调,并绘制各阶段信号波形图。(选做)
三. 实验过程及结果
function askdigital(s,f)
t=0:2*pi/99:2*pi;
m1=[];
c1=[];
for n=1:length(s)
if s(n)==0;
m=zeros(1,100);
else s(n)==1;
m=ones(1,100);
end
c=sin(f*t);
m1=[m1 m];
c1=[c1 c];
end
ask=c1.*m1;
y=awgn(ask,10);
subplot(311);
plot(m1)
title(原始信号);
axis([0 100*length(s) -0.1 1.1]);
subplot(312);
plot(ask)
title(ASK信号);
subplot(313);
plot(y)
title(加噪信号);
s=round(rand(1,8))
%stem(s);hold on
f=1;
askdigital(s,f)
s =
1 1 0 1 1 0 1 0
★ 2ASK调制与解调示例:
clear all;
close all;
clc;
max = 8;
s=randint(1,max);%长度为max的随机二进制序列
cp=[];
f=1;%载波频率
tc=0:2*pi/99:2*pi;
nsamp = 100;
cm=[];
mod=[];
for n=1:length(s);
if s(n)==0;
m=zeros(1,nsamp);
b=zeros(1,nsamp);
else s(n)==1;
m=ones(1,nsamp);
b=ones(1,nsamp);
end
c = sin(f*tc);
cm=[cm m];
cp = [cp b];
mod=[mod c];
end
tiaoz=cm.*mod;%2ASK调制
t = linspace(0,length(s),length(s)*nsamp);
figure;
subplot(2,1,1);
plot(t,cp);
grid on;
axis([0 length(s) -0.1 1.1]);
title(二进制信号序列);
subplot(2,1,2);
plot(t,tiaoz);
grid on;
axis([0 length(s) -1.1 1.1]);
title(2ASK调制信号);
%加性高斯白噪声信道
tz=awgn(tiaoz,10);%信号tiaoz中加入白噪声,信噪比为SNR=10dB
figure;
subplot(2,1,1);
plot(t,tz);
grid on
axis([0 length(s) -1.5 1.5]);title(通过高斯白噪声信道后的信号);
jiet = mod.*tz;%相干解调
subplot(2,1,2);
plot(t,jiet);
grid on
axis([0 length(s) -1.5 1.5]);
title(乘以相干载波后的信号波形)
%%%%%%%%%%%%% 低通滤波 %%%%%%%%%%%%%%%%%%%%%%%%
[f,af] = FFT_SHIFT(t,jiet);
B = 2;
[t,dpsk] = RECT_LPF(f,af,B);
figure
subplot(2,1,1);
plot(t,dpsk);
grid on
title(通过低通滤波器后的信号波形);
% 抽样判决,因为未修正幅度,所以判决门限为0.25
depsk = zeros(1,nsamp*length(s));
for m = nsamp/2:nsamp:nsamp*length(s);
if dpsk(m) 0.25;
for i = 1:nsamp
depsk((m-50)+i) = 0;
显示全部