DSPRelated.com
Forums

Ofdm synchronisation, estimation of time and frequencyoffset

Started by bekolodwc June 28, 2007
Hi all,
nice to have subscribed in this site. But for the moment I got 1
problem , the synchronisation algorithm,or the Maximum Likelihood
estimation of time and frequency offset in OFDM systems with the
algoithm of "Jan Jaap van de beek, Magnus Sandell, and per Ola
Borjesson", in MATLAB (6.5, or 7(R2006a)).Here is the code, that I
have written but for the first time has worked, but not now, I don't
understand, Pleaz tell me something, CAN ANYONE HELP MEEE?????????
function [Xq]=ofdm_rxN2(X)
%m_it=0;
m_it= 20000;%m_it=length(X);

c=1;
%GAMMA=[];
PHI=[];
THETA_max=[];
RHO=[];
EPSILON_max=[];

while c<= (m_it-2304)

theta_ml=0;
b=c;
Xr=[];
Xs=[];
Xg=[];
Xgs=[];
Xgs1=[];
X_norm1=[];
X_norm2=[];
GAMMA=[];
DELTA=[];

rho_n=0;
rho_d=0;

RHO_k=0;
% d=0;
Xr=[Xr,X(b:b+255)];
Xs=[Xs,X(b+2048:b+2048+255)];

X_norm1=[X_norm1,(abs(Xr)).^2];
X_norm2=[X_norm2,(abs(Xs)).^2];

rho_n=mean(Xr.*(conj(Xs)));
rho_d=sqrt(mean((abs(Xr)).^2).*mean((abs(Xs)).^2));

GAMMA=Xr.*(conj(Xs));
RHO_ks(rho_n/rho_d);

RHO=[RHO,RHO_k];

PHI=(0.5).*(X_norm1+X_norm2);

DELTA=[DELTA,(abs(GAMMA)-(RHO_k.*PHI))];

theta_ml= max(DELTA);

d=find(DELTA==theta_ml);
Xg=[Xg,X(c+d:c+d+255)];
Xgs=[Xgs,X(c+d+2048:c+d+2048+255)];
Xgs1=[Xgs1,X(c+d+255:c+d+2048+255)];

THETA_max=[THETA_max,theta_ml];

end;

%e=1;
%while e<(int16(length(THETA_max)/2304))

% if (e==1)
EPSILON_max=[EPSILON_max,(-0.5./pi).*angle(max(THETA_max(2305:2305+2304)))];
% elseif (e>=2)
EPSILON_max=[EPSILON_max,(-0.5./pi).*angle(max(THETA_max((e*2304)+1:(e*2304)+2304)))];
% end;
% e=e+1;
%end;

figure(1);
subplot(2,2,1:2);
plot(1:length(RHO),RHO);
Title 'RHO';
grid on;
subplot(2,2,2:3);
plot(1:length(DELTA),DELTA);
Title 'DELTA';
grid on;
figure(2);
subplot(2,2,1:2);
plot(1:length(THETA_max),THETA_max);
Title 'THETA-max';
grid on;
subplot(2,2,3:4);
%plot(1:length(EPSILON_max),EPSILON_max,'o');
Title 'Epsilon-max';
grid on;