I am using the following system: Ultrasonic chirp signals with central frequency 100kHz are being transmitted using ultrasonic sensor. After the transmission through the medium(air/solid/liquid/combination) they are being received with hydrophone. The system is being controled by DSP and signal generation and acquisition is obtained via DAC and ADC. After reception we are performing demodulation and then complex matched filtering. Our aim is to detect the time of arrival between transmission and reception. So far I have been only observing the peak of absolute value of matched filter output as the moment that corresponds to time of arrival, but if I am correct the phase of the matched filter output can also be used. My question is, should the phase of matched filter output be zero at the moment of the peak in the absolute value of matched filter output?
3 Answers
For a constant frequency signal, with no frequency offset between transmitter and receiver, the phase of a complex correlation, at the correlation peak, is the phase difference between the received signal and the reference signal used for the matched filter. It need not be 0. And that is for the actual correlation peak, which may have to be obtained by interpolation between the two samples that surround the peak.
I haven't worked out the math for a chirp. I would not rely on the phase of the complex correlation being 0 at the correlation peak.
-
$\begingroup$ And as far as peak of matched filter output is concerned, should it be right at the position of reference signal within the received, if I just consider received signal as a delayed version of the reference signal (for example in Matlab)? $\endgroup$– Deanna77Jun 25, 2020 at 12:29
-
1$\begingroup$ The peak output of the the matched filter (aka correlation filter) occurs when the all the received samples of the copy of the desired signal are shifted into the filter. Thus at the of the received chirp in your case. $\endgroup$ Jun 25, 2020 at 13:03
As explained in the comments for previous versions of this question, a matched filter alone (using the cross-correlation specifically which can be done efficiently with FFT's) should be used with caution for purposes of estimating time delay. The reason why has been detailed in this other post linked below along with a robust least-square solution for estimating the average delay when the sounding signal properly occupies the complete spectral bandwidth of the channel.
A Delay Between Two Filtered Chaotic Signals
For non-dispersive channels the simpler approach using the cross-correlation (matched-filter) can be done in which case the following relationship can be used for efficient FFT implementation:
$$XCORR = \text{ifft}(\text{fft}(t(n))\text{fft}^*(r(n)))$$
Where (*) represents the complex conjugate. This is to say that the circular cross-correlation between the signals $t(n)$ and $r(n)$ is equal to the inverse FFT of the complex conjugate product of their FFT's.
The phase of the result would provide a precise delay measurement if a single frequency was used since time delay is the negative derivative of phase with respect to frequency. At any given frequency the period is $2\pi$ radians, thus the phase for any given tone is modulo with the delay according to:
$$\theta = 2\pi \tau f$$
Where $\tau$ is the delay and $f$ is the frequency of the tone.
Given the OP is using a chirp, a frequency domain measurement of the channel transfer function could then provide delay from phase given the above relationship (and for a non-dispersive channel we would see a linear phase result versus frequency). This is in fact the reason why in my first paragraph that for all cases when the phase is not linear, a simple matched filter result cannot be effectively used to determine the time delay of the channel since the delay is variable versus frequency. This frequency domain result specifically can be used to determine that variability and therefore the practicality of time of arrival measurements for the given channel.
Using the common EE definition for Fourier Transform:
$$ X(f) \triangleq \mathscr{F} \Big\{ x(t) \Big\} \triangleq \int\limits_{-\infty}^{+\infty} x(t) \, e^{-i 2 \pi f t} \ \mathrm{d}t $$
and inverse:
$$ x(t) \triangleq \mathscr{F}^{-1} \Big\{ X(f) \Big\} = \int\limits_{-\infty}^{+\infty} X(f) \, e^{+i 2 \pi f t} \ \mathrm{d}f $$
A generalized chirp signal would look like:
$$\begin{align} x(t) &\triangleq e^{-\pi \alpha t^2} \, e^{i \pi \beta t^2} \, e^{i 2 \pi \mathcal{F} t } e^{2 \pi \lambda t } \\ &= e^{-\pi (\alpha - i\beta) t^2} e^{i 2 \pi (\mathcal{F}-i\lambda) t } \\ &= e^{-\pi (\sqrt{\alpha - i\beta} \, t)^2} e^{i 2 \pi (\mathcal{F}-i\lambda) t } \\ &= e^{-\pi \mathcal{F}^2} e^{-\pi (\sqrt{\alpha - i\beta} \, t - i(\mathcal{F}-i\lambda))^2} \\ &= e^{-\pi \mathcal{F}^2} e^{-\pi (\sqrt{\alpha - i\beta} \, t - i\mathcal{F}-\lambda))^2} \\ \end{align}$$
and have Fourier Transform:
$$ X(f) = \frac{1}{\sqrt{\alpha - i\beta}} \, e^{- \pi (f-\mathcal{F}+i\lambda)^2/(\alpha - i\beta)} $$
The effective width of the Gaussian window is proportional to $\frac{1}{\sqrt{\alpha}}$ (what the constant of proportionality is maybe debated). $\beta$ is the sweep rate, $\mathcal{F}$ is the instantaneous frequency of the chirp at the center of the window, and $\lambda$ is an amplitude ramp rate parameter (for small $\lambda$, then $e^{2 \pi \lambda t} \approx 1+2\pi\lambda t$ for all $t$ where the Gaussian window is not extremely close to zero.
Now let's not worry too much about causal filters for the moment.
You want your matched filter to really light up at $t=0$ when your chirp is input. The output of the matched filter is:
$$ y(t) = \int\limits_{-\infty}^{\infty} h(u) x(t-u) \ \mathrm{d}u $$
At $t=0$ it's
$$ y(0) = \int\limits_{-\infty}^{\infty} h(u) x(-u) \ \mathrm{d}u $$
I think you want $h(u)$ and $x(-u)$ to be complex conjugates at that time $t=0$.
$$\begin{align} x(-t) &= e^{-\pi \alpha t^2} \, e^{i \pi \beta t^2} \, e^{-i 2 \pi \mathcal{F} t } e^{-2 \pi \lambda t } \\ \\ h(t) = x^*(-t) &= e^{-\pi \alpha t^2} \, e^{-i \pi \beta t^2} \, e^{i 2 \pi \mathcal{F} t } e^{-2 \pi \lambda t } \\ \end{align} $$
So the impulse response of the matched filter will be the same as the chirp, with the same gaussian window of the same width and the same frequency $\mathcal{F}$ in the center of the window. But $h(t)$ has the opposite sweep rate, if $x(t)$ is chirping up, then $h(t)$ is chirping down. And the ramp rate $\lambda$ is also negated. If $x(t)$ is tilted ramping up, then $h(t)$ is tilted ramping down.