【电路笔记 通信】2PSK(双相移键控)编码并通过MATLAB代码解释

2PSK信号的基本形式

请添加图片描述

  • 在2PSK调制中,信号的相位只有两种可能,分别对应二进制的“0”和“1”。假设2PSK信号的形式为:

s(t)=Acos⁡(2πfct+ϕ) s(t) = A \cos(2\pi f_c t + \phi) s(t)=Acos(2πfct+ϕ)

  • AAA:信号幅度。
  • fcf_cfc:载波频率。
  • ϕ\phiϕ:相位,取决于输入数据,通常为:
    • ϕ=0\phi = 0ϕ=0,表示二进制“1”;
    • ϕ=π\phi = \piϕ=π,表示二进制“0”。

在接收端,接收到的信号可能受到噪声的干扰,因此接收信号为:

r(t)=Acos⁡(2πfct+ϕ)+n(t) r(t) = A \cos(2\pi f_c t + \phi) + n(t) r(t)=Acos(2πfct+ϕ)+n(t)

其中,n(t)n(t)n(t)表示加性高斯噪声。

相干解调的步骤

(1) 载波同步

在相干解调中,需要一个与发送端载波频率和相位完全同步的本地载波信号,记为:

c(t)=cos⁡(2πfct) c(t) = \cos(2\pi f_c t) c(t)=cos(2πfct)

该载波通常由接收机的载波同步电路提取。

(2) 同步混频

接收到的信号r(t)r(t)r(t)与本地载波信号c(t)c(t)c(t)相乘。混频后的信号为:

r′(t)=r(t)⋅c(t)=[Acos⁡(2πfct+ϕ)+n(t)]⋅cos⁡(2πfct) r'(t) = r(t) \cdot c(t) = [A \cos(2\pi f_c t + \phi) + n(t)] \cdot \cos(2\pi f_c t) r(t)=r(t)c(t)=

clear all; close all; clc; max=10 g=zeros(1,max); g=randint(1,max);%长度为max的随机二进制序列 cp=[];mod1=[];f=2*2*pi;t=0:2*pi/199:2*pi; for n=1:length(g); if g(n)==0; A=zeros(1,200);%每个值200个点 else g(n)==1; A=ones(1,200); end cp=[cp A]; %s(t),码元宽度200 c=cos(f*t);%载波信号 mod1=[mod1 c];%与s(t)等长的载波信号,变为矩阵形式 end figure(1);subplot(4,2,1);plot(cp);grid on; axis([0 200*length(g) -2 2]);title('二进制信号序列'); cm=[];mod=[]; for n=1:length(g); if g(n)==0; B=ones(1,200);%每个值200个点 c=cos(f*t); %载波信号 else g(n)==1; B=ones(1,200); c=cos(f*t+pi); %载波信号 end cm=[cm B]; %s(t),码元宽度200 mod=[mod c]; %与s(t)等长的载波信号 end tiaoz=cm.*mod;%e(t)调制 figure(1);subplot(4,2,2);plot(tiaoz);grid on; axis([0 200*length(g) -2 2]);title('2PSK调制信号'); figure(2);subplot(4,2,1);plot(abs(fft(cp))); axis([0 200*length(g) 0 400]);title('原始信号频谱'); figure(2);subplot(4,2,2);plot(abs(fft(tiaoz))); axis([0 200*length(g) 0 400]);title('2PSK信号频谱'); %带有高斯白噪声的信道 tz=awgn(tiaoz,10);%信号tiaoz中加入白噪声,信噪比为10 figure(1);subplot(4,2,3);plot(tz);grid on axis([0 200*length(g) -2 2]);title('通过高斯白噪声信道后的信号'); figure(2);subplot(4,2,3);plot(abs(fft(tz))); axis([0 200*length(g) 0 400]);title('加入白噪声的2PSK信号频谱'); jiet=2*mod1.*tz;%同步解调 figure(1);subplot(4,2,4);plot(jiet);grid on axis([0 200*length(g) -2 2]);title('相乘后信号波形') figure(2);subplot(4,2,4);plot(abs(fft(jiet))); axis([0 200*length(g) 0 400]);title('相乘后信号频谱'); %低通滤波器 fp=500;fs=700;rp=3;rs=20;fn=11025; ws=fs/(fn/2); wp=fp/(fn/2);%计算归一化角频率 [n,wn]=buttord(wp,ws,rp,rs);%计算阶数和截止频率 [b,a]=butter(n,wn);%计算H(z) figure(4);freqz(b,a,1000,11025);subplot(2,1,1); axis([0 4000 -100 3 ]) title('LPF幅频相频图'); jt=filter(b,a,jiet); figure(1);subplot(4,2,5);plot(jt);grid on axis([0 200*length(g) -2 2]);title('经低通滤波器后信号波形') figure(2);subplot(4,2,5);plot(abs(fft(jt))); axis([0 200*length(g) 0 400]);title('经低通滤波器后信号频谱'); %抽样判决 for m=1:200*length(g); if jt(m)=0; jt(m)=0; end end figure(1);subplot(4,2,6);plot(jt);grid on axis([0 200*length(g) -2 2]);title('经抽样判决后信号s^(t)波形') figure(2);subplot(4,2,6);plot(abs(fft(jt))); axis([0 200*length(g) 0 400]);title('经抽样判决后信号频谱');
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值