This online harmonic analyzer process continuous or discontinuous time series to extract the phase and amplitude of the principal tide components. Click here for a presentation of the analysis method.
Provide a text file to carry the computation.This online harmonic analyzer process continuous or discontinuous time series to extract the phase and amplitude of the principal tide components. Click here for a presentation of the analysis method.
Provide a text file to carry the computation.Name | a (rad/h) | τ (h) | Hf (m) | θ (rad) | use |
---|
Each line in the file should correspond to a data point, at the exception of the eventual header or comments.
If the data uses a datetime format, provide a format string according to the c++ std::get_time format . Otherwise, if the times values are just plain numeric values, please provide the number of seconds per unit of time in the format field (ex: 3600 for hourly data).A signal can be approximated with the following series, \[ h(t) = H_0 + \sum_{j = 1}^{n}{H_j f_j \cos(a_j t + \theta_j)} \] In the case of tides, the pulsations $a_j$, and the node factor $f_j$ are known astronomical constants. $f_j$ should be close to 1 and vary very slowly over years.
We choose to write $A_j = H_j f_j$ when approximating $f_j$ as constant over time.
We want to find the $2 \cdot n$ parameters $\theta_j$ and $A_j$ so as
to minimize the residual norm $||\boldsymbol{r}||^2$
for the $m$ data points $(t_i, h_i)$ .
\[ h_i - H_0 - \sum_{j}^{n}{A_j \cos(a_j t_i + \theta_j)} = r_i \]
\[ h_i - T_i(\boldsymbol{A} , \boldsymbol{\theta}) = r_i \]
With $T_i$, a non-linear operator on the vectors $\boldsymbol{A}$ and $\boldsymbol{\theta}$.
However, the series can be rewritten to get a linear optimization problem.
Using the angle sum identity one can show that with well chosen $c_j$ and $s_j$, \[ \sum_{j}{A_j \cos(a_j t + \theta_j)} = \sum_{j}{c_j \cos(a_j t)} + \sum_{j}{s_j \sin(a_j t)} \]
Thus the problem can be written using a linear operator $\boldsymbol{T}$ in matrix form, with $\boldsymbol{T}$ as a $m \times 2 n$ matrix and $\boldsymbol{x}$ as a $2 n$ entries vector, \[ \boldsymbol{h} - \boldsymbol{T} \cdot \boldsymbol{x} = \boldsymbol{r} \] \[ \boldsymbol{x} = \begin{bmatrix} c_0 \\ ... \\ c_i \\ s_i \\ c_{i+1} \\ s_{i+1} \\ ... \\ s_{n} \end{bmatrix} ~~~~~~,~~~~~~ \boldsymbol{T} = \begin{bmatrix} & & ... & & \\ & \cos(a_j t_{i-1}) & \sin(a_j t_{i-1}) & \cos(a_{j+1} t_{i-1}) & \\ & \cos(a_j t_i) & \sin(a_j t_i) & \cos(a_{j+1} t_i) & ...\\ ... & \cos(a_j t_{i+1}) & \sin(a_j t_{i+1}) & \cos(a_{j+1} t_{i+1}) & \\ & \cos(a_j t_{i+2}) & \sin(a_j t_{i+2}) & \cos(a_{j+1} t_{i+2}) & \\ & & ... & & \end{bmatrix} \]
The relations between the parameters {$A_j$, $\theta_j$} and {$c_j$, $s_j$} are retrieved as follow,
\[ c_j \cos(a_j t) + s_j \sin(a_j t) = \sqrt{{c_j}^2 + {s_j}^2 } \left[ \hat{c}_j \cos(a_j t) + \hat{s}_j \sin(a_j t) \right] \]
with,
$ \hat{c}_j = \frac{c_j}{\sqrt{{c_j}^2 + {s_j}^2 }} $ and $ \hat{s}_j = \frac{s_j}{\sqrt{{c_j}^2 + {s_j}^2 }} $
Then, we can find $\theta_j$ such that, \begin{equation*} \begin{split} \hat{c}_j \cos(a_j t) + \hat{s}_j \sin(a_j t) &= \cos(\theta_j)\cos(a_j t) - \sin(\theta_j) \sin(a_j t) \\ &= \cos(a_j t + \theta_j) \end{split} \end{equation*}
Thus, \begin{equation*} \begin{split} \theta_j &= \arctan2(-s_j, c_j) \\ A_j &= \sqrt{{c_j}^2 + {s_j}^2 } \end{split} \end{equation*}
A bidiagonal divide and conquer SVD is performed on the $\boldsymbol{T}$ matrix to find the approximate solutions of the over-constrained system, \[ \boldsymbol{T}\boldsymbol{x} = \boldsymbol{h} \] The WebAssembly code uses the Eigen solver implementation.