git-svn-id: http://moon:8086/svn/matlab/trunk@30 801c6759-fa7c-4059-a304-17956f83a07c
24 lines
396 B
Matlab
24 lines
396 B
Matlab
function [domega_f, Zf] = cfo_coarse_fract(x, N, Ng, L, Nd, Zi)
|
|
|
|
if (~isfield(Zi, 'valid'))
|
|
Zi = struct('valid', 1, 'n', 0, 'xp', [], 'p', 1.0);
|
|
end
|
|
Zf = Zi;
|
|
domega_f = 0;
|
|
|
|
Zf.xp = [Zf.xp' x']';
|
|
|
|
if (length(Zf.xp) < 2*(N+Ng))
|
|
n = Zf.n;
|
|
return
|
|
end
|
|
|
|
x1 = Zf.xp(1:L);
|
|
x2 = Zf.xp(Nd+1:Nd+L);
|
|
c = sum(x1 .* conj(x2));
|
|
|
|
domega_f = 1/(2*pi*N) * angle(c);
|
|
|
|
Zf.xp = x;
|
|
|