资源简介
原版代码,可以运行。供做DPLL研究开发的朋友们参考借鉴。

代码片段和文件信息
% A second order DPLL design
% Block diagram
% +---+ e +-----------+ y
% x ------>| + |------>| H1(z) |---------+
% +---+ +-----------+ |
% ^ |
% | z +-----------+ |
% |---------| H2(z) |<--------+
% +-----------+
%
clear all
% number of bits in the quantizer
b = 15;
q = 1/2^b;
phase = 0;
amplitude = 5;
% DPLL parameters from closed-loop transfer function
g1 = 0.0147;
g2 = 0.0001;
% gain of the phase detector
Gpd = 1;
% VCO gain
Gvco = 1;
G1 = g1/(Gpd*Gvco);
G2 = g2/(Gpd*Gvco);
G = G1 + G2;
% input (reference) signal
t = 0:0.0001: 1;
f = 10;
%x = ones(1 1000); % step response only
if mod(t100) == 0
%phase = phase + rand()*360 ;
phase = phase + 100 ;
if phase > 360
phase = (phase-360);
end
end
%x = sin (amplitude * exp(j * (2*pi*f*t + phase) ) );
x = amplitude * sin (2*pi*f*t + phase )
%x = AWGN(temp_sine50); %AWGN(XSNR) adds white Gaussian noise to X. The SNR is in dB.
%x = chirp(t01150);
figure
plot(x);
% quantize x into b bits (Can take the following 3 lines out to compare
% with and without quantizer)
signs = sign(x);
signs(~signs) = ones(size(signs(~signs)));
x = q .* floor(abs(x./q) + 0.5) .* signs;
y(1) = (G1 + G2) * x(1);
z(1) = y(1);
% quantize y and z into b bits (Can take the following 6 lines out to
% compare with and with quantizer)
sign_y = sign(y(1));
sign_y(~sign_y) = ones(size(sign_y(~sign_y)));
y(1) = q .* floor(abs(y(1)./q) + 0.5) .* sign_y;
sign_z = sign(z(1));
sign_z(~sign_z) = ones(size(sign_z(~sign_z)));
z(1) = q .* floor(abs(z(1)./q) + 0.5) .* sign_z;
e(1) = x(1) - z(1);
for i = 2 : length(x)
% phase detector
e(i) = x(i) - z(i-1);
% loop filter H1(z) an IIR filter
y(i) = G * e(i) - G1 * e(i-1) + y(i-1);
% Can take the following 3 lines out to compare
% with and without quantizer
sign_y = sign(y(i));
sign_y(~sign_y) = ones(size(sign_y(~sign_y)));
y(i) = q .* floor(abs(y(i)./q) + 0.5) .* sign_y;
% VCO filter an IIR accumulator
z(i) = z(i-1) + Gvco * y(i);
% Can take the following 3 lines out to compare
% with and without quantizer
sign_z = sign(z(i));
sign_z(~sign_z) = ones(size(sign_z(~sign_z)));
z(i) = q .* floor(abs(z(i)./q) + 0.5) .* sign_z;
end
figure
plot(e);
figure
plot(y);
% equivalent close-loop transfer function the ideal case
Z = tf(‘z‘1);
H = (0.0148*Z - 0.0147)/(Z^2 -1.9852*Z +0.9853);
step = ones(11000);
step_response = lsim(H step 1:length(step));
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2734 2009-03-01 16:18 dpll.m
----------- --------- ---------- ----- ----
2734 1
- 上一篇:霍夫检测的算法
- 下一篇:MDS无线传感器网络定位算法MATLAB程序
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论