2016-03-23 03:47:18 -07:00
|
|
|
function [cfo, r] = cfo_estimate_cp(input_slot, Nsyms, sym_len, cp0_len, cp_len)
|
2014-01-28 03:41:17 -08:00
|
|
|
|
2015-05-13 02:44:01 -07:00
|
|
|
% Start correlating from the end. Nsyms is the number of symbols to
|
|
|
|
% correlate starting from the end.
|
|
|
|
|
|
|
|
s=length(input_slot)-sym_len-cp_len;
|
|
|
|
e=length(input_slot)-sym_len;
|
|
|
|
for i=1:Nsyms
|
|
|
|
r(i)=sum(input_slot(s:e).*conj(input_slot(s+sym_len:e+sym_len)));
|
|
|
|
if (i < 7)
|
|
|
|
s=s-sym_len-cp_len;
|
|
|
|
e=e-sym_len-cp_len;
|
|
|
|
else
|
|
|
|
s=s-sym_len-cp0_len;
|
|
|
|
e=e-sym_len-cp0_len;
|
|
|
|
end
|
2014-01-28 03:41:17 -08:00
|
|
|
end
|
2015-05-13 02:44:01 -07:00
|
|
|
cfo=-angle(mean(r))/pi;
|