I have a discrete signal. I want to do sinusidal regression to estimate the parameters such as amplitude,phase, frequency etc It is important to note I only have the signal values and have no time when these values were recorded.

How could I possibly do the sine regression?


  • 1
    $\begingroup$ Are the time intervals between samples equidistant? $\endgroup$ – Matt L. Apr 18 '13 at 6:51
  • $\begingroup$ @Matt, yes the time intervals are equidistant $\endgroup$ – Shan Apr 18 '13 at 14:54
  • $\begingroup$ If there is additive noise, do least-squares regression. $\endgroup$ – Emre Apr 18 '13 at 18:35

If your samples are equidistant you can use a model function like $$\hat{x}(n)=a\sin(bn+c)+d$$ where $n$ is your sample index. You can compute the parameters $a,b,c,d$ by setting up an overdetermined nonlinear system of equations.

Let $x(n)$ be your signal. Then you'll have

$$a\sin(b\cdot 0 + c) + d = x(0)\\ a\sin(b\cdot 1 + c) + d = x(1)\\ a\sin(b\cdot 2 + c) + d = x(2)\\\vdots $$

(Of course, the equalities are only approximate equalities.) You can use a nonlinear method such as the Newton method to solve this nonlinear overdetermined system. The only problem is that you need a sufficiently good initial solution. Try to find a simple initial guess by inspection (if your data looks at all like a sinusoid ...). For $a$ and $d$ you could simply use

$$a_0 = \max(|x(n)|),\quad d_0 = \frac{1}{N}\sum_{n=0}^{N-1}x(n)$$

as initial guess ($N$ is the number of data points).

  • $\begingroup$ ,thanks for the answer, I have done that, it did not work in start, i have restricted the x values to an interval 2.0 and equidistant, then it worked, any specific reason for this behavior? how could i know this interval $\endgroup$ – Shan Apr 18 '13 at 21:07
  • $\begingroup$ Wouldn't it be better to just find the frequency and phase using an FFT? $\endgroup$ – endolith Apr 19 '13 at 17:26
  • $\begingroup$ I'm not sure if an FFT could give better results than the standard sine regression I've described. I guess it all depends on the type of signal and on the noise. Anyway, an FFT could probably be used to get a reasonable initial solution for the nonlinear optimization routine. $\endgroup$ – Matt L. Apr 20 '13 at 9:50

Your Answer

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

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