Fitness function for window length of filter

In summary, the conversation discusses the use of different filters, namely exponential moving average (EMA) and linear weighted moving average (LWMA), on a sinusoidal signal. The difference between these two filters is shown to be in phase with the sinusoid when the window length of the LWMA is equal to one quarter of the period of the sinusoid. The question is then posed whether it is possible to determine the optimal window length for the filter by only looking at the data within the window and using a fitness function. The specifics of such a fitness function are still unknown, but it is suggested that it could potentially be related to curvature, exponential fit, or properties of sinusoids.
  • #1
MisterH
12
0
TL;DR Summary
Find a fitness function such that: filter(LWMA-EMA) is in-phase with the sinusoid it's placed on, not by correlation, but calculated on filter weights * segment of sinusoid (that has a length equal to the filter weights), so on only 1 step of the convolution.
Fitness function for window length of filter

On a sinusoidal signal with amplitude 1, and period P, an exponential moving average (EMA) (with alpha = 1/n), and a linear weighted moving average (LWMA) (with window length n) are calculated; when you subtract the EMA from the LWMA, it can be seen that the difference of these 2 filters will be in phase with the sinusoid when the window length n of the LWMA = P/4 (and for the EMA alpha = 1/n). So if P=40, the signal: LWMA(wave,10)-EMA(wave,0.1) is in phase with the wave, but at lower amplitude. The weight function of this "difference filter" looks like this:
weights of LWMA-EMA.png

Similar, but not equal to the weights of a "zero-lag exponential moving average". It can be seen that the correlation (degree of linear association) between the wave and the filter will be maximal at n = P/4:
wave and 3 filters.png


Now, my question is: instead of looking at an entire wave, can you just look at the data in the window, multiplied with the filter weights to find which window length n will result in a signal that is in phase with the sinusoid? e.g.:
weights multiplied with wave segment.png


So at e.g. point x, wave[(x-n+1):x] is multiplied with the weight function of the difference filter, on this data, some sort of calculation is made, that returns a value e.g. between 0 and 1, with a maximum for n = P/4? So the fitness of window length n1: wave[(x-n1+1):x]*weightfunction(n1) can be compared with the fitness of window length n2: wave[(x-n2+1):x]*weightfunction(n2), and the one where n equals a -previously unknown- P/4 will return a maximum for this fitness/error function.

How would you create such a fitness function? Could it be related to curvature, or some sort of exponential fit, or some property of sinusoids?

All input is welcome and appreciated.
 
Mathematics news on Phys.org
  • #2
weights multiplied with wave segment2.png
 

FAQ: Fitness function for window length of filter

What is a fitness function for window length of filter?

A fitness function for window length of filter is a mathematical function used in the field of signal processing to evaluate the performance of a filter. It measures the effectiveness of a filter in reducing noise and preserving the important features of a signal.

How is the fitness function for window length of filter calculated?

The fitness function for window length of filter is typically calculated by comparing the output of the filter with the original signal. The difference between the two is then evaluated using a specific mathematical formula, such as the mean squared error or the peak signal-to-noise ratio.

What is the purpose of a fitness function for window length of filter?

The main purpose of a fitness function for window length of filter is to optimize the performance of a filter by finding the best window length that minimizes noise and preserves signal features. This helps to improve the overall quality of the filtered signal.

How do you determine the best window length using a fitness function for window length of filter?

The best window length can be determined by running the fitness function for different window lengths and selecting the one with the lowest value. This indicates that the filter performs the best with that particular window length.

Are there any limitations to using a fitness function for window length of filter?

Yes, there are limitations to using a fitness function for window length of filter. It assumes that the original signal is known and that the noise is additive and independent. It also does not take into account any non-linearities in the signal or the filter, which can affect the performance of the filter.

Similar threads

Replies
4
Views
5K
Replies
30
Views
5K
Replies
6
Views
5K
Replies
125
Views
18K
Back
Top