Let there be a discrete signal that is the sum of sinusoidals and can be described by $$s(n)=\sum_i A_i \mathrm{sin}(2\pi f_i \frac{n}{f_s}+\phi_i)$$ where $A_i, f_i, \phi_i$ are unknown but fixed parameters of my signal, $f_s$ is my sampling rate, and $n$ is the sample measured at time $t=\frac{n}{f_s}$.

Of this signal I measure the first $N$ samples ($n=1,2,3...N$) and I also measure another $N$ samples at points $n=N+20000,....2N+20000$. I am now interested in estimating/predicting/extrapolating the value of a single sample that is exactly in the middle between my measured chunks: $s(n=N+10000)$. I don't care about all the other samples in the gap.

What is the best and most efficient way to estimate my desired sample? Note that $N$ would be ideally between 100 to 1000 and my sampling rate $f_s=100\mathrm{MHz}$.

  • $\begingroup$ Do you know how many sinusoids you have a sum of? What is the range of the index $i$? $\endgroup$
    – Engineer
    Oct 18, 2020 at 19:11
  • $\begingroup$ I don't know that but I am willing to make assumptions. $\endgroup$ Oct 19, 2020 at 17:18
  • 1
    $\begingroup$ this is called sinusoidal modeling. lotsa papers written about it. i would suggest using a Gaussian window, DFT, peak picking, fitting each sinusoid, subtracting that sinusoid from the spectrum, and repeat. $\endgroup$ Oct 20, 2020 at 17:08

2 Answers 2


One natural way to do this is to use the the total $2N$ samples (two chunks of $N$ samples each) to estimate the parameters. Amplitude, frequency, and phase estimation are all textbook equations that you can look up so the problem here is the fact that they are all mixed together. If you are assuming that you don't know how many sinusoids are mixed, then you also have to detect how many are present. The basic pseudo code is:

Detect how many sinusoids there are
For each sinusoid:
    Estimate amplitude
    Estimate frequency
    Estimate phase
Reconstruct signal at n = N + 10000

Detect how many sinusoids there are

You can do this by detecting how many peaks there are in the FFT of the signal. A sinusoid will present a peak at its frequency. At a peak, the slope of the curve will change from positive to negative, so the slope has a zero crossing at the peak. For a discrete signal, there are different ways to compute the slope/derivative but I would start with the simple before moving to more sophisticated methods. A simple way to compute the derivative is just the difference, $x_d[n]=x[n]-x[n-1]$, and a zero crossing happens if $x_d[n-1] > 0 > x_d[n]$. This will give you the number of zero crossings and where they occur.


The model that was presented in the question is a noise free model, and the detection described relies on that. You can still use this zero crossing method for a noisy signal but need to apply a threshold because the noise will cause many small peaks to occur. The threshold is needed to keep only the ones that have a significant enough amount of energy. Threshold should be picked to satisfy some probability of false alarm metric that you desire.

Estimate ...

As I mentioned above, estimating the amplitude, frequency, and phase of a sinusoid can be found through the FFT peak finding method (and we already found the locations of the peaks) so we are all set.

Reconstruct signal

Now that we have all the estimates, you can calculate your equation using your estimates.

$$ \hat{s}(n+10000) = \sum_i \hat{A}_i \text{sin}\bigg( \frac{2\pi \hat{f}_i (n+10000)}{f_s} + \hat{\theta}_i \bigg) $$


Assuming that the number of the sinuses is less than $N$, this problem becomes solvable by the least mean squares. In the case of equality, should be solved by the usual matrix invention.

The liner form is achieved by replacing the phase variable $\phi_i$ with a cosine.

Once all the variables are estimated, the interpolation is done by simple substitution of the new points into the expression.

I think that a similar process was described in the last by Kay


Another option is to pad zeros in the not sampled locations and use the usual FFT spectrum estimation

  • $\begingroup$ How would you go about solving this with a least mean squares if there are less than N sinuses? Do you have a reference where this is described? $\endgroup$ Oct 22, 2020 at 7:45
  • $\begingroup$ if you have more equations (here data points) than variables (here coefficients before sines and cosines) the solution is achieved by least mean squares. Look in the attached link $\endgroup$ Oct 22, 2020 at 8:35
  • $\begingroup$ However, my variables are not only the amplitudes but also the frequency? I can assume that there are less than N sinuses but I can not preselect the frequencies. $\endgroup$ Oct 22, 2020 at 9:00
  • $\begingroup$ if you don't know the number of the frequencies I would create equally spaced frequencies and solve for them. Mind that what I suggest is very similar to the usual spectrum estimation but with a not uniform sampling rate $\endgroup$ Oct 22, 2020 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.