What is this data processing technique, advantages or disadvantages and when to use?
I have seen this used in display bars to smooth the output see sudo code below:
counter = 0;
value = 0;
value = get.value();
if (value > counter){
counter++;
elseif (value < counter){
counter--;
}
println(counter);
This has the effect of ensuring the data is smooth and data anomalies are completely filtered out typically used with some delay. I have used this before with an ultrasonic transducer that would spit out 0's at frequent intervals the code above allows me to keep the data within my measuring resolution and avoid those anomalies.
while i think you forgot a closing }, it looks like you're doing a form of leaky integration where you compare a measurement to a value representative of the input and adjust it more slowly to filter out higher frequency noise.
I don’t know its name because I came up with it all by myself back in the 70s to get a finer resolution when painting with a light pen on a CRT display.
Basically it is a low pass filter. Its disadvantage is that it is much slower to to respond to changes but it will smooth out glitches like you said.