Skip to main content
. 2017 May 30;17(6):1240. doi: 10.3390/s17061240
Algorithm 1: Sinusoidal data fitting algorithm for parameters estimation
  1. The signal s[n] in its general form can be represented as sum of sinusoids as follows:
    s[n]=l=1p(αlsin(ωln+φl)+Cl) (3)
    In Equation (3), αl is real valued constant describing the amplitude and ωl represent angular frequency, φl is the initial phase. The constant Cl shows the mean value other than zero. It is convenient to write the Equation (3) as follows.
    s[n]=l=1p(Alcos(ωln)+Blsin(ωln)+Cl) (4)
    It is convenient to use a vector representation of Equation (4). Let’s stack the samples in column vector as follows:
    s=l=1pHlθl (5)
    In the above Equation (5);
    Hl=[cos(ωl)  sin(ωl) 1cos(2ωl) sin(2ωl) 1...cos(Nωl) sin(Nωl) 1] θl=[AlBlCl] (6)
  2. In our case, the model given by Equation (4) is simplified as; p=1 and C=0. Consider a signal s[n] with unknown parameters A,B,C and ω i.e., Equation (4) with p=1. The measured signal is then given by s[n] deteriorated by additive noise w[n] as shown in Equation (7):
    x[n]=s[n]+w[n] n=1,2,3, .. , N (7)
    The noise is assumed zero mean white Gaussian noise. The estimation problem is to estimate the signal parameters using the measured samples of the input data x=[x(1), x(2), . x(N)]. 
  3. The probability density function (pdf)
    p(x;θ,ω)=1(2πσ2)exp[12σ2(xHθ)T(xHθ)] (8)
    The above equation describes the probability per infinitesimal volume of receiving the data samples x given a set of parameters {θ,ω}.
  4. The maximum likelihood estimator (MLE) tries to maximize the pdf with respect to unknown parameters for given values of x and use those parameters as estimates i.e.,
    [θ^,ω^]=arg θ,ωmaxp(x;θ,ω) (9)
  5. Finally, the estimate of θ is given by least-squares solution as follows
    θ^=(HTH)1HTx  (10)
  6. By using the least-squares solution, the MLE criterion function can be concentrated to one parameter as follows
    g(w)=xTH(HTH)1HTx (11)
  7. The frequency estimate is then obtained from maximizing the function g(w), that is
    ω^=argωmaxg(w) (12)
    The Equation (12) can be solved either by using iterative step method i.e., Gauss-Newton iteration [42] or by a non-linear search.