Difference of WMA & EMA on a sinusoid becomes superposed?

In summary, the conversation is about signal processing, specifically using weighted moving averages (WMA) and exponential moving averages (EMA) on a sinusoid with a period of n. The resulting difference between the two is perfectly in phase with the input signal, but only when the WMA is calculated for n/4 and the EMA for its equivalent. This could be related to the structure of a sine wave, the sine and cosine functions on the unit circle, the lag or group delay of the filters, or the negative filter weights used in causal time series analysis. The speaker believes there is a deeper reason for this phenomenon and seeks an explanation.
  • #1
MisterH
12
0
This is about signal processing, moving averages & superposed / standing waves. This is an online system: causal (univariate) time series analysis.

Suppose you have a sinusoid of period n (i.e. n=40, so its frequency is 0.025). If you calculate a "weighted moving average" (WMA) on this sinusoid with a lookback-window equal to 1/4th the period of the sinusoid (i.e. 40/4 = 10), and from this WMA, you subtract an "exponential moving average" (EMA) with an alpha equal to 1 divided by 1/4th the period of the sinusoid (i.e. 1/10 = EMA alpha of 0.1), the resulting difference is perfectly "in phase" with the sinusoid. But this is only true if you do it for the n/4 setting. In fact, the result looks a lot like a superposed, standing wave: like in this image:
ex.png


This cannot be a coincidence. There must be some kind of "deeper" reason that I fail to understand: why is this only true, if you pick n/4 for the WMA, and its equivalent for the EMA, and if you compare this exact difference (WMA-EMA) with the input wave signal, they are exactly in-phase: they turn at the same moment, and reach 0 at the same moment in time. There is no phase difference. Why?

Could it be related to the fact that a sine wave is made up of 4 identical pieces? (mirrored and inverted)?
Or something about the sine & cosine and the unit circle?
Or is it related to the lag / group delay of the WMA and EMA filters?
Or to the fact that this difference (WMA-EMA) has negative filter weights (not common in causal time series analysis)?

Why o why is this so.. I just know it's not a coincidence, there is a real explanation to this. Please help me because this intrigues me :) Thanks!
 
Mathematics news on Phys.org
  • #2
Did you write down the formulas and see if it works out?
 
  • #3
mfb said:
Did you write down the formulas and see if it works out?

I wrote the code for the image posted above myself in r. So yes, I did write down the formulas.
 
  • #4
That's not what I meant. Plug in a sine, subtract them, then simplify the expression, and see if you get a sine where you can calculate the phase.
 

Related to Difference of WMA & EMA on a sinusoid becomes superposed?

1. What is a sinusoid and how is it related to WMA and EMA?

A sinusoid is a mathematical function that describes a smooth, repeating oscillation. Weighted Moving Average (WMA) and Exponential Moving Average (EMA) are two commonly used methods for analyzing and predicting trends in time series data, including sinusoidal data.

2. What is the difference between WMA and EMA?

WMA is a moving average calculation that assigns different weights to each data point in the time series, with the most recent data points receiving higher weights. EMA, on the other hand, calculates the average by giving more weight to recent data points and less weight to older data points. This makes EMA more responsive to recent changes in the data compared to WMA.

3. How do WMA and EMA affect a sinusoid when superposed?

The process of superposition involves combining two or more sinusoids to create a new, composite sinusoid. When WMA and EMA are applied to a sinusoid, they smooth out the data and can help to identify long-term trends and patterns in the composite signal.

4. Can WMA and EMA be used to predict future values of a superposed sinusoid?

WMA and EMA are often used to make predictions about future values of a time series, including superposed sinusoids. However, the accuracy of these predictions depends on the underlying data and the choice of parameters for the moving average calculations.

5. What are some common applications of using WMA and EMA on a superposed sinusoid?

WMA and EMA are commonly used in financial analysis, stock market forecasting, and other fields where predicting future trends is important. They can also be used in signal processing to remove noise from a signal and identify underlying patterns in the data.

Similar threads

  • General Math
Replies
1
Views
742
Replies
22
Views
2K
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Introductory Physics Homework Help
Replies
6
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
10K
  • Mechanical Engineering
Replies
1
Views
3K
Replies
6
Views
2K
Replies
6
Views
4K
Back
Top