📄 synchro.m
字号:
% synchronization
% estimation of the delay caused by the channel
% SNR should be estimated before using this function..
% training bits can maybe estimate this value (computations using variance
% of the signal)
% to have an idea of the ML estimation used, see
% http://epubl.luth.se/avslutade/0280-8242/96-14/lic.pdf
function theta= synchro(r,L,N,SNR)
% r is the received sequence, length depending on the size of buffers, etc.
% L is the size of the cyclic prefix
% N is the size of a frame (without the prefix)
Lr = length(r);
gamma = zeros(1,Lr-L-N);
epsilon = zeros(1,Lr-L-N);
for t = 1 : Lr - L -N
temp1 = r(t:t+L-1).*conj(r(t+N:t+N+L-1));
gamma(t) = sum(real(temp1));
temp2 = (abs(r(t:t+L-1))).^2 + abs(r(t+N:t+N+L-1)).^2;
epsilon(t) = sum(temp2);
end
rho = SNR/(SNR+1);
lik = real(gamma) - 1/2 * rho *epsilon;
% plot(lik)
[toto,theta] = max(abs(lik(1:60)));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -