- initial version
git-svn-id: http://moon:8086/svn/matlab/trunk@18 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
|||||||
|
function [omega, err, dmod, omega_coarse, omega_est] = fdet(x, N, omega_min, omega_step, omega_max)
|
||||||
|
%
|
||||||
|
% Example: fdet_eval(1200, pi/4, -10, [1100 1350 1])
|
||||||
|
|
||||||
|
K = fix(length(x)/N);
|
||||||
|
|
||||||
|
% Initial guess
|
||||||
|
omega_coarse = fdet_coarse(x, N, omega_min, omega_step, omega_max);
|
||||||
|
|
||||||
|
% Initial guess
|
||||||
|
omega_coarse = fdet_coarse(x, N, omega_min, omega_step, omega_max);
|
||||||
|
|
||||||
|
phi_est = 0;
|
||||||
|
omega_est = omega_coarse;
|
||||||
|
|
||||||
|
for k=1:K
|
||||||
|
omega(k) = omega_est;
|
||||||
|
xp = x((k-1)*N+1:k*N);
|
||||||
|
x_est = exp(-j*(2*pi*omega_est*(0:N-1)' + phi_est));
|
||||||
|
dmod(k) = sum(xp.*x_est);
|
||||||
|
phi = angle(dmod(k));
|
||||||
|
omega_f = phi/N/(2*pi);
|
||||||
|
err(k) = omega_f;
|
||||||
|
omega_est = omega_est + omega_f;
|
||||||
|
dphi_est = 2*pi*mod(omega_est*N, 1);
|
||||||
|
phi_est = mod(phi_est + dphi_est, 2*pi);
|
||||||
|
end;
|
||||||
Reference in New Issue
Block a user