• 大小: 3KB
    文件类型: .m
    金币: 2
    下载: 2 次
    发布日期: 2021-06-10
  • 语言: Matlab
  • 标签: BPSK  QPSK  

资源简介

单载波为、BPSK、QPSK三种情况下锁相环载波同步的MATLAB仿真代码M文件

资源截图

代码片段和文件信息

%频偏:-60Hz
%相偏:在0--2*pi内随机分布

%程序及结果如下:
clear all;
close all;
%定义锁相环的工作模式:单载波为“1”、BPSK调制为“2”、QPSK调制为“3”
PLL_Mode = 3;
%仿真数据长度
Simulation_Length=1000;
%基带信号
if PLL_Mode == 1
I_Data=ones(Simulation_Length1);
Q_Data=I_Data;
else if PLL_Mode == 2
I_Data=randint(Simulation_Length1)*2-1;
Q_Data=zeros(Simulation_Length1);
else
I_Data=randint(Simulation_Length1)*2-1;
Q_Data=randint(Simulation_Length1)*2-1;
end
end
Signal_Source=I_Data + j*Q_Data;
%载波信号
Freq_Sample=2400;%采样率,Hz
Delta_Freq=-60; %频偏,Hz
Time_Sample=1/Freq_Sample;
Delta_Phase=rand(1)*2*pi; %随机初相,Rad
Carrier=exp(j*(Delta_Freq/Freq_Sample*(1:Simulation_Length)+Delta_Phase));
%调制处理
Signal_Channel=Signal_Source.*Carrier‘;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%以下为锁相环处理过程
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%参数清零
Signal_PLL=zeros(Simulation_Length1);
NCO_Phase = zeros(Simulation_Length1);
Discriminator_Out=zeros(Simulation_Length1);
Freq_Control=zeros(Simulation_Length1);
PLL_Phase_Part=zeros(Simulation_Length1);
PLL_Freq_Part=zeros(Simulation_Length1);
%环路处理
C1=0.22013;
C2=0.0024722;
for i=2:Simulation_Length
Signal_PLL(i)=Signal_Channel(i)*exp(-j*mod(NCO_Phase(i-1)2*pi));
I_PLL(i)=real(Signal_PLL(i));
Q_PLL(i)=imag(Signal_PLL(i));
if PLL_Mode == 1
Discriminator_Out(i)=atan2(Q_PLL(i)I_PLL(i));
else if PLL_Mode == 2
Discriminator_Out(i)=sign(I_PLL(i))*Q_PLL(i)/abs(Signal_PLL(i));
else
Discriminator_Out(i)=(s

评论

共有 条评论