# Amplitude estimation of sinusoid in known spiky spectral noise

What is the "best" way to estimate amplitude of a known-frequency sinusoid in the presence of known spiky spectral noise (i.e. noise comprising a few spectral peaks at known frequencies)?

• By "best", I mean highest accuracy and lowest variance for a given sampling period (assume the sampling rate is greater than the Nyquist frequency).
• The phases of the spectral noise peaks are unknown, but the phase of the sinusoid of interest can be provided if it's useful.

The approaches I am aware of are:

1. Perform a DFT at the frequency of interest, and design the window function such that its nulls/zero-crossings are located at the known noise frequencies.
2. Use a least squares estimator (which is basically a DFT with a rectangular window?, and which wrongly assumes that the noise samples are uncorrelated), e.g. as described in this survey paper.

I can't think of a better way than method (1), which does not benefit from phase information, but I'm wondering if a better approach could be used which may even take advantage of phase information of the signal of interest.

Just as a note, though I don't quite understand why, I noticed that the nulls of a rectangular window fall at integer multiples of the frequency that completes exactly one cycle in the sampling period.

• Is the frequency known or to be estimated as well? Nov 15, 2019 at 9:55
• @JonasSchwarz Yes, it's known.
– abc
Nov 15, 2019 at 13:21

The best fit time domain solution can be found by constructing two two basis vectors with your known frequency and calculate the coefficients directly. The magnitude and phase can then be directly determined from these values.

Let C be a vector of cosine values over your frame and S be a vector of sine values. You then want to find $$(a,b)$$ so that $$aC + bS$$ is a close as possible to your function.

$$F = a C + b S$$

Dot this with the basis vectors.

$$C \cdot F = a C \cdot C + b C \cdot S$$

$$S \cdot F = a S \cdot C + b S \cdot S$$

Since the dot products are scalars, this is simply a linear system of two equations with two unknowns. If you have a whole number of cycles in your frame then $$C \cdot S$$ and $$S \cdot C$$ become zero and the solution is trivial.

Note, this operation is the equivalent of a single bin in a DFT with the right parameters. That is, pick a DFT frame with a whole number of cycles of your known frequency, and look at the corresponding bin.

The general case, without cycle alignment, can also be solved in the frequency domain with way fewer calculations. See my blog article:

Do this for each of your peaks. For better results, subtract out the peaks you have found before processing the others.

• Thank you, Cedron. However, regarding your last comment, are you sure subtracting out the other peaks is always appropriate? E.g., assume you sample for 1 period of the noise frequency f, and the signal of interest has frequency 2*f; then wouldn't the rectangular window (i.e. of a standard dft) result in the fundamental frequency already being filtered out? ...
– abc
Nov 15, 2019 at 16:01
• Compare <wolframalpha.com/input/?i=int_%7B0%7D%5E%7B1%2F60%7D+sin%282*pi*120*t%29*%28sin%282*pi*120*t%29%2Bsin%282*pi*60*t%29%29+dt> vs <wolframalpha.com/input/?i=int_%7B0%7D%5E%7B1%2F60%7D+sin%282*pi*120*t%29*%28sin%282*pi*120*t%29%29+dt>
– abc
Nov 15, 2019 at 16:01
• @abc If you can pick your DFT frame so that the pure tones have a whole number of cycles per frame, then their DFT results will all fall into single bins. In this case, there is no need to remove them. Otherwise, the "leakage" may interfere with your reading. If you know the frequency (there are many frequency estimation techniques on top of the exact ones I have found and written about) of your interfering signals, you can also then estimate their phase and magnitude and subtract them out of your signal, or subtract their effect from the DFT using my bin value equations. Nov 15, 2019 at 16:16
• @abc The Wolfram links seem to link to a case of sin(2), which is just a constant. Immaterial to this discussion. Nov 15, 2019 at 16:17
• @abc You might find this article useful as well: dsprelated.com/showarticle/1284.php Nov 15, 2019 at 16:25