1
$\begingroup$

I am relatively new to time delay estimation. I am working on a project where I am estimating the time-delay from the phase of the cross-correlation function (CCF), since it is more reliable in compensation for the inaccuracy than merely using the absolute value of the CCF in estimating the time delay. I am also looking for how to calculate the phase error if my sampling frequency is three times my center frequency (I am using an LFM signal), and I'm taking time delays which range between -0.5Ts and 0.5Ts. Finally, FFT interpolation can help to limit phase jumps or wraps, by increasing the sampling rate. How is the resulting phase of the signal going to be affected? Here is a portion of my code:

clear all
close all
BW=48*10^3; %bandwidth
fs = 64*10^3;
T=1/fs; %pulse width
fc=200*10^3; %zero centered frequency
N=512; %sampling points
n = 0:N/2-1;
times =1;
Nrand = 1:100;
randn('state',0)
Noise = randn(1,N);
sampling_interval = T / N; %sampling interval
h = 0.01*T;
range =-0.5*T:h:0.5*T;

for w = 1:length(range)
for u = 1:length(Nrand)
tau = range(w);
freqlimit = 0.5 / sampling_interval;
alpha=BW/(T); %chirp rate
t=linspace(-T/2,T/2,N); %time interval
ichannel1=cos(2*pi*fc*t+alpha*pi*t.^2); %real part
qchannel2=sin(2*pi*fc*t+alpha*pi*t.^2); %imaginary part
LFMD=(ichannel1+(1i.*qchannel2)); %Complex Base band time domain signal
LFMD(2:1:10)=0;
LFMD(504:1:511)=0;
freq = linspace(-freqlimit/2,freqlimit/2,N);
FLFMD=(fft(LFMD,N)); %Frequency domain of Base band signal
[b,a] = butter(2,0.2);

%Fourier Transform of Random Signal
shift(w) =  range(w);
x = filter(b,a,LFMD);
EXP =(exp(-1i*2*pi.*n*(tau)./(N*sampling_interval)));
EXP = [EXP 1 conj(EXP(N/2:-1:2))];
% Delayed Signal

Fdelay = FLFMD.*EXP;
invFdelay = ifft(Fdelay,N);

Modified = (invFdelay);
y = filter(b,a,Modified);

bx = linspace(-N +1,N-1,1023);
delay =xcorr(y,x, 'coeff');
q =(abs(delay));
[l k] = max (abs(delay));

p=512;
XP = q((k-32):(k+31));
ns = length(XP); np = ceil((ns-1)/2);
Interpoll  = fft(XP);
padinter = (p/ns)*[Interpoll(1:np+1),zeros(1,p-ns),Interpoll((np+2):length(Interpoll))];
rsult = (ifft(padinter));
[lp kp] = max (rsult);

[lmax(w,:) kmax(u,:)] = max(delay);
 theata(w,:) = angle(lmax(w,:));
theta2(w,:) = atan2(imag(lmax(w,:)),real(lmax(w,:)));
%timed(w) = (theta2(w) + 2*pi)/(2*pi*fc);
timed1(w,:) = (theta2(w,:))/(2*pi);
Kmult(w,:) =abs(theta2(w,:)- 2*pi*fc*(timed1(w,:)))/(2*pi);
[l2 k2] = max ((delay)); 
end
end
$\endgroup$
  • 2
    $\begingroup$ Your code is pretty unreadable. At least indent it properly! $\endgroup$ – Henry Gomersall Jul 24 '12 at 14:52
  • 2
    $\begingroup$ "I am to estimate the time-delay from the phase of the Cross-correlation function(CCF), since it is more reliable in compensation for the inaccuracy of the merely using the absolute value of the CCF in estimating the time delay." I know nothing that supports that assertion. Care to provide an explanation or references that back it up? $\endgroup$ – Jim Clay Jul 24 '12 at 14:55
  • $\begingroup$ I am not really sure how you are differentiating "phase" of CCF from the normal time-delay associated with CCF. If by "phase" of the CCF you mean looking at the phase of the product of both your signals in the F-domain, then I do not believe this buys you anything. The time-delay of the CCF in time domain necessarily contains information on the average phase of the product of two signals' in F-domain, both of which encode the time-delay. $\endgroup$ – Spacey Jul 24 '12 at 14:58
  • $\begingroup$ @JimClay I took it to mean that by using the phase, one is doing an implicit band limited time domain interpolation, allowing time delays which are not rounded to a sample. Of course, this is possible in the TD, but is a bit more fiddly (and slower). $\endgroup$ – Henry Gomersall Jul 25 '12 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.