# EMALP

Exponential moving average low pass.

Good to smooth a signal.

EMA is an exponential moving average, a way of calculating an average value.

Usually, an average is calculated by adding values and then dividing by the amount of values added (in Mover it's MALP).

The exponential moving average does the same, but the old values have less weight on that average, while the most recent ones have an higher weight on the average.

The weight of a value in the average, varies exponentially. That's why we call it exponential moving average.

The advantage of this filter is that it's fast to calculate, and follows closely the received values.

In the figures we see the filter in action where we are receiving a signal (in grey) full of noise.

By using a EMA with the last 200 values, we can remove the noise and we get the almost clean sinusoidal that was hidden inside that signal.

The EMA smooths the signal, by using 200 values, where the oldest value as almost zero weight in the average and the last one as full weight.

LP here, stands for low pass. This means we only allow low frequency to pass.

If you look at the example given, by applying the EMA, we are removing the spikes, that are high frequency signals.

So the EMA is already the EMALP.

EMALP is a low pass filter, where only the low pass frequencies are allowed and the high frequencies are removed.

The strength of the smooth depends on the amount of samples used.

**To use EMALP in Mover we do:**

EMALP(parameter1;parameter2)

parameter1 is the value we want to filter.

parameter2 is the amount of samples/values used in the EMA.

To better understand the behaviour of the filter, we can look at the filter in the frequency domain.

In the low pass filter we just allow low frequency signal through the filter.

Cutoff frequency is the frequency that defines the point until where we allow frequency to pass.

But? Where is frequency? How do I define the frequency where I want to stop receiving values for this low pass filter?

Well, with Mover, we don't have the "frequency", we have the number of samples used to calculate the average.

Like I said above, more samples, more spikes removed, softer the signal.

We have the frequency, but it depends on the elapsed time between each sample received.

To achieve fast calculations and coherent results, Mover tries to keep a steady calculation time in each loop. So Mover ignores frequency. There's no need here to look for the value of frequency.

By default, the calculation time in Mover is 2 ms. You can change it in the Main window menu, under options.

So when comparing results between users, you should always say the filter parameters and the calculation rate, because results are different for different calculation rates.

Be also aware that the cutoff frequency is not all in all out.

**EMALP in the frequency domain**

The figure shows a low pass filter in the frequency domain.

From left to right we have frequency increasing.

Vertically, we have how much of the frequency passes on the filter.

For the lowest frequency, all values pass, and when we start reaching the cutoff frequency, the amount starts decreasing and will reach zero after the cutoff frequency.

So cutoff frequency is not all in all out. It has a transition.

That's what happens on our filters. There's no clear definition between what passes and what doesn't pass.

So that 200 that appears on the definition of the filter, is the number of samples used by the filter. It's the way to define the cutoff frequency in Mover.

If you use one sample, that's the equivalent to infinite value for cutoff frequency. Everything passes.

You are calculating an average using one value with the last received value. Result is the received value.

If you use 200, then you calculate the average of 200 values. You are lowering the cutoff frequency as you increase the number of samples.

Please retain this:

More samples in the filter = Lower cutoff frequency

1 sample = Infinite cutoff frequency

More samples in EMALP = Smoother