# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## How to to continuously average dynamic voltage data

Hi All,

I have LV 8.6 basic.

I am aquiring a continuous analog voltage signal from an RPM transducer using a DAQ Asistant.

the display jumps around quite a bit and it could use some smoothing out. My thought is to average the data in sample groups.

The data type is dynamic coming from the assistant. I would like to try and average 10 to 20 samples them update the display so appears more stable.

I did search and look at many examples but I still stumped.

Any thoughts?

Mully

Message 1 of 26
(11,584 Views)

## Re: How to to continuously average dynamic voltage data

Hi, Personally I am a fan of an exponential average in a situation like this.  It has the advantage of being a point-by-point average so it can be updated along with the data.  The formula I use is that NewAve = ((D-1)*OldAve + NewValue)/D.  D is often referred to as the degree of the filter.  This VI shows a very simple example of smoothing random numbers, the MaxMin check is used to ensure that the degree used is less than or equal to the number of points.  You can skip this if you don't mind the value being off for the first D points.
Message 2 of 26
(11,569 Views)

## Re: How to to continuously average dynamic voltage data

Hi Darin,

Thanks for the vi. I am new to programing so I'm still confused. I just want to output the mean value of a set number of voltage data points to a display set after set after set. This is much like the Average express .vi does in the profesional version of LV. Any thoughts?

Mully

Message 3 of 26
(11,548 Views)

## Re: How to to continuously average dynamic voltage data

Hello,

Please see the basic averaging code screenshot I have attached. Where the DAQ assistant is located would be where your dynamic data goes in.

Message 4 of 26
(11,544 Views)

## Re: How to to continuously average dynamic voltage data

Hi Mark,

I built a .vi based on the picture you sent but it looks like 0 is added to the aquired data value and then devided by 1???

I would like to out put to a display the mean of every 10 data points aquired. I must be missing something??

Thanks

Mike

Message 5 of 26
(11,536 Views)

## Re: How to to continuously average dynamic voltage data

Hello,

The symbol that the 0 constant is wired to is a Shift Register. This initialises the first run of the loop to have 0 in the shift register. On successive runs, the value going into the adder is the previous adder result which is wired to the right side Shift Register, this is a method of feedback to the next iteration of a loop.

Message 6 of 26
(11,529 Views)

## Re: How to to continuously average dynamic voltage data

Hi,

I put a loop around your vi but it always passes 0 into the shift register and devides by 1 every time it loops ??? What do I have wrong?

Message 7 of 26
(11,506 Views)

## Re: How to to continuously average dynamic voltage data

Hello,

Try my code, which is attached!

Notes: Replace the DAQ Assistant with your own,  set to read a voltage on a channel of your choosing, with a finite (N Samples) number of samples (this is why I don't have a timer in my loop).

Make sure the samples to read is greater than 1, more like 1000 otherwise you won't have a valid average.

Message Edited by macaba on 07-30-2009 03:17 AM
Message 8 of 26
(11,483 Views)

## Re: How to to continuously average dynamic voltage data

Hi Mark...................Thanks.

This seems to work.

So when the Daq assistant is set to "N samples" it takes that amount of samples and outputs them to the average code which updates the display each time the loop runs?

Do I have this correct??

Ps.

I have a vi that has multiple loops. I want to stop them all with one front panel button but I need to complete the "shut down code in the last block of a flat sequence structure before exiting.Here is what I have.

Any ideas??

Mike

Message 9 of 26
(11,467 Views)
Solution
Accepted by Mully911

## Re: How to to continuously average dynamic voltage data

"So when the Daq assistant is set to "N samples" it takes that amount of samples and outputs them to the average code which updates the display each time the loop runs?"

Absolutely right.