clear all;
close all;
%定义锁相环的工作模式:单载波为“1”、BPSK调制为“2”、QPSK调制为“3”
PLL_Mode = 3;
%仿真数据长度
Simulation_Length=1000;
%基带信号
if PLL_Mode == 1
I_Data=ones(Simulation_Length,1);%单载波调制
Q_Data=I_Data;
else if PLL_Mode == 2 %BPSK调制
I_Data=randint(Simulation_Length,1)*2-1;
Q_Data=zeros(Simulation_Length,1);
else %QPSK调制
I_Data=randint(Simulation_Length,1)*2-1;
Q_Data=randint(Simulation_Length,1)*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_Length,1);
NCO_Phase = zeros(Simulation_Length,1);
Discriminator_Out=zeros(Simulation_Length,1);
Freq_Control=zeros(Simulation_Length,1);
PLL_Phase_Part=zeros(Simulation_Length,1);
PLL_Freq_Part=zeros(Simulation_Length,1);
%环路处理
C1=0.022013;
C2=0.00024722;
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)=(sign(I_PLL(i))*Q_PLL(i)-sign(Q_PLL(i))*I_PLL(i))...
/(sqrt(2)*abs(Signal_PLL(i)));
end
end
PLL_Phase_Part(i)=Discriminator_Out(i)*C1;
Freq_Control(i)=PLL_Phase_Part(i)+PLL_Freq_Part(i-1);
PLL_Freq_Part(i)=Discriminator_Out(i)*C2+PLL_Freq_Part(i-1);
NCO_Phase(i)=NCO_Phase(i-1)+Freq_Control(i);
end
%画图显示结果
figure
subplot(2,2,1)
plot(-PLL_Freq_Part(2:Simulation_Length)*Freq_Sample);
grid on;
title('PLL频率响应曲线图');
axis([1 Simulation_Length -100 100]);
subplot(2,2,2)
plot(PLL_Phase_Part(2:Simulation_Length)*180/pi);
title('PLL相位响应曲线图');
axis([1 Simulation_Length -2 2]);
grid on;
%设定显示范围
Show_D=300; %起始位置
Show_U=900; %终止位置
Show_Length=Show_U-Show_D;
subplot(2,2,3)
plot(Signal_Channel(Show_D:Show_U),'*');
title('输入PLL的数据星座图');
axis([-2 2 -2 2]);
grid on;
hold on;
subplot(2,2,3)
plot(Signal_PLL(Show_D:Show_U),'r*');
grid on;
subplot(2,2,4)
plot(Signal_PLL(Show_D:Show_U),'r*');
title('PLL锁定和稳定后的数据星座图');
axis([-2 2 -2 2]);
grid on;
figure
%设定显示范围
Show_D=300; %起始位置
Show_U=350; %终止位置
Show_Length=Show_U-Show_D;
subplot(2,2,1)
plot(I_Data(Show_D:Show_U));
grid on;
title('I路信息数据');
axis([1 Show_Length -2 2]);
subplot(2,2,2)
plot(Q_Data(Show_D:Show_U));
grid on;
title('Q路信息数据');
axis([1 Show_Length -2 2]);
subplot(2,2,3)
plot(I_PLL(Show_D:Show_U));
grid on;
title('PLL输出I路信息数据');
axis([1 Show_Length -2 2]);
subplot(2,2,4)
plot(Q_PLL(Show_D:Show_U));
grid on;
title('PLL输出Q路信息数据');
axis([1 Show_Length -2 2]);
pll.rar_锁相环
版权申诉
149 浏览量
2022-09-22
23:19:46
上传
评论
收藏 1KB RAR 举报
四散
- 粉丝: 54
- 资源: 1万+
最新资源
- las格式点云数据使用详解(附VS编译好的LAStools工具)
- KRPano插件一键解密大师1.4.0 (解压密码1234)
- 《C++沉思录》是一本由 Scoot Meyers 所著的经典 C++ 编程书籍 该书深入探讨了 C++ 的一些高级概念和技术
- 海信刷机数据 LED42K310X3D(0000)BOM1-C006软件数据与LED42K310NX3D(0000)BOM1通用
- 送货单打印软件单机版直接单机运行不需要网络
- pycdc工具,Python3.9及以上可用的反编译工具(exe转py)
- 计算机网络基础练习题.pdf
- SDIO接口远距离无线图传WIFI6模块TT-S6D2TR-105HP
- 海信智能电视刷机数据 LED42K280J3D(1000) 生产用软件数据 务必确认机编一致 强制刷机 整机USB升级程序
- 步进电机控制实验-原理图-软件代码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈