0
$\begingroup$

I would like to determine the of each period amplitude of a time series (e.g. the amplitude of each day). The time series has a constant period of 1 day and varies only in amplitude. I have tried splitting the time series into individual periods then solving for the amplitude by re-arranging the equation:

$$y = A \cdot sin ( \frac{2 \pi}{\tau} \cdot t)$$

to:

$$A = \frac{y}{sin ( \frac{2 \pi}{\tau} \cdot t)}$$

where $A$ is amplitude, $\tau$. is the period and $t$ is time.

This works reasonably however there are issues with locating the beginning of each period.

Is there some more robust method I can use for this problem?

$\endgroup$
0
$\begingroup$

I assume from your solution that your time series closely fits a sine wave. The method you are using is quite good if you restrict yourself to the set of data which is near the peaks.

The more standard way is to find a best fit sinusoid using linear algebra techniques. You have stated the period, so you know the frequency. Let's assume you don't know where the zero crossings are. The problem then becomes to find the best values of $(a,b)$ so that

$$ Y = a C + b S $$

Where $Y$ is your signal values as a vector, $C$ is a cosine curve, and $S$ is a sine curve over one period. Now dot this equation with $C$ and then $S$ to get:

$$ Y \cdot C = a C \cdot C + b S \cdot C $$ $$ Y \cdot S = a C \cdot S + b S \cdot S $$

The dot products are scalars. Since $S$ and $C$ are orthogonal, their dot product is zero. The dot product of $S$ or $C$ with itself is $N/2$ where $N$ is the sample count. The equations then become

$$ Y \cdot C = a \cdot N/2 $$ $$ Y \cdot S = b \cdot N/2 $$

Solve for $a$ and $b$.

$$ a = \frac{ Y \cdot C }{ N/2 } $$ $$ b = \frac{ Y \cdot S }{ N/2 } $$

Your amplitude can now be found from $a$ and $b$.

$$ A = \sqrt{a^2+b^2} $$

This method is equivalent to a single bin of a Discrete Fourier Transform (DFT), so if you follow this then you understand how a DFT works.

To calculate the dot product, you take a summation:

$$ Y \cdot C = \sum_{n=0}^{N-1} { Y[n] C[n] } $$ $$ Y \cdot S = \sum_{n=0}^{N-1} { Y[n] S[n] } $$

That's all there is to it.

$\endgroup$

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.