2DPSK信号的解调主要有两种方法。第一种方法是直接比较相邻码元的相位,从而判决接收码元是“0”还是“1”。为此,需要将前一码元延迟1码元时间,然后将当前码元的相位和前一码元的相位作比较。这种方法称为相位比较法。此方法对于延迟单元的延时精度要求很高,较难做到,所以应用较少。第二种方法是先把接收信号当做绝对相移信号进行相干解调,解调后的码序列是相对码;然后再将此相对码序列作闻逆码变换,还原成绝对码,即原基带信号码元序列。这种相干解调法又称极性比较法。
相干解调:
Nx = round(rand(1,101));%绝对码
subplot(10,1,1);stem(Nx);
snrdB = 20;%信噪比为20
N1 = [0,];
for i = 1:100
N1 = [N1,xor(Nx(i),N1(i))];
end
N1 = abs(N1);
subplot(10,1,2);stem(N1);
wavNum = 20;%wavNum单码元三角函数波周期数
Ts = 1; % 码元周期
N_sample = 4000; % 单个码元抽样点数
Ph = 0:2*wavNum*pi/N_sample:2*pi*wavNum*(1-1/N_sample);%Ph为相位
dt = Ts / N_sample; % 抽样时间间隔
t = 0 : dt : length(N1)-dt; % 序列传输时间
gt1 = sin(Ph.*ones(1, N_sample)); %DBPSK码为1时
gt0 = -1*sin(Ph.*ones(1, N_sample));%DBPSK为0时
sig = [];
for i = 1:101
if N1(i)==1
sig = [sig,gt1];
else
sig = [sig,gt0];
end
end
subplot(10,1,3);plot(t,sig);axis([0,1,-0.8,0.8]);%调制完成信号
sig_channel = pesnrf(sig,snrdB);
subplot(10,1,4);plot(t,sig_channel);axis([0,1,-0.8,0.8]);%添加噪声之后的信号,噪声单位SNRdB
wp=[wavNum-5 wavNum+5]*2/N_sample;
ws=[wavNum-10 wavNum+10]*2/N_sample;
rp=3;
rs=30;
[N,wn]=cheb2ord(wp,ws,rp,rs);
[b,a]=cheby2(N,rp,wn,'bandpass');%切比雪夫带通滤波
sig_bandpass = filter(b,a,sig_channel);
subplot(10,1,5);plot(t,sig_bandpass);axis([0,1,-0.8,0.8]);%经过带通滤波器之后的信号
sig_local = sin(2*wavNum*pi*t);
subplot(10,1,6);plot(t,sig_local);axis([0,1,-0.8,0.8]);%本地载波
sig_rec = sig_local.*sig_bandpass;%本地载波与信号相乘
subplot(10,1,7);plot(t,sig_rec);axis([0,1,-0.8,0.8]);%接收低通滤波器
wp=(1/Ts-0.5)*2/N_sample;
ws=(1/Ts+0.5)*2/N_sample;
Rp=3;Rs=30;
[N,wn]=cheb2ord(wp,ws,rp,rs);
[b,a]=cheby2(N,rp,wn,'low');
sig_lp = filter(b,a,sig_rec);
subplot(10,1,8);plot(t,sig_lp);axis([0,1,-0.8,0.8]);%切比雪夫低通滤波
t1 = N_sample/2:N_sample:length(t)-N_sample/2;
sig_out = [];
for i = 1:101
sig_out = [sig_out,sign(sig_lp(t1(i)))];
end
sig_out = 1/2*(sig_out+1);
subplot(10,1,9);stem(sig_out);%输出的相对码
sig_out = 1/2*(-1*(sig_out*2-1)+1);%码反变换
sig_out1 = [];
for i = 1:100
sig_out1 = [sig_out1,xor(sig_out(i),sig_out(i+1))];
end
subplot(10,1,10);stem(sig_out1);%转换完成的绝对码
运行结果如下所示
非相干解调:
Nx = round(rand(1,100));%绝对码
subplot(8,1,1);stem(Nx);
snrdB = 20;%信噪比为20
N1 = [0,];
for i = 1:100
N1 = [N1,xor(Nx(i),N1(i))];
end
N1 = abs(N1);
subplot(8,1,2);stem(N1);
wavNum = 20;%wavNum单码元三角函数波周期数
Ts = 1; % 码元周期
N_sample = 4000; % 单个码元抽样点数
Ph = 0:2*wavNum*pi/N_sample:2*pi*wavNum*(1-1/N_sample);%Ph为相位
dt = Ts / N_sample; % 抽样时间间隔
t = 0 : dt : length(N1)-dt; % 序列传输时间
gt1 = sin(Ph.*ones(1, N_sample)); %DBPSK码为1时
gt0 = -1*sin(Ph.*ones(1, N_sample));%DBPSK为0时
sig = [];
for i = 1:101
if N1(i)==1
sig = [sig,gt1];
else
sig = [sig,gt0];
end
end
subplot(8,1,3);plot(t,sig);axis([0,1,-0.8,0.8]);%调制完成信号
sig_channel = pesnrf(sig,snrdB);
subplot(8,1,4);plot(t,sig_channel);axis([0,1,-0.8,0.8]);%添加噪声之后的信号,噪声单位SNRdB
wp=[wavNum-5 wavNum+5]*2/N_sample;
ws=[wavNum-10 wavNum+10]*2/N_sample;
rp=3;
rs=30;
[N,wn]=cheb2ord(wp,ws,rp,rs);
[b,a]=cheby2(N,rp,wn,'bandpass');%切比雪夫带通滤波
sig_bandpass = filter(b,a,sig_channel);
subplot(8,1,5);plot(t,sig_bandpass);axis([0,1,-0.8,0.8]);%经过带通滤波器之后的信号
sig_local =zeros(1,N_sample);
for i = 1: length(sig_channel)-N_sample
sig_channel1(i) = sig_channel(i);%选择此种方法减少计算所需时间
end
sig_local = [sig_local,sig_channel1];%信号延时
sig_mul = sig_channel.*sig_local;%相乘
t= 0:dt:(length(N1)*Ts)-dt; % 序列传输时间;
subplot(8,1,6);plot(t,sig_mul);axis([0,1,-0.8,0.8]);
wp=(1/Ts-0.5)*2/N_sample;
ws=(1/Ts+0.5)*2/N_sample;
Rp=3;Rs=30;
[N,wn]=cheb2ord(wp,ws,rp,rs);
[b,a]=cheby2(N,rp,wn,'low');
sig_lp = filter(b,a,sig_mul);
subplot(8,1,7);plot(t,sig_lp);axis([0,1,-0.8,0.8]);%切比雪夫低通滤波
t1 = N_sample/2:N_sample:length(t)-N_sample/2;
sig_out = [];
for i = 1:101
sig_out = [sig_out,sign(sig_lp(t1(i)))];%抽样判决
end
sig_out = 1/2*(-1*sig_out+1);
for i = 1:100
sig_out(i) = sig_out(i+1);
end
sig_out(length(sig_out))=[];
subplot(8,1,8);stem(sig_out);%输出的相对码
运行结果如下所示: