资源简介
锁相环路,注释很清楚
代码片段和文件信息
%%%%%%%%%%%%%%costas_PLL
close all
clear all
format long
%%%%%%%%%%%%%%%%%%%%%%
aa = input(‘input original phase of signal(degree):‘)
bb = input(‘input doppler of signal(Hz):‘)
dt = 0.001
t = 0:dt:20
num = length(t)
flo = 40;
df = bb;
A = 1;
fin = flo + df;
PHin = aa * pi/180; %pi/12;
PHase_in = 2 * pi * fin * t + PHin;
input_sig = A * sin(PHase_in);
%%%%%%%%%%%%%%
sum_time = 50;%积分时间
PHout = zeros(11);
PHase_out = 2 * pi * flo * t(1:sum_time) + PHout;
lo_sin = zeros(1sum_time);
lo_cos = zeros(1sum_time);
lo_sin(1:sum_time) = sin(PHase_out);
lo_cos(1:sum_time) = cos(PHase_out);
%%%%%%%%%%%%%%%%%%%
w12 = 0;
w22 = 0;
w32 = 0;
w52 = 0;
G = 106;%%%%%%%加快收敛速度
par2 = 10;
par1 = 1;
K = 1/2;
%%%%%%%%%%%%%%%%%%%
for n = 1:1:round(num/sum_time)-1
w12 = 0;%积分前清零
w22 = 0;%积分前清零
for m = 1:1:sum_time
nn = (n - 1) * sum_time + m;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%下变频混频
mix_sin(nn) = input_sig(nn) * lo_sin(nn);
mix_cos(nn) = input_sig(nn) * lo_cos(nn);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%低通滤波器
w11 = w12 + mix_sin(nn) * dt/2;
w13 = w11 + w12;
w12 = w11;
w21 = w22 + mix_cos(nn) * dt/2;
w23 = w21 + w22;
w22 = w21;
end
%%%%%%%%%%%%%%%%%%%%%PD鉴相器
%x = w13 * w23;
% x = atan(w23/w13);%2相鉴相
%x = w23/w13;%
x = atan2(w23w13);%4相鉴相
%%%%%%%%%%%%%%%%%%%%
xouttemp(n) = x;
pll_locked_sin(n) = sin(x);
pll_locked_cos(n) = cos(x);
%%%%%%%%%%%%%%%%%%%有源比例积分环路滤波器LF
w41 = G * sin(x);
w42 = w41 * par2/par1;
w43 = w41 * 1/par1;
w31 = w32 + w43 * dt/2;
w33 = w32 + w31;
w32 = w31;
y = w42 + w33;
%%%%%%%%%%%%%%%%%%%%VCO相位输出
w51 = w52 + y * dt/2;
w53 = w51 + w52;
w52 = w51;
PHout = K * w52;
PHouttemp(n) = PHout;
%%%%%%%%%%%%%%%%%%%%LUT输出正弦、余弦
for m = 1:1:sum_time
nm = n * sum_time + m
PHase_out(nm) = 2 * pi * flo * (nm) * dt + PHout;
PHase_outtemp(nm) = PHase_out(nm);
lo_sin(nm) = sin(PHase_out(nm));
lo_cos(nm) = cos(PHase_out(nm));
%%%%%%%%%%%%%%%%%%%%
lo_sin_out(nm) = lo_sin(nm);
lo_cos_out(nm) = lo_cos(nm);
end
end
figure(1)
subplot(211)
plot((1:num)PHin * 180/pi)
title(‘original phase of input signal‘)
xlabel(‘sample times‘)
ylabel(‘degree‘)
grid on
subplot(212)
plot((1:num)PHase_in.* 180/pi);
title(‘phase of input signal‘);
xlabel(‘sample times‘)
ylabel(‘degree‘)
grid on
figure(2)
subplot(211)
plot((1:length(PHouttemp))PHouttemp.* 180/pi + 15)
title(‘costas loop vco phase output‘)
xlabel(‘sample times‘)
ylabel(‘degree‘)
grid on
subplot(212)
plot((1:length(PHase_outtemp))PHase_outtemp.* 180/pi)
title(‘costas loop track phase‘)
xlabel(‘sample times‘);
ylabel(‘degree‘);
grid on
figure(3)
subplot(311)
plot((1:length(xouttemp))xouttemp.* 180/pi)
title(‘costas loop track error‘)
xlabel(‘sample
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3677 2012-05-05 13:23 costas_PLL.m
相关资源
- 基于Matlab的最大熵模糊图像复原算法
- KITTI雷达点云与图像数据融合matlab源码
- matlab 解码 NMEA0183格式GGA数据
- 一个有关飞机的模板匹配的跟踪的m
- 基于MATLAB的电弧模型仿真
- PRI信号分选
- Matlab论文:基于Matlab的二进制数字调
- 802.11协议吞吐量随节点数性能仿真
- matlab图片rgb转yuv,存.yuv文件 播放器
- Duda模式分类Pattern Classification MATLAB 代
- dijkstra算法的matlab实现31274
- 随机路径生成函数matlab
- matlab语音信号处理工具箱
- matlab2013激活文件
- matlab实现游程编码
- 暗通道先验+引导滤波MATLAB代码
- 边缘检测中的canny算法及其matlab实现
- 通过达曼光栅生成点阵的matlab程序.
- MATLAB核函数算法
- 求控制系统的性能指标MptrtsFAI,matl
- matlab 求DTFT
- 逆变器重复控制算法MATLAB仿真
- MATLAB R2014b 许可协议文件
- matlab读取comtrade格式的程序
- 基于Matlab的RC一阶电路仿真
- Las点云数据读取代码
- 雷达回波加天线方向图模拟程序
- MATLAB 2017b 安装文件及其破解文件百度
- Matlab实现音频降噪
- matlab实现导航卫星系统中计算多普勒
评论
共有 条评论