## 2 Least Squares Sinusoidal Fitting Procedure  
Here, the analytical expression for the standard deviation of the sinewave amplitude estimation in the presence of jitter in the sampling instant is derived. We consider the mathematical model of our periodically sampled sinusoidal signal, namely  
\[x_{i}=C+A\cdot\cos(\omega_{x}t_{i}+\varphi) \tag{1}\]  
where \(x_{i}\) denotes the sample voltages and \(i\) is the sample index that runs from 1 to \(M\). Parameters \(A\), \(\varphi\), \(C\), and \(\omega_{x}\) are the signal amplitude, initial phase, offset, and angular frequency, respectively. The ideal sampling instants are represented by \(t_{i}\). In this work, these instants will be affected by normally distributed sampling jitter \(\tau_{i}\), with null mean and standard deviation given by \(\sigma_{\tau}\). Due to this random phenomenon under study here, the actual sample voltages become, from (1) and replacing \(t_{i}\) with \(t_{i}+\tau_{i}\),  
\[z_{i}=C+A\cdot\cos[\omega_{x}(t_{i}+\tau_{i})+\varphi]. \tag{2}\]  
The sinusoidal stimulus signal is also often affected by phase noise due to non-idealities in the signal generator. This phenomenon can be easily added to our mathematical model using the random variable \(\psi_{i}\):  
\[z_{i}=C+A\cdot\cos[\omega_{x}(t_{i}+\tau_{i})+\varphi+\psi_{i}]. \tag{3}\]  
It is thus easy to consider the effect of sampling jitter and stimulus signal phase noise together by using the random variable  
\[\theta_{i}=\omega_{x}\cdot\tau_{i}+\psi_{i}. \tag{4}\]  
Note that in the current work, it is assumed that the phase noise and the sampling jitter are statistically independent. It is considered here that this random variable is normally distributed with null mean and standard deviation \(\sigma_{\theta}\). Furthermore, assuming homoscedasticity, that is, the spread of residuals is uniform across the range of values of jitter and phase noise, the standard deviation can be easily obtained from the standard deviation of the jitter and the phase noise using\[\sigma_{\theta}=\sqrt{\omega_{x}^{2}\cdot\sigma_{t}^{2}+\sigma_{\psi}^{2}}. \tag{5}\]  
The samples are then used to estimate the sinusoidal amplitude using a least squares procedure, commonly known as \"sine fitting\". The estimated value of the amplitude \(A\) is designated here with a hat over the symbol: \(\hat{A}\). This estimated amplitude is thus a random variable due to the randomness of \(\tau_{i}\) and \(\psi_{i}\). This mathematical procedure consists of building a matrix \(D\) given by  
\[D= \begin{bmatrix}\cos(\omega_{x}t_{1})&\sin(\omega_{x}t_{1})&1\\ \cos(\omega_{x}t_{2})&\sin(\omega_{x}t_{2})&1\\ \cdots&\cdots&\cdots\\ \cos(\omega_{x}t_{M})&\sin(\omega_{x}t_{M})&1\end{bmatrix}  \tag{6}\]  
and then using it together with the samples \(z_{i}\) to estimate the sinewave parameters using  
\[ \begin{bmatrix}\hat{A}_{I}\\ \hat{A}_{Q}\\ \hat{C}\end{bmatrix} = \begin{pmatrix}D^{T}D\end{pmatrix} ^{-1}D^{T} \begin{bmatrix} z_{1}\\ z_{2}\\ \ldots\\ z_{M}\end{bmatrix} . \tag{7}\]  
Note that from the estimated in-phase amplitude, \(\hat{A}_{I}\), and the estimated in-quadr amplitude, \(\hat{A}_{Q}\), it is possible to obtain the estimated sinusoidal amplitude using  
\[\hat{A}=\sqrt{\hat{A}_{I}^{2}+\hat{A}_{Q}^{2}}. \tag{8}\]  
The matrix product \(D^{T}D\) in (7) is equal to (9). Considering that the sinusoidal frequency is known, one can use coherent sampling and acquire the signal samples, which cover exactly an integer number of signal periods. Some of the terms in (9) vanish, which results in a diagonal matrix:  
\[D^{T}D= \begin{bmatrix}\sum_{i=0}^{M-1}\cos^{2}(\omega_{x}t_{i})&0&0\\ 0&\sum_{i=0}^{M-1}\sin^{2}(\omega_{x}t_{i})&0\\ 0&0&M\end{bmatrix} . \tag{9}\]  
Inserting this into (7) leads to  
\[ \begin{bmatrix}\hat{A}_{I}\\ \hat{A}_{Q}\\ \hat{C}\end{bmatrix} = \begin{bmatrix}\frac{2}{M}\sum_{i=0}^{M-1}z_{i}\cos( \omega_{x}t_{i})\\ \frac{2}{M}\sum_{i=0}^{M-1}z_{i}\sin(\omega_{x}t_{i})\\ \frac{1}{M}\sum_{i=0}^{M-1}z_{i}\end{bmatrix}