- auto compensate cyclic prefix

git-svn-id: http://moon:8086/svn/matlab/trunk@25 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
2015-04-05 14:07:25 +00:00
parent 81650fd21b
commit bddaaee2d5
2 changed files with 29 additions and 10 deletions
+4 -5
View File
@@ -1,8 +1,7 @@
function [omega, err, dmod, omega_coarse, omega_est] = fdet(x, N, Ng, omega_min, omega_step, omega_max)
function [omega, err, dmod, omega_coarse, omega_est] = fdet(x, N, Ng, off, omega_min, omega_step, omega_max)
%
% Example: fdet_eval(1200, pi/4, -10, [1100 1350 1])
K = fix(length(x-Ng)/(N+Ng));
K = fix((length(x)-Ng)/(N+Ng))-1;
% Initial guess
omega_coarse = fdet_coarse(x, N, omega_min, omega_step, omega_max);
@@ -10,12 +9,12 @@ omega_coarse = fdet_coarse(x, N, omega_min, omega_step, omega_max);
phi_est = 0;
omega_est = omega_coarse;
off = 0;
for k=1:K
omega(k) = omega_est;
xp = x((k-1)*(N+Ng)+off+1:k*(N+Ng)+off);
x_est = exp(-j*(2*pi*omega_est*(0:N-1)' + phi_est));
dmod(k) = sum(xp(Ng+1:N+Ng).*x_est);
iq = xp(Ng+1:N+Ng).*x_est;
dmod(k) = sum(iq);
phi = angle(dmod(k));
omega_f = phi/N/(2*pi);
err(k) = omega_f;