<div dir="ltr"><div>Mark's suggestion (averaging) is the simplest form of a FIR filter.</div><div><br></div><div>A very simple IIR filter is as follows:</div><div><br></div><div>output_value = filter_sum >> 4;</div><div>filter_sum = filter_sum - output_value;<br></div><div>filter_sum = filter_sum + input_value;</div><div><br></div><div>Quite often what you're trying to kill is just a very noisy glitch. eg.</div><div>20, 22, 18, 78, 24, 21, the twenty-something values are Ok, the 78 is not.</div><div><br></div><div>For that you don't want to use a FIR or IIR because these cook the noise in. Instead you want to use a median filter which looks at the last, say, 5 values and picks the middle value. This eliminates outliers (like the 78).<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 18, 2018 at 10:28 AM Richard Jones <<a href="mailto:richardandjanej@gmail.com">richardandjanej@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Wallace,</div><div><br></div>Maybe a little more context is required to understand the measurements being taken and the problem that you have with the results. <div><br></div><div>Is this static measurement data that you wish to filter, or real time samples with frequency domain filter, or maybe you wish to do a curve fit?<div><br></div><div>Richard Jones</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 18, 2018 at 10:20 AM Mark Atherton <<a href="mailto:markaren1@xtra.co.nz" target="_blank">markaren1@xtra.co.nz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Take 32 readings, add them together, divide result by 32 (or however <br>
long you can tolerate waiting).<br>
<br>
Need to be very careful about overflow. What is your basic data-type ?<br>
<br>
Can't think of a simpler filter than averaging...<br>
<br>
-Mark<br>
<br>
<br>
On 18/10/2018 9:03 AM, Marshland Engineering wrote:<br>
> I need to do some software filtering. I'm reading a camshaft with a 0.001<br>
> linear scale and there is quite a bit of noise in the data. Looking on the web<br>
> has left me non the wiser. Rectangular or Triangle filters are an option but<br>
> these will loose some data integrity. The profile is a very gentle curve with<br>
> the data around the ctr line.<br>
><br>
> I hoping for something simple !!!!<br>
><br>
> Thanks Wallace.<br>
><br>
><br>
> _______________________________________________<br>
> Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
> <a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
> Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
> Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
> When replying, please edit your Subject line to reflect new subjects.<br>
<br>
<br>
<br>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>
_______________________________________________<br>
Chchrobotics mailing list <a href="mailto:Chchrobotics@lists.ourshack.com" target="_blank">Chchrobotics@lists.ourshack.com</a><br>
<a href="https://lists.ourshack.com/mailman/listinfo/chchrobotics" rel="noreferrer" target="_blank">https://lists.ourshack.com/mailman/listinfo/chchrobotics</a><br>
Mail Archives: <a href="http://lists.ourshack.com/pipermail/chchrobotics/" rel="noreferrer" target="_blank">http://lists.ourshack.com/pipermail/chchrobotics/</a><br>
Meetings usually 3rd Monday each month. See <a href="http://kiwibots.org" rel="noreferrer" target="_blank">http://kiwibots.org</a> for venue, directions and dates.<br>
When replying, please edit your Subject line to reflect new subjects.</blockquote></div>