LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

making an average of the last 100 values?

Hi everyone,
 
I am acquiring a signal every 1000mS with Labview 7.1. I need to make an average of the last 100 values every 1000mS. I know how to do this with shift registers but it would be a bit long to do it this way...There must be a better way Smiley Happy
 
Would anybody have an example of an array that takes into consideration the new value that has just been acquired, so that I can make an average of the array?
 
Thank you very much for your help,
 
Toto
0 Kudos
Message 1 of 7
(5,777 Views)

Hi Toto,

Here is the first thing I thought of.  Initialize an array of 1000 elements, and replace an element each iteration of the loop.  Use the Quotient and Remainder function along with the iteration count of the loop to replace the oldest element in the array.  Add the array and divide by 1000 in each iteration to get the current average.  I've attached the VI (saved in LabVIEW 7.1), along with a screenshot for anyone who wants to see it but doesn't have LabVIEW 7.1 or later.

Good luck,

-D

Message Edited by Darren on 02-05-2006 07:40 PM

Download All
Message 2 of 7
(5,762 Views)
Use the Mean.vi to calculate your average. Not the Nice.vi. I think it is under mathematics, I don't have labview on this machine.
Message 3 of 7
(5,744 Views)
We have used a sort of rolling average with good results.

You could probably shorten the startup time by using the minimum
of the iteration count +1 or 'N' but I haven't looked at that.

Matt
Message 4 of 7
(5,723 Views)
There's a nice Mean PtByPt.vi that does this job. You can configure the size of a buffer, which is averaged each call.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 5 of 7
(5,717 Views)
I sometimes use a waveform chart with the front panel hidden as a circular buffer.  Make its data length 100 points, read the History property to get the data and run the mean.vi whenever you need an average.
Randall Pursley
Message 6 of 7
(5,709 Views)

Hi everyone,

Thanks to all of you for your quick help and answers!

I'll try some of your ideas,

cheers,

Toto

0 Kudos
Message 7 of 7
(5,682 Views)