News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

continuous averaging routine

Started by Yves, Sep 19, 2023, 08:49 AM

Previous topic - Next topic

Gabi

Here is a Moving Average filter (FIR based) example used in the past.

You need to declare/set the number of taps the filter will be iterating on your circular buffer data.

In the picture there are a few graphs on using 3, 4 and 10 taps for averaging. (data in there copy/pasted from the program output on a terminal).

GL & 73
YO4WM

Gabi

Some additional info:

The speed of MAF can be increased if using the recursive implementation.
See page 282 on Chapter 15 in this book: The Scientist & Engineer's Guide to Digital Signal Processing, 1999


As an additional note:
 by properly adjusting the values of coefficients the performance of this simple FIR Moving Average Filter could be improved.


An example sheet is attached, where you can see the difference between using initial 1/N weights for the coefficients and a bit of tuning the results with either adding some Gain (if needed) or Sliding the results up or down.

GL & 73
YO4WM