请问锁相环的问题
12-16
从网上下了一个锁相环的MATLAB程序,运行挺好。但是,其中有两个参数的选取不知道怎么搞的,请教一下各位。万分感谢。
程序如下:
close all;
clear all;
%**** Initialize the Varibales ******
fs = 12e6; %sampling rate
ts = 1/fs; %time delay
num = 2.5e6;
SNR = -15;
real_fc = 3563000; % real signal frequency
data = sin(2*pi*real_fc*(0:num-1)*ts+pi/4)+sqrt(10^(SNR/10))*randn(1,num); % input signal
fc = 3562800; % local signal
n = fs/1000; % accumulate time (1ms)
nn = [0:n-1];
nf = floor(length(data)/n);% divide input into nf 1ms block signal
wfc = 2*pi*fc; % loacal signal
phi_prv = 0;
temp = 0;
frame = 0;
pull_in_frames = 0;
carrier_phase = 0;
phase = 0;
% ***** Compute the PLL coefficients for the PLL_IN phase ******
[c1,c2] = calculatePLLCoef(0.707,30); %
% c1=1;
% c2=1;
for frame=1:nf
% ***** Generate local sine and consine replica *****************
expcol = exp(j*(wfc*ts*nn+phase));
sine = imag(expcol);
cosine = real(expcol);
% ***** Take 1ms of data from the input data **********************
x = data((1:n)+((frame-1)*n));
% **** Convent the signal down to baseband ***********************
x_sine = xsine;
x_cosine = xcosine;
% ***** Correlate the baseband signal with the three local replica **
Q = sum(x_sine);
I = sum(x_cosine);
% **** Code and Phase discriminators *************************
phase_discri(frame) = atan(Q/I);
pull_in_frames = pull_in_frames+1;
%if pull_in_frames == 30
% [c1,c2] = calculatePLLCoef(0.707,15);
%end
% ******* Phase lock loop (PLL) ************
dfrq = c1*phase_discri(frame)+temp; % remember output of filter is frequency
temp = temp+c2*phase_discri(frame);
wfc = wfc-dfrq*2*pi; % change local frequency(must be -)
dfrq_frame(frame) = wfc; % save the changes of local frequency (also can save dfrq_frame(frame)=dfrq)
phase = wfc*ts*n+phase; % make the phase of each block continue (note: n=5000)
end
plot(dfrq_frame/(2*pi));
hold on
plot(fc,'r');
legend('PLL tracking','Real Carrier frequency');
grid
mean_freq=mean(dfrq_frame)
function [c1,c2] = calculatePLLCoef(zeta,bandwidth);
% Calculates coefficients used in the carrier tracking loop(PLL)
% zeta : tamping factor
% bandwidth : nosie bandwidth
tUpd = 0.001; %integration time
gain = 0.0005; % gain
~~~~~~~~~~~~~~~~~~请问这个参数是如何选取的?我试过改成0.005就不行了。查了很多资料,也没有搞懂呀。
wT = (2*bandwidth*zeta)/(zeta^2+0.25)*tUpd; %natural frequency
c1 = (1/gain)*(8*zeta*wT)/(4+4*zeta*wT+wT^2);
c2 = (1/gain)*(4*wT^2)/(4+4*zeta*wT+wT^2);
万分感谢
程序如下:
close all;
clear all;
%**** Initialize the Varibales ******
fs = 12e6; %sampling rate
ts = 1/fs; %time delay
num = 2.5e6;
SNR = -15;
real_fc = 3563000; % real signal frequency
data = sin(2*pi*real_fc*(0:num-1)*ts+pi/4)+sqrt(10^(SNR/10))*randn(1,num); % input signal
fc = 3562800; % local signal
n = fs/1000; % accumulate time (1ms)
nn = [0:n-1];
nf = floor(length(data)/n);% divide input into nf 1ms block signal
wfc = 2*pi*fc; % loacal signal
phi_prv = 0;
temp = 0;
frame = 0;
pull_in_frames = 0;
carrier_phase = 0;
phase = 0;
% ***** Compute the PLL coefficients for the PLL_IN phase ******
[c1,c2] = calculatePLLCoef(0.707,30); %
% c1=1;
% c2=1;
for frame=1:nf
% ***** Generate local sine and consine replica *****************
expcol = exp(j*(wfc*ts*nn+phase));
sine = imag(expcol);
cosine = real(expcol);
% ***** Take 1ms of data from the input data **********************
x = data((1:n)+((frame-1)*n));
% **** Convent the signal down to baseband ***********************
x_sine = xsine;
x_cosine = xcosine;
% ***** Correlate the baseband signal with the three local replica **
Q = sum(x_sine);
I = sum(x_cosine);
% **** Code and Phase discriminators *************************
phase_discri(frame) = atan(Q/I);
pull_in_frames = pull_in_frames+1;
%if pull_in_frames == 30
% [c1,c2] = calculatePLLCoef(0.707,15);
%end
% ******* Phase lock loop (PLL) ************
dfrq = c1*phase_discri(frame)+temp; % remember output of filter is frequency
temp = temp+c2*phase_discri(frame);
wfc = wfc-dfrq*2*pi; % change local frequency(must be -)
dfrq_frame(frame) = wfc; % save the changes of local frequency (also can save dfrq_frame(frame)=dfrq)
phase = wfc*ts*n+phase; % make the phase of each block continue (note: n=5000)
end
plot(dfrq_frame/(2*pi));
hold on
plot(fc,'r');
legend('PLL tracking','Real Carrier frequency');
grid
mean_freq=mean(dfrq_frame)
function [c1,c2] = calculatePLLCoef(zeta,bandwidth);
% Calculates coefficients used in the carrier tracking loop(PLL)
% zeta : tamping factor
% bandwidth : nosie bandwidth
tUpd = 0.001; %integration time
gain = 0.0005; % gain
~~~~~~~~~~~~~~~~~~请问这个参数是如何选取的?我试过改成0.005就不行了。查了很多资料,也没有搞懂呀。
wT = (2*bandwidth*zeta)/(zeta^2+0.25)*tUpd; %natural frequency
c1 = (1/gain)*(8*zeta*wT)/(4+4*zeta*wT+wT^2);
c2 = (1/gain)*(4*wT^2)/(4+4*zeta*wT+wT^2);
万分感谢
推荐一本书“数字锁相环路原理与应用”胡华春,石玉,上海科学技术出版社
超星上有,图书馆也应该有。个人感觉写的比较明白。
相关文章:
- 问一下,锁相环中的自然频率是什么概念 ?(05-08)
- 请教有关PLL锁相环技术在通讯中的有关问题,寻大牛。(05-08)
- 请教参数估计方法与锁相环获取同步的区别与联系(05-08)
- 弱问长问数字锁相环NCO的增益怎么计算(05-08)
- 请教一些关于设置数字锁相环的环路参数的方法,谢谢!(05-08)
- 数字锁相环该怎样抵消幅度大小的影响?(05-08)
射频专业培训教程推荐