LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Average value of N samples

Hi,

I have a problem. I'm reading data continuously from analog input. I want calculate average value when I press button START. Average value should be calculated from samples which are defined by 'Number of samples' and 'millisecond multiple'. When all samples are read, average vale should show.

The problem is that when number of samples is higher then 10, it doesn't work.

Can someone tell me what I did wrong?

Thanks

 

P.S.. I saw that there was something like this but I can't open it because I use Labview 8.5

0 Kudos
Message 1 of 6
(4,813 Views)

So you are reading 1000 samples at a time, throwing everything away unless you press "start", at which point you take the currently sampled 1000 points and average the first N data points, again throwing away all remaining data.

Why are you slowing down the inner FOR loop with a wait? That just delays the result and holds up the entire big while loop.

 

I must be missing something. Can you explain once more what you actually want to average?

0 Kudos
Message 2 of 6
(4,797 Views)

The averaging is just a part of a bigger vi. The reason why I read 1000 samples is that I measure torque of engine with internal combustion and I need to do vi which would be able to average only part of collected samples.
These collected data are defined with number of samples and millisecond multiple.
Is it possible to do that in this way?

0 Kudos
Message 3 of 6
(4,787 Views)
For that you need to store the previous value for averaging... i have attached a VI regarding that ( sorry no time to cleanup ).. You can use the logic to calculate the average of the samples (Still am not clear about you requirement).

 

Smiley Wink

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 6
(4,773 Views)

 


@P Anand wrote:
 i have attached a VI regarding that

 

That VI makes no sense. Why would you use an event structure that stalls the entire loop until the button is pressed? You are building an array forever, but only look at the same first n point, no matter how many time we press the button and how much data we acquire.

 

Please don't post misleading/wrong examples. This is not helpful and only confuses.

0 Kudos
Message 5 of 6
(4,762 Views)

Ya thats my mistake.. Very sorry for that... Forgot to wire the timeou.. i Just tried to convey that an Event case can be used....Smiley Sad

-----

The best solution is the one you find it by yourself
0 Kudos
Message 6 of 6
(4,749 Views)