View Single Post
  #130  
Old March 20th 19, 12:09 AM posted to rec.bicycles.tech
Radey Shouman
external usenet poster
 
Posts: 1,747
Default GPS Units = Show road steepness?

James writes:

On 20/3/19 4:20 am, Radey Shouman wrote:
writes:
[ ... ]

averages in particular. And I think that it was Radey talking about
using IIR which would require a high end FPGA wouldn't it? I'm buying
a new, wireless VDO for $50.


An IIR can be very simple to implement. The "leaky integrator" or
"exponential filter" is probably the simplest digital low-pass filter
possible:

y_i = y_{i-1} + k (x_i - y_{i-1})

In C:

y += k*(x - y);

If you're not too fussed about the actual cutoff frequency the
multiplication can be done as a shift. The precision used for the
state, y, does need to be higher than that of the input.

If you need precise control over the frequency response then more work
in design and more expense in implementation is needed, but not always.


y(i) = y(i-1) + k.x(i) - k.y(i-1)

y(i) = y(i-1) - k.y(i-1) + k.x(i)

k is usually a fraction, 0 k 1. To avoid floating point
arithmetic and division, if you make it a binary fraction (1/2, 1/4,
1/8, 1/16, etc), you can implement the filter with bit shifts, and
addition and subtraction only.


I should have written 0 k 1.0. |k| 1.0 is not stable.
k = 0 hasn't any use that I know of.

--
Ads
 

Home - Home - Home - Home - Home