# Finding the parameters and endpoints of a sinusoid

Suppose I have some signal

s(t) = n(t) + \left\{\begin{aligned} &0 &&: t < t_0\\ &A e^{i (2 \pi f t + \theta_0)} &&: t_0 \le t \le t_1\\ &0 &&: t > t_1 \end{aligned} \right.

with unknown beginning and end times, $t_0$, $t_1$, and unknown frequency, initial phase and amplitude $f$, $\theta_0$, $A$. The signal also has some complex Gaussian white noise $n$ with a variance of $\sigma_n^2$, giving this signal an SNR of $A^2/\sigma_n^2$.

My typical SNR is about 0.0025

I am interested in finding the unknown parameters above, particularly the beginning and end times to as high precision as possible.

I am also interested in knowing the theoretical limit on the precision of the start and end times vs SNR and signal length/number of samples. As the SNR increases information which determines $f$, $t_0$, and $t_1$ is lost. It seems like there should be some abstract, information theoretic way to relate the SNR to the estimation accuracy of these variables which is method agnostic.

If this is possible I can figure out whether or not I can reach the required precision on these variables by improving my analysis software or if I need to make hardware changes to improve the SNR.

My current method is to use an FFT to identify $f$, and then bandpass around it to remove most of the noise. I compute the amplitude of the signal. The noise amplitude distribution is second order chi ($\chi$) where $\sigma_n$ is the scale of the distribution. I fit the noise in my band passed region to this distribution by maximizing a likelihood function on $\sigma_n$ over a region where I know there is no signal.

$$\mathcal{L}(\sigma_n) = \sum_\text{noise samples} p_\chi(\sigma_n)$$

Then I maximize a likelihood as a function of $t_0$, and $t_1$ like so:

$$\mathcal{L}(t_0, t_1) = \sum_{t=0}^{t_0} p_\chi(\sigma_n) + \sum_{t=t_0}^{t_1} p_\text{norm}(\mu_s, \sigma_s) + \sum_{t=t_1}^{t_\text{max}} p_\chi(\sigma_n)$$

The signal distribution is a non central chi distribution, but that approximates to a Gaussian distribution reasonably well in the range I am working in. I am setting $\mu_s$ and $\sigma_s$ to the sample mean and standard deviation for the $t$s between $t_0$ and $t_1$ so they don't need to be optimized over.

This method gives me $f$, $t_0$, and $t_1$ reasonably quickly accurately, but is there a way to do it better?

• probably reading up on the Hilbert transform and the Analytic signal might be useful. you can get both amplitude envelope and instantaneous frequency from the Analytic signal. – robert bristow-johnson Dec 16 '17 at 3:25
• In the radar application where one is interested in detecting an echo whose duration is essentially known, that is, $t_1-t_0$ is known, the standard way is to pass $s(t)$ through a matched filter where the filter is matched to a sinusoid of duration $t_1-t_0$ and look for a peak in the matched filter output. Performance is improved if the sinusoid is phase-coded so that the matched filter output is not a broad triangle as in the case of your signal but more peaky. A Barker sequence or a longer sequence with good aperiodic autocorrelation properties is best for the phase coding. – Dilip Sarwate Dec 16 '17 at 4:11
• OP doesn't know the frequency, $f$. but if the OP knew a range of permitted frequencies, one could make a bank of matched filters. – robert bristow-johnson Dec 16 '17 at 4:55
• I do not know $t_1-t_0$, but I agree, that is the perfect solution if I did. The $\Delta f$ is in the 100s of MHz. TBH I'm not sure if the radar tag belongs here. This isn't a radar problem but I thought It was similar enough that those sorts of solutions might be useful, maybe not. Also, @robertbristow-johnson, thanks for fixing my exponent! – alessandro Dec 17 '17 at 0:23