# Does this Signal Smoothing algorithm have a name?

We are reverse engineering some 20 year old software. Original developers were laid off years ago, and cannot be found.

In this code, there is a signal that is getting smoothed as follows:

• $P_{new} = P_{old} + P_{\Delta} \frac{H + (I-H) P_{\Delta}^2}{J^2 + P_{\Delta}^2}$
• $P_\Delta = P_{newest Observation} - P_{old}$
• $H$ is commented in the code as, Quiescent Smoothing. It is a hardcoded constant, $H > 0$.
• $I$ is commented in the code as Step Smoothing. It is a hardcoded constant. $I > 0$.
• $J$ is commented as Noise Threshold. It is a hardcoded constant. $J > 0$.

I am interested in the name of this algorithm.

I was asked, as I've done a lot of work in motion tracking, but this is clearly not a Kalman filter, or any of it's variants.

• I don't know what it is, but it looks like a (crudely) adaptive EWMA filter. – Andy Walls May 1 '18 at 0:24
• Are $H$ and $I$ fixed constants? (an interesting shape by the way) – Laurent Duval May 1 '18 at 11:56
• @LaurentDuval Yes, $H$ and $I$ are fixed constants, with the names as given in my question. – John May 1 '18 at 15:16
• @AndyWalls Exactly. What is strange/new/unusual to me, are the $P_\Delta^2$ terms. – John May 1 '18 at 15:17
• I'm digging, be sure, eager for a sound answet – Laurent Duval May 1 '18 at 16:49

Not sure if this has a name, but it is a nonlinear low pass filter that uses different smoothing constants depending on the input signal deviation from the filtered output. Small deviations are typically assumed to indicate consistency with the smooth estimation and result in little adaption to the input, while large deviations indicate a relevant state change and allow the system to adapt quickly.

The system difference equation is $$y[n] = y[n-1] + \left(x[n]-y[n-1]\right) * F\left((x[n]-y[n-1])^2\right)$$

If you assume that the feedback term is constant and $F=1$, the system passes the input to the output unmodified. Smaller $F>0$ will create a first order lowpass filter and the output signal will be smoothed correspondingly.

If the nonlinear term is well behaved and can be analysed like a time-dependent cutoff parameter. The interesting behaviour of your $$F(d)=\frac{H+(I-H)d}{J^2+d}$$ is that near $d=0$ and for $d\to\infty$. For the first case you get $F(0)=H/J^2$ and for the second case $F(\infty)=I-H$. In between $F$ is monotonous and approximately constant for $d<<J^2$.

That means for small $d$ compared to $J^2$ the filter rejects assumed additive noise with approximately constant feedback and therefore behaves like a traditional low pass filter with feedback $H/J^2$. As $d$ increases, the filter behaviour switches to pass-through for sudden changes and reaches its asymptotic behaviour as traditional low pass filter at a feedback of $I-H$.

Arguably a different set of parameters would make this filter structure clearer. Substituting $H/J^2$ and $I-H$ with frequency related feedback constants would probably help.

Edit: I've used similar filters for smoothing high resolution potentiometer inputs in MIDI controllers.

• So the names Quiescent Smoothing, H, and Step Smoothing, I, do make sense. If you view $d = \left(x[n] - y[n-1]\right)^2$ as an error term, when the error is small (filter/loop is tracking well), Quiescent Smoothing dominates, and when the error is large, the Step Smoothing dominates. FWIW, I would have arranged the difference equation to look like an EWMA filter: $y[n] = y[n-1]\cdot(1-F(d))+x[n]\cdot F(d)$. It gives one a hint that $F(d)$ should probably stay in $[0,1]$. – Andy Walls May 1 '18 at 17:32
• Jazzmaniac, that all makes sense. Once I realized the numerator was $H + (I-H)...$ instead of $H * (I-H) ...$ the meanings became quite a bit more obvious, and the adaptive nature of the filter was a lot clearer to me. The use of $P_\Delta^2$ is a bit of a head scratcher for me, but in the end, it only changes how it moves between the different modes. (small update mode, vs. large update mode), and the square will accentuate that difference. – John May 1 '18 at 22:26