资源简介
原版代码,可以运行。供做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程序
相关资源
- MDS无线传感器网络定位算法MATLAB程序
- Matlab常微分方程的解法
- radon变换车牌倾斜校正Matlab代码
- K-L变换算法
- 求解二次规划问题的拉格朗日及有效
- 雷电感应电压matlab
- 有约束的最小最大值matlab程序
- bpsk在高斯白噪声信道中调制解调MAT
- 基于MATLAB的图像增强处理
- 卡尔曼滤波算法原理及MATLAB源程序
- MATLAB 软件最大功率跟踪
- MATLAB软件BOOST电路仿真
- 蚁群算法解决TSP问题MATLAB程序
- DCT变换和DFT变换 数字图像压缩 Mat
- 二值化算法:Otsu算法、Bernsen算法、
- LSB 数字水印,matlab源程序,很好的资
- 嵌入式上位机利用matlab GUI界面进行数
- 二维对称图像矩阵ICA人脸识别MATLAB源
- matlab peak detection peak area 峰识别 面积
- matlab实现模式识别的聚类分类算法
- matlab卷积码仿真代码
- 维纳滤波器matlab代码
- matlab实现graphcut算法
- matlab迷宫
- matlab实现 中值滤波去除基线漂移
- 2个matlab BP分类代码
- 拥有matlab用户界面的卡尔曼滤波程序
- MATLAB中为GUI添加背景图片的方法
- 数字锁相环的MATLAB仿真源码
- matlab(边界提取链码生成差分链码生
评论
共有 条评论