noise filtering from incoming list
Hello, forum!
I am getting incoming data from arduino.
The sensor data is very noisy and I want to cancel out the noise data.
I attached a picture and you can see that the meaningful data is under noise data incoming.
The thick black bars are only meaningful datas.
How can I filter out the noisy data from incoming list?
Thank you!
[slide] might be an option. Also check in Max, menu Extras -> ExamplesOverview -> Tab "Latest" -> sensor-tamer.help, but it's really useful only if you want to use data to trigger events (not for tracing a value...)
Median filtering can also be helpful because it is resistant to outlying values. A combination of zl.stream 7 -> zl.median will do for a single value.
I like this one, Peter!
Thank you all!
Combination of [slide] and [zl.median] worked for me!
I smoothed out the incoming list with [slide] then figured out median number out of it.
And then I compared the median with the incoming list filtered from slide in order to trigger an action.
I tried zl stream but I found slide work better in this case. Maybe zl stream 50 was too much. I do not know.
Thank you anyway!
50 is likely to be too much because that's going to introduce a lot of latency. When you use zl.median, you probably want to feed it a list that has an odd-numbered length. That way, the output is guaranteed to be in the input data (for even-numbered lengths, you take the average of the two center elements).
I would recommend trying something like zl.stream 5 (or 7) -> zl.median -> slide (optional). The median doesn't need to be very large; its main purpose is to remove spurious spikes. Slide is there to smooth out the sometimes blocky output of the median if desired.
cool, i will try that!
One other thing: if you're using slide, it's probably good to make sure that you're reading data at a regular rate because it will smooth over N inputs, not over time. (and since you want it smooth over time, that's where you could use metro to force it to output more regularly)
HTH!
got it! I will let you know what I come up with. Thanks a lot!!