LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

8 point moving average filter

How to implement an 8 point moving averge filter for a sample size of 1000?

 

 

0 Kudos
Message 1 of 12
(5,011 Views)

There are many ways to do this.  One of my favorite is to just use an FIR Filter.  But the most straight forward way is to use the Mean Pt By Pt VI inside of a FOR loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 12
(5,004 Views)

Its not working as i have stored my input samples in an array.

 

0 Kudos
Message 3 of 12
(4,966 Views)

check these links below

 

 

Moving Average Filter w/ continuous data acquisition

http://forums.ni.com/t5/LabVIEW/Moving-Average-Filter-w-continuous-data-acquisition/td-p/2571975

 

moving average filter

 

http://forums.ni.com/t5/LabVIEW/Moving-Average-Filter/td-p/2550513

0 Kudos
Message 4 of 12
(4,951 Views)

Hi, sorry to reanimate this thread. Why would one use the FIR Pt By Pt instead of Mean Pt By Pt for a moving average filter?

0 Kudos
Message 5 of 12
(3,807 Views)

@jfalesi wrote:

Hi, sorry to reanimate this thread. Why would one use the FIR Pt By Pt instead of Mean Pt By Pt for a moving average filter?


I wouldn't! You need an 8 pt moving average, use the mean pt By pt.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 12
(3,804 Views)

@jithin12 wrote:

Its not working as i have stored my input samples in an array.

 


You don't tell what is "not working", but if you want to use "mean ptbypt", simply wrap a FOR loop around it and autoindex on the array, right?

 

 Of course you can also process the array directly, such as convoluting with an array containing 8 elements with a value of 1/8, then trim back to size.

 

ptbyptConvolution.png

 

(we need to trim because we don't have the output size option for 1D arrays Smiley Sad)

 

Note that the ptbypt version has a startup distortion for the first 7 points because fewer points are averaged at the beginning. Of course you might want to shift the subset start for the convolution version to eliminate the filter delay. (not shown)

0 Kudos
Message 7 of 12
(3,791 Views)

Try the below method.

running average.PNG


CLD Using LabVIEW since 2013
0 Kudos
Message 8 of 12
(3,763 Views)

@kartiknattar wrote:

Try the below method.

running average.PNG


That is NOT scalable! Most of the entire code would need to be rewritten if the history length should be changed to something else. What would you do to make a 1000 point average instead? Get a much bigger monitor? 😄

 

A properly written, scalable solution only need to change a single integer value to work with any history length. try it! 😉

(See also my NI Week presentation (Part II) where I compare four different running average implementations)

0 Kudos
Message 9 of 12
(3,749 Views)
@jithin12 wrote:

How to implement an 8 point moving averge filter for a sample size of 1000?

 

 


Hii, I have send you an PDF. You will get the whole information, hope that helps. Be sure to share results.

0 Kudos
Message 10 of 12
(3,727 Views)